All of lore.kernel.org
 help / color / mirror / Atom feed
* [freescale-fslc:6.6-1.0.x-imx 5011/11728] drivers/dma/fsl-edma-v3.c:531:46: warning: left shift count >= width of type
@ 2024-04-28 15:04 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-04-28 15:04 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: oe-kbuild-all

tree:   https://github.com/Freescale/linux-fslc 6.6-1.0.x-imx
head:   37770f55ac9c4f6cd958eb5544939207eed8478f
commit: 9e34c0115e392f9021e734a958aaf846779eec8a [5011/11728] LF-10579-02: dmaengine: fsl-edma-v3: add imx95 edma support
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240428/202404282255.Fzh9nHKq-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240428/202404282255.Fzh9nHKq-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404282255.Fzh9nHKq-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/dma/fsl-edma-v3.c: In function 'fsl_edma3_desc_residue':
>> drivers/dma/fsl-edma-v3.c:531:46: warning: left shift count >= width of type [-Wshift-count-overflow]
     531 |                         cur_addr = (cur_addr << 32) | cur_addr_l;
         |                                              ^~
   drivers/dma/fsl-edma-v3.c:538:46: warning: left shift count >= width of type [-Wshift-count-overflow]
     538 |                         cur_addr = (cur_addr << 32) | cur_addr_l;
         |                                              ^~
   drivers/dma/fsl-edma-v3.c:555:54: warning: left shift count >= width of type [-Wshift-count-overflow]
     555 |                                 dma_addr = (dma_addr << 32) | dma_addr_l;
         |                                                      ^~
   drivers/dma/fsl-edma-v3.c:560:54: warning: left shift count >= width of type [-Wshift-count-overflow]
     560 |                                 dma_addr = (dma_addr << 32) | dma_addr_l;
         |                                                      ^~
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:14,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/m68k/include/uapi/asm/byteorder.h:5,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/m68k/include/asm/bitops.h:545,
                    from include/linux/bitops.h:68,
                    from include/linux/thread_info.h:27,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/m68k/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:79,
                    from arch/m68k/include/asm/irqflags.h:6,
                    from include/linux/irqflags.h:17,
                    from arch/m68k/include/asm/atomic.h:6,
                    from include/linux/atomic.h:7,
                    from include/linux/mm_types_task.h:13,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from drivers/dma/fsl-edma-v3.c:18:
   drivers/dma/fsl-edma-v3.c: In function 'fsl_edma3_fill_tcd':
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:118:38: note: in definition of macro '__swab32'
     118 |         (__u32)(__builtin_constant_p(x) ?       \
         |                                      ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:19:19: note: in definition of macro '___constant_swab32'
      19 |         (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:20:19: note: in definition of macro '___constant_swab32'
      20 |         (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:21:19: note: in definition of macro '___constant_swab32'
      21 |         (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:22:19: note: in definition of macro '___constant_swab32'
      22 |         (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
>> drivers/dma/fsl-edma-v3.c:734:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:120:19: note: in definition of macro '__swab32'
     120 |         __fswab32(x))
         |                   ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:734:32: note: in expansion of macro 'cpu_to_le32'
     734 |                 tcd->saddr_h = cpu_to_le32((src >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:118:38: note: in definition of macro '__swab32'
     118 |         (__u32)(__builtin_constant_p(x) ?       \
         |                                      ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:19:19: note: in definition of macro '___constant_swab32'
      19 |         (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:20:19: note: in definition of macro '___constant_swab32'
      20 |         (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:21:19: note: in definition of macro '___constant_swab32'
      21 |         (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:22:19: note: in definition of macro '___constant_swab32'
      22 |         (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
         |                   ^
   include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab32'
      34 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
         |                                           ^~~~~~~~
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:49: warning: right shift count >= width of type [-Wshift-count-overflow]
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                                 ^~
   include/uapi/linux/swab.h:120:19: note: in definition of macro '__swab32'
     120 |         __fswab32(x))
         |                   ^
   include/linux/byteorder/generic.h:88:21: note: in expansion of macro '__cpu_to_le32'
      88 | #define cpu_to_le32 __cpu_to_le32
         |                     ^~~~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:736:32: note: in expansion of macro 'cpu_to_le32'
     736 |                 tcd->daddr_h = cpu_to_le32((dst >> 32) & 0xffffffff);
         |                                ^~~~~~~~~~~
   drivers/dma/fsl-edma-v3.c:757:51: warning: right shift count >= width of type [-Wshift-count-overflow]
     757 |                 tcd->slast_h = cpu_to_le32((slast >> 32) & 0xffffffff);
         |                                                   ^~
   include/uapi/linux/swab.h:118:38: note: in definition of macro '__swab32'
     118 |         (__u32)(__builtin_constant_p(x) ?       \


vim +531 drivers/dma/fsl-edma-v3.c

   494	
   495	static size_t fsl_edma3_desc_residue(struct fsl_edma3_chan *fsl_chan,
   496			struct virt_dma_desc *vdesc, bool in_progress)
   497	{
   498		struct fsl_edma3_desc *edesc = fsl_chan->edesc;
   499		void __iomem *addr = fsl_chan->membase;
   500		enum dma_transfer_direction dir = fsl_chan->fsc.dir;
   501		dma_addr_t cur_addr, dma_addr;
   502		size_t len, size;
   503		u32 nbytes = 0;
   504		int i;
   505	
   506		if (fsl_chan->edma3->drvdata->edma_v5) {
   507			struct fsl_edma3_hw_tcd_v5         *vtcd;
   508			u32 cur_addr_l, cur_addr_h;
   509			u32 dma_addr_l, dma_addr_h;
   510	
   511			/* calculate the total size in this desc */
   512			for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) {
   513				vtcd = edesc->tcd[i].vtcd;
   514				if ((vtcd->nbytes & EDMA_TCD_NBYTES_DMLOE) ||
   515				    (vtcd->nbytes & EDMA_TCD_NBYTES_SMLOE))
   516					nbytes = EDMA_TCD_NBYTES_MLOFF_NBYTES(vtcd->nbytes);
   517				else
   518					nbytes = le32_to_cpu(vtcd->nbytes);
   519				len += nbytes * le16_to_cpu(vtcd->biter);
   520			}
   521	
   522			if (!in_progress)
   523				return len;
   524	
   525			if (dir == DMA_MEM_TO_DEV) {
   526				do {
   527					cur_addr_h = readl(addr + EDMA_V5_TCD_SADDR_H);
   528					cur_addr_l = readl(addr + EDMA_V5_TCD_SADDR_L);
   529				} while (cur_addr_h != readl(addr + EDMA_V5_TCD_SADDR_H));
   530				cur_addr = cur_addr_h;
 > 531				cur_addr = (cur_addr << 32) | cur_addr_l;
   532			} else {
   533				do {
   534					cur_addr_h = readl(addr + EDMA_V5_TCD_DADDR_H);
   535					cur_addr_l = readl(addr + EDMA_V5_TCD_DADDR_L);
   536				} while (cur_addr_h != readl(addr + EDMA_V5_TCD_DADDR_H));
   537				cur_addr = cur_addr_h;
   538				cur_addr = (cur_addr << 32) | cur_addr_l;
   539			}
   540			/* figure out the finished and calculate the residue */
   541			for (i = 0; i < fsl_chan->edesc->n_tcds; i++) {
   542				vtcd = edesc->tcd[i].vtcd;
   543				if ((vtcd->nbytes & EDMA_TCD_NBYTES_DMLOE) ||
   544				    (vtcd->nbytes & EDMA_TCD_NBYTES_SMLOE))
   545					nbytes = EDMA_TCD_NBYTES_MLOFF_NBYTES(vtcd->nbytes);
   546				else
   547					nbytes = le32_to_cpu(vtcd->nbytes);
   548	
   549				size = nbytes * le16_to_cpu(vtcd->biter);
   550	
   551				if (dir == DMA_MEM_TO_DEV) {
   552					dma_addr_l = le32_to_cpu(vtcd->saddr_l);
   553					dma_addr_h = le32_to_cpu(vtcd->saddr_h);
   554					dma_addr = dma_addr_h;
   555					dma_addr = (dma_addr << 32) | dma_addr_l;
   556				} else {
   557					dma_addr_l = le32_to_cpu(vtcd->daddr_l);
   558					dma_addr_h = le32_to_cpu(vtcd->daddr_h);
   559					dma_addr = dma_addr_h;
   560					dma_addr = (dma_addr << 32) | dma_addr_l;
   561				}
   562				len -= size;
   563				if (cur_addr >= dma_addr && cur_addr < dma_addr + size) {
   564					len += dma_addr + size - cur_addr;
   565					break;
   566				}
   567			}
   568		} else {
   569	
   570			struct fsl_edma3_hw_tcd         *vtcd;
   571			/* calculate the total size in this desc */
   572			for (len = i = 0; i < fsl_chan->edesc->n_tcds; i++) {
   573				vtcd = edesc->tcd[i].vtcd;
   574				if ((vtcd->nbytes & EDMA_TCD_NBYTES_DMLOE) ||
   575				    (vtcd->nbytes & EDMA_TCD_NBYTES_SMLOE))
   576					nbytes = EDMA_TCD_NBYTES_MLOFF_NBYTES(vtcd->nbytes);
   577				else
   578					nbytes = le32_to_cpu(vtcd->nbytes);
   579				len += nbytes * le16_to_cpu(vtcd->biter);
   580			}
   581	
   582			if (!in_progress)
   583				return len;
   584	
   585			if (dir == DMA_MEM_TO_DEV)
   586				cur_addr = readl(addr + EDMA_TCD_SADDR);
   587			else
   588				cur_addr = readl(addr + EDMA_TCD_DADDR);
   589	
   590			/* figure out the finished and calculate the residue */
   591			for (i = 0; i < fsl_chan->edesc->n_tcds; i++) {
   592				vtcd = edesc->tcd[i].vtcd;
   593				if ((vtcd->nbytes & EDMA_TCD_NBYTES_DMLOE) ||
   594				    (vtcd->nbytes & EDMA_TCD_NBYTES_SMLOE))
   595					nbytes = EDMA_TCD_NBYTES_MLOFF_NBYTES(vtcd->nbytes);
   596				else
   597					nbytes = le32_to_cpu(vtcd->nbytes);
   598	
   599				size = nbytes * le16_to_cpu(vtcd->biter);
   600	
   601				if (dir == DMA_MEM_TO_DEV)
   602					dma_addr = le32_to_cpu(vtcd->saddr);
   603				else
   604					dma_addr = le32_to_cpu(vtcd->daddr);
   605	
   606				len -= size;
   607				if (cur_addr >= dma_addr && cur_addr < dma_addr + size) {
   608					len += dma_addr + size - cur_addr;
   609					break;
   610				}
   611			}
   612		}
   613	
   614		return len;
   615	}
   616	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-28 15:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-28 15:04 [freescale-fslc:6.6-1.0.x-imx 5011/11728] drivers/dma/fsl-edma-v3.c:531:46: warning: left shift count >= width of type kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.