dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
Subsystems (2)
PATCH 1/1 dmaengine: fsl-edma: fix wrong tcd endianness for big-endian cpu
Due to recent fixes in m68k arch-specific I/O accessor macros, this driver is not working anymore for ColdFire. Fix wrong tcd endianness removing additional swaps, since edma_xxx() functions should already take care of any eventual swap when needed.
Note, i could only test the change in ColdFire mcf54415 and Vybrid vf50 / Colibri where i don't see any issue. So, every feedback and test for all other SoCs involved is really appreciated.
--- drivers/dma/fsl-edma-common.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/dma/fsl-edma-common.c +12 -13
@@ -353,25 +353,24 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan,* TCD parameters are stored in struct fsl_edma_hw_tcd in little * endian format. However, we need to load the TCD registers in * big- or little-endian obeying the eDMA engine model endian. +* The swap, when needed, is performed from edma_xxx() functions. */ edma_writew (edma,0 , ®s->tcd[ch].csr); -edma_writel (edma,le32_to_cpu (tcd->saddr), ®s->tcd[ch].saddr); -edma_writel (edma,le32_to_cpu (tcd->daddr), ®s->tcd[ch].daddr); +edma_writel (edma, tcd->saddr, ®s->tcd[ch].saddr); +edma_writel (edma, tcd->daddr, ®s->tcd[ch].daddr); -edma_writew (edma,le16_to_cpu (tcd->attr), ®s->tcd[ch].attr); -edma_writew (edma,le16_to_cpu (tcd->soff), ®s->tcd[ch].soff); +edma_writew (edma, tcd->attr, ®s->tcd[ch].attr); +edma_writew (edma, tcd->soff, ®s->tcd[ch].soff); -edma_writel (edma,le32_to_cpu (tcd->nbytes), ®s->tcd[ch].nbytes); -edma_writel (edma,le32_to_cpu (tcd->slast), ®s->tcd[ch].slast); +edma_writel (edma, tcd->nbytes, ®s->tcd[ch].nbytes); +edma_writel (edma, tcd->slast, ®s->tcd[ch].slast); -edma_writew (edma,le16_to_cpu (tcd->citer), ®s->tcd[ch].citer); -edma_writew (edma,le16_to_cpu (tcd->biter), ®s->tcd[ch].biter); -edma_writew (edma,le16_to_cpu (tcd->doff), ®s->tcd[ch].doff); +edma_writew (edma, tcd->citer, ®s->tcd[ch].citer); +edma_writew (edma, tcd->biter, ®s->tcd[ch].biter); +edma_writew (edma, tcd->doff, ®s->tcd[ch].doff); +edma_writel (edma, tcd->dlast_sga, ®s->tcd[ch].dlast_sga); -edma_writel (edma,le32_to_cpu (tcd->dlast_sga), - ®s->tcd[ch].dlast_sga); - -edma_writew (edma,le16_to_cpu (tcd->csr), ®s->tcd[ch].csr); +edma_writew (edma, tcd->csr, ®s->tcd[ch].csr); } static inline
Signature · 1 line
2.26.2
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Angelo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on slave-dma/next]
[also build test WARNING on linus/master v5.7 next-20200529]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Angelo-Dureghello/dmaengine-fsl-edma-fix-wrong-tcd-endianness-for-big-endian-cpu/20200601-004030 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next config: i386-randconfig-s002-20200601 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.1-243-gc100a7ab-dirty # save the attached .config to linux build tree make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
sparse warnings: (new ones prefixed by >>)
>> drivers/dma/fsl-edma-common.c:359:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] saddr @@ >> drivers/dma/fsl-edma-common.c:359:30: sparse: expected unsigned int [usertype] val >> drivers/dma/fsl-edma-common.c:359:30: sparse: got restricted __le32 [usertype] saddr >> drivers/dma/fsl-edma-common.c:360:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] daddr @@ drivers/dma/fsl-edma-common.c:360:30: sparse: expected unsigned int [usertype] val >> drivers/dma/fsl-edma-common.c:360:30: sparse: got restricted __le32 [usertype] daddr >> drivers/dma/fsl-edma-common.c:362:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] attr @@ >> drivers/dma/fsl-edma-common.c:362:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:362:30: sparse: got restricted __le16 [usertype] attr >> drivers/dma/fsl-edma-common.c:363:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] soff @@ drivers/dma/fsl-edma-common.c:363:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:363:30: sparse: got restricted __le16 [usertype] soff >> drivers/dma/fsl-edma-common.c:365:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] nbytes @@ drivers/dma/fsl-edma-common.c:365:30: sparse: expected unsigned int [usertype] val >> drivers/dma/fsl-edma-common.c:365:30: sparse: got restricted __le32 [usertype] nbytes >> drivers/dma/fsl-edma-common.c:366:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] slast @@ drivers/dma/fsl-edma-common.c:366:30: sparse: expected unsigned int [usertype] val >> drivers/dma/fsl-edma-common.c:366:30: sparse: got restricted __le32 [usertype] slast >> drivers/dma/fsl-edma-common.c:368:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] citer @@ drivers/dma/fsl-edma-common.c:368:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:368:30: sparse: got restricted __le16 [usertype] citer >> drivers/dma/fsl-edma-common.c:369:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] biter @@ drivers/dma/fsl-edma-common.c:369:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:369:30: sparse: got restricted __le16 [usertype] biter >> drivers/dma/fsl-edma-common.c:370:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] doff @@ drivers/dma/fsl-edma-common.c:370:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:370:30: sparse: got restricted __le16 [usertype] doff >> drivers/dma/fsl-edma-common.c:371:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] dlast_sga @@ drivers/dma/fsl-edma-common.c:371:30: sparse: expected unsigned int [usertype] val >> drivers/dma/fsl-edma-common.c:371:30: sparse: got restricted __le32 [usertype] dlast_sga >> drivers/dma/fsl-edma-common.c:373:30: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] csr @@ drivers/dma/fsl-edma-common.c:373:30: sparse: expected unsigned short [usertype] val >> drivers/dma/fsl-edma-common.c:373:30: sparse: got restricted __le16 [usertype] csr
vim +359 drivers/dma/fsl-edma-common.c
344
345 static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan,
346 struct fsl_edma_hw_tcd *tcd)
347 {
348 struct fsl_edma_engine *edma = fsl_chan->edma;
349 struct edma_regs *regs = &fsl_chan->edma->regs;
350 u32 ch = fsl_chan->vchan.chan.chan_id;
351
352 /*
353 * TCD parameters are stored in struct fsl_edma_hw_tcd in little
354 * endian format. However, we need to load the TCD registers in
355 * big- or little-endian obeying the eDMA engine model endian.
356 * The swap, when needed, is performed from edma_xxx() functions.
357 */
358 edma_writew(edma, 0, ®s->tcd[ch].csr);
> 359 edma_writel(edma, tcd->saddr, ®s->tcd[ch].saddr); > 360 edma_writel(edma, tcd->daddr, ®s->tcd[ch].daddr); 361 > 362 edma_writew(edma, tcd->attr, ®s->tcd[ch].attr); > 363 edma_writew(edma, tcd->soff, ®s->tcd[ch].soff); 364 > 365 edma_writel(edma, tcd->nbytes, ®s->tcd[ch].nbytes); > 366 edma_writel(edma, tcd->slast, ®s->tcd[ch].slast); 367 > 368 edma_writew(edma, tcd->citer, ®s->tcd[ch].citer); > 369 edma_writew(edma, tcd->biter, ®s->tcd[ch].biter); > 370 edma_writew(edma, tcd->doff, ®s->tcd[ch].doff); > 371 edma_writel(edma, tcd->dlast_sga, ®s->tcd[ch].dlast_sga); 372 > 373 edma_writew(edma, tcd->csr, ®s->tcd[ch].csr);
374 }
375
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org