Re: [PATCH 3/3] dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00

From: kbuild test robot
Date: Tue Sep 17 2019 - 08:18:52 EST


Hi Green,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190916]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Green-Wan/dmaengine-sf-pdma-Add-platform-dma-driver/20190917-142826
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/dma/sf-pdma/sf-pdma.c: In function 'sf_pdma_fill_desc':
drivers/dma/sf-pdma/sf-pdma.c:80:2: error: implicit declaration of function 'writeq'; did you mean 'writel'? [-Werror=implicit-function-declaration]
writeq(size, regs->xfer_size);
^~~~~~
writel
drivers/dma/sf-pdma/sf-pdma.c: In function 'sf_pdma_desc_residue':
>> drivers/dma/sf-pdma/sf-pdma.c:188:12: error: implicit declaration of function 'readq'; did you mean 'readb'? [-Werror=implicit-function-declaration]
residue = readq(regs->residue);
^~~~~
readb
drivers/dma/sf-pdma/sf-pdma.c: In function 'sf_pdma_free_desc':
drivers/dma/sf-pdma/sf-pdma.c:308:16: warning: unused variable 'flags' [-Wunused-variable]
unsigned long flags;
^~~~~
cc1: some warnings being treated as errors

vim +188 drivers/dma/sf-pdma/sf-pdma.c

71
72 static void sf_pdma_fill_desc(struct sf_pdma_chan *chan,
73 u64 dst,
74 u64 src,
75 u64 size)
76 {
77 struct pdma_regs *regs = &chan->regs;
78
79 writel(PDMA_FULL_SPEED, regs->xfer_type);
> 80 writeq(size, regs->xfer_size);
81 writeq(dst, regs->dst_addr);
82 writeq(src, regs->src_addr);
83 }
84
85 void sf_pdma_disclaim_chan(struct sf_pdma_chan *chan)
86 {
87 struct pdma_regs *regs = &chan->regs;
88
89 writel(PDMA_CLEAR_CTRL, regs->ctrl);
90 }
91
92 struct dma_async_tx_descriptor *
93 sf_pdma_prep_dma_memcpy(struct dma_chan *dchan,
94 dma_addr_t dest,
95 dma_addr_t src,
96 size_t len,
97 unsigned long flags)
98 {
99 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
100 struct sf_pdma_desc *desc;
101
102 if (!chan || !len || !dest || !src) {
103 pr_debug("%s: Please check dma len, dest, src!\n", __func__);
104 return NULL;
105 }
106
107 desc = sf_pdma_alloc_desc(chan);
108 if (!desc)
109 return NULL;
110
111 desc->in_use = true;
112 desc->dirn = DMA_MEM_TO_MEM;
113 desc->async_tx = vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
114
115 spin_lock_irqsave(&chan->lock, flags);
116 chan->desc = desc;
117 sf_pdma_fill_desc(desc->chan, dest, src, len);
118 spin_unlock_irqrestore(&chan->lock, flags);
119
120 return desc->async_tx;
121 }
122
123 static void sf_pdma_unprep_slave_dma(struct sf_pdma_chan *chan)
124 {
125 if (chan->dma_dir != DMA_NONE)
126 dma_unmap_resource(chan->vchan.chan.device->dev,
127 chan->dma_dev_addr,
128 chan->dma_dev_size,
129 chan->dma_dir, 0);
130 chan->dma_dir = DMA_NONE;
131 }
132
133 static int sf_pdma_slave_config(struct dma_chan *dchan,
134 struct dma_slave_config *cfg)
135 {
136 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
137
138 memcpy(&chan->cfg, cfg, sizeof(*cfg));
139 sf_pdma_unprep_slave_dma(chan);
140
141 return 0;
142 }
143
144 static int sf_pdma_alloc_chan_resources(struct dma_chan *dchan)
145 {
146 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
147 struct pdma_regs *regs = &chan->regs;
148
149 dma_cookie_init(dchan);
150 writel(PDMA_CLAIM_MASK, regs->ctrl);
151
152 return 0;
153 }
154
155 static void sf_pdma_disable_request(struct sf_pdma_chan *chan)
156 {
157 struct pdma_regs *regs = &chan->regs;
158
159 writel(readl(regs->ctrl) & ~PDMA_RUN_MASK, regs->ctrl);
160 }
161
162 static void sf_pdma_free_chan_resources(struct dma_chan *dchan)
163 {
164 struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan);
165 unsigned long flags;
166 LIST_HEAD(head);
167
168 spin_lock_irqsave(&chan->vchan.lock, flags);
169 sf_pdma_disable_request(chan);
170 kfree(chan->desc);
171 chan->desc = NULL;
172 vchan_get_all_descriptors(&chan->vchan, &head);
173 sf_pdma_unprep_slave_dma(chan);
174 vchan_dma_desc_free_list(&chan->vchan, &head);
175 sf_pdma_disclaim_chan(chan);
176 spin_unlock_irqrestore(&chan->vchan.lock, flags);
177 }
178
179 static size_t sf_pdma_desc_residue(struct sf_pdma_chan *chan,
180 dma_cookie_t cookie)
181 {
182 struct virt_dma_desc *vd = NULL;
183 struct sf_pdma_desc *desc;
184 struct pdma_regs *regs = &chan->regs;
185 unsigned long flags;
186 u64 residue;
187
> 188 residue = readq(regs->residue);
189
190 chan->status = residue ? DMA_IN_PROGRESS : DMA_COMPLETE;
191
192 spin_lock_irqsave(&chan->vchan.lock, flags);
193 vd = vchan_find_desc(&chan->vchan, cookie);
194 if (!vd)
195 goto out;
196
197 desc = to_sf_pdma_desc(vd);
198
199 spin_unlock_irqrestore(&chan->vchan.lock, flags);
200
201 if (desc && chan->status == DMA_COMPLETE)
202 vchan_tx_desc_free(desc->async_tx);
203
204 return residue;
205
206 out:
207 spin_unlock_irqrestore(&chan->vchan.lock, flags);
208 return residue;
209 }
210

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip