All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining
@ 2026-09-24  3:39 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-09-24  3:39 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260911-fsl-edma-dyn-sg-v10-2-700eb72def57@bootlin.com>
References: <20260911-fsl-edma-dyn-sg-v10-2-700eb72def57@bootlin.com>
TO: "Benoît Monin" <benoit.monin@bootlin.com>
TO: Frank Li <Frank.Li@nxp.com>
TO: Vinod Koul <vkoul@kernel.org>
CC: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
CC: imx@lists.linux.dev
CC: dmaengine@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: "Benoît Monin" <benoit.monin@bootlin.com>

Hi Benoît,

kernel test robot noticed the following build errors:

[auto build test ERROR on cee9395acd8043be0644b25c34bfa86623f2b935]

url:    https://github.com/intel-lab-lkp/linux/commits/Beno-t-Monin/dmaengine-fsl-edma-Implement-device_prep_peripheral_dma_vec/20260911-151136
base:   cee9395acd8043be0644b25c34bfa86623f2b935
patch link:    https://lore.kernel.org/r/20260911-fsl-edma-dyn-sg-v10-2-700eb72def57%40bootlin.com
patch subject: [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining
:::::: branch date: 13 days ago
:::::: commit date: 13 days ago
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20260924/202609240552.xlFOcW61-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260924/202609240552.xlFOcW61-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/r/202609240552.xlFOcW61-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/dma/fsl-edma-common.c:758:41: error: call to undeclared function 'FIELD_MAX'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     758 |                 if (!nbytes || vecs[i].len / nbytes > FIELD_MAX(EDMA_TCD_ITER_MASK))
         |                                                       ^
   1 error generated.


vim +/FIELD_MAX +758 drivers/dma/fsl-edma-common.c

9d831528a6567d Angelo Dureghello 2018-08-19  675  
526bb30b847c23 Benoît Monin      2026-09-11  676  struct dma_async_tx_descriptor *
526bb30b847c23 Benoît Monin      2026-09-11  677  fsl_edma_prep_peripheral_dma_vec(struct dma_chan *chan, const struct dma_vec *vecs,
526bb30b847c23 Benoît Monin      2026-09-11  678  				 size_t nb, enum dma_transfer_direction direction,
526bb30b847c23 Benoît Monin      2026-09-11  679  				 unsigned long flags)
526bb30b847c23 Benoît Monin      2026-09-11  680  {
526bb30b847c23 Benoît Monin      2026-09-11  681  	struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan);
526bb30b847c23 Benoît Monin      2026-09-11  682  	dma_addr_t src_addr, dst_addr, last_sg;
526bb30b847c23 Benoît Monin      2026-09-11  683  	struct fsl_edma_desc *fsl_desc;
526bb30b847c23 Benoît Monin      2026-09-11  684  	u16 soff, doff, iter;
526bb30b847c23 Benoît Monin      2026-09-11  685  	u32 nbytes;
526bb30b847c23 Benoît Monin      2026-09-11  686  	int i;
526bb30b847c23 Benoît Monin      2026-09-11  687  
526bb30b847c23 Benoît Monin      2026-09-11  688  	if (!is_slave_direction(direction))
526bb30b847c23 Benoît Monin      2026-09-11  689  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  690  
526bb30b847c23 Benoît Monin      2026-09-11  691  	if (!fsl_edma_prep_slave_dma(fsl_chan, direction))
526bb30b847c23 Benoît Monin      2026-09-11  692  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  693  
526bb30b847c23 Benoît Monin      2026-09-11  694  	fsl_desc = fsl_edma_alloc_desc(fsl_chan, nb);
526bb30b847c23 Benoît Monin      2026-09-11  695  	if (!fsl_desc)
526bb30b847c23 Benoît Monin      2026-09-11  696  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  697  	fsl_desc->iscyclic = flags & DMA_PREP_REPEAT;
526bb30b847c23 Benoît Monin      2026-09-11  698  	fsl_desc->dirn = direction;
526bb30b847c23 Benoît Monin      2026-09-11  699  
526bb30b847c23 Benoît Monin      2026-09-11  700  	if (direction == DMA_MEM_TO_DEV) {
526bb30b847c23 Benoît Monin      2026-09-11  701  		if (!fsl_chan->cfg.src_addr_width)
526bb30b847c23 Benoît Monin      2026-09-11  702  			fsl_chan->cfg.src_addr_width = fsl_chan->cfg.dst_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  703  		fsl_chan->attr =
526bb30b847c23 Benoît Monin      2026-09-11  704  			fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width,
526bb30b847c23 Benoît Monin      2026-09-11  705  					      fsl_chan->cfg.dst_addr_width);
526bb30b847c23 Benoît Monin      2026-09-11  706  		nbytes = fsl_chan->cfg.dst_addr_width * fsl_chan->cfg.dst_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  707  	} else {
526bb30b847c23 Benoît Monin      2026-09-11  708  		if (!fsl_chan->cfg.dst_addr_width)
526bb30b847c23 Benoît Monin      2026-09-11  709  			fsl_chan->cfg.dst_addr_width = fsl_chan->cfg.src_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  710  		fsl_chan->attr =
526bb30b847c23 Benoît Monin      2026-09-11  711  			fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width,
526bb30b847c23 Benoît Monin      2026-09-11  712  					      fsl_chan->cfg.dst_addr_width);
526bb30b847c23 Benoît Monin      2026-09-11  713  		nbytes = fsl_chan->cfg.src_addr_width * fsl_chan->cfg.src_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  714  	}
526bb30b847c23 Benoît Monin      2026-09-11  715  
526bb30b847c23 Benoît Monin      2026-09-11  716  	for (i = 0; i < nb; i++) {
526bb30b847c23 Benoît Monin      2026-09-11  717  		if (direction == DMA_MEM_TO_DEV) {
526bb30b847c23 Benoît Monin      2026-09-11  718  			src_addr = vecs[i].addr;
526bb30b847c23 Benoît Monin      2026-09-11  719  			dst_addr = fsl_chan->dma_dev_addr;
526bb30b847c23 Benoît Monin      2026-09-11  720  			soff = fsl_chan->cfg.dst_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  721  			doff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  722  		} else if (direction == DMA_DEV_TO_MEM) {
526bb30b847c23 Benoît Monin      2026-09-11  723  			src_addr = fsl_chan->dma_dev_addr;
526bb30b847c23 Benoît Monin      2026-09-11  724  			dst_addr = vecs[i].addr;
526bb30b847c23 Benoît Monin      2026-09-11  725  			soff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  726  			doff = fsl_chan->cfg.src_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  727  		} else {
526bb30b847c23 Benoît Monin      2026-09-11  728  			/* DMA_DEV_TO_DEV */
526bb30b847c23 Benoît Monin      2026-09-11  729  			src_addr = fsl_chan->cfg.src_addr;
526bb30b847c23 Benoît Monin      2026-09-11  730  			dst_addr = fsl_chan->cfg.dst_addr;
526bb30b847c23 Benoît Monin      2026-09-11  731  			soff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  732  			doff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  733  		}
526bb30b847c23 Benoît Monin      2026-09-11  734  
526bb30b847c23 Benoît Monin      2026-09-11  735  		/*
526bb30b847c23 Benoît Monin      2026-09-11  736  		 * Choose the suitable burst length if dma_vec length is not
526bb30b847c23 Benoît Monin      2026-09-11  737  		 * multiple of burst length so that the whole transfer length is
526bb30b847c23 Benoît Monin      2026-09-11  738  		 * multiple of minor loop(burst length).
526bb30b847c23 Benoît Monin      2026-09-11  739  		 */
526bb30b847c23 Benoît Monin      2026-09-11  740  		if (nbytes && vecs[i].len % nbytes) {
526bb30b847c23 Benoît Monin      2026-09-11  741  			u32 width = (direction == DMA_DEV_TO_MEM) ? doff : soff;
526bb30b847c23 Benoît Monin      2026-09-11  742  			u32 burst = (direction == DMA_DEV_TO_MEM) ?
526bb30b847c23 Benoît Monin      2026-09-11  743  						fsl_chan->cfg.src_maxburst :
526bb30b847c23 Benoît Monin      2026-09-11  744  						fsl_chan->cfg.dst_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  745  			int j;
526bb30b847c23 Benoît Monin      2026-09-11  746  
526bb30b847c23 Benoît Monin      2026-09-11  747  			for (j = burst; j > 1; j--) {
526bb30b847c23 Benoît Monin      2026-09-11  748  				if (!(vecs[i].len % (j * width))) {
526bb30b847c23 Benoît Monin      2026-09-11  749  					nbytes = j * width;
526bb30b847c23 Benoît Monin      2026-09-11  750  					break;
526bb30b847c23 Benoît Monin      2026-09-11  751  				}
526bb30b847c23 Benoît Monin      2026-09-11  752  			}
526bb30b847c23 Benoît Monin      2026-09-11  753  			/* Set burst size as 1 if there's no suitable one */
526bb30b847c23 Benoît Monin      2026-09-11  754  			if (j == 1)
526bb30b847c23 Benoît Monin      2026-09-11  755  				nbytes = width;
526bb30b847c23 Benoît Monin      2026-09-11  756  		}
526bb30b847c23 Benoît Monin      2026-09-11  757  
526bb30b847c23 Benoît Monin      2026-09-11 @758  		if (!nbytes || vecs[i].len / nbytes > FIELD_MAX(EDMA_TCD_ITER_MASK))
526bb30b847c23 Benoît Monin      2026-09-11  759  			goto err_free_desc;
526bb30b847c23 Benoît Monin      2026-09-11  760  
526bb30b847c23 Benoît Monin      2026-09-11  761  		iter = vecs[i].len / nbytes;
526bb30b847c23 Benoît Monin      2026-09-11  762  		if (i < nb - 1) {
526bb30b847c23 Benoît Monin      2026-09-11  763  			last_sg = fsl_desc->tcd[(i + 1)].ptcd;
526bb30b847c23 Benoît Monin      2026-09-11  764  			fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  765  					  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  766  					  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  767  					  false, false, true);
526bb30b847c23 Benoît Monin      2026-09-11  768  		} else {
526bb30b847c23 Benoît Monin      2026-09-11  769  			if (fsl_desc->iscyclic) {
526bb30b847c23 Benoît Monin      2026-09-11  770  				last_sg = fsl_desc->tcd[0].ptcd;
526bb30b847c23 Benoît Monin      2026-09-11  771  				fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  772  						  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  773  						  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  774  						  true, false, true);
526bb30b847c23 Benoît Monin      2026-09-11  775  			} else {
526bb30b847c23 Benoît Monin      2026-09-11  776  				last_sg = 0;
526bb30b847c23 Benoît Monin      2026-09-11  777  				fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  778  						  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  779  						  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  780  						  true, true, false);
526bb30b847c23 Benoît Monin      2026-09-11  781  			}
526bb30b847c23 Benoît Monin      2026-09-11  782  		}
526bb30b847c23 Benoît Monin      2026-09-11  783  	}
526bb30b847c23 Benoît Monin      2026-09-11  784  
526bb30b847c23 Benoît Monin      2026-09-11  785  	return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags);
526bb30b847c23 Benoît Monin      2026-09-11  786  
526bb30b847c23 Benoît Monin      2026-09-11  787  err_free_desc:
526bb30b847c23 Benoît Monin      2026-09-11  788  	fsl_edma_free_desc(&fsl_desc->vdesc);
526bb30b847c23 Benoît Monin      2026-09-11  789  	return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  790  }
526bb30b847c23 Benoît Monin      2026-09-11  791  

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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining
@ 2026-09-23 13:16 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-09-23 13:16 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260911-fsl-edma-dyn-sg-v10-2-700eb72def57@bootlin.com>
References: <20260911-fsl-edma-dyn-sg-v10-2-700eb72def57@bootlin.com>
TO: "Benoît Monin" <benoit.monin@bootlin.com>
TO: Frank Li <Frank.Li@nxp.com>
TO: Vinod Koul <vkoul@kernel.org>
CC: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
CC: imx@lists.linux.dev
CC: dmaengine@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: "Benoît Monin" <benoit.monin@bootlin.com>

Hi Benoît,

kernel test robot noticed the following build errors:

[auto build test ERROR on cee9395acd8043be0644b25c34bfa86623f2b935]

url:    https://github.com/intel-lab-lkp/linux/commits/Beno-t-Monin/dmaengine-fsl-edma-Implement-device_prep_peripheral_dma_vec/20260911-151136
base:   cee9395acd8043be0644b25c34bfa86623f2b935
patch link:    https://lore.kernel.org/r/20260911-fsl-edma-dyn-sg-v10-2-700eb72def57%40bootlin.com
patch subject: [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining
:::::: branch date: 12 days ago
:::::: commit date: 12 days ago
config: sparc-randconfig-r2201-20260923 (https://download.01.org/0day-ci/archive/20260923/202609231550.rY6WcsbN-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260923/202609231550.rY6WcsbN-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/r/202609231550.rY6WcsbN-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/dma/fsl-edma-common.c: In function 'fsl_edma_prep_peripheral_dma_vec':
>> drivers/dma/fsl-edma-common.c:758:55: error: implicit declaration of function 'FIELD_MAX' [-Werror=implicit-function-declaration]
     758 |                 if (!nbytes || vecs[i].len / nbytes > FIELD_MAX(EDMA_TCD_ITER_MASK))
         |                                                       ^~~~~~~~~
   cc1: some warnings being treated as errors


vim +/FIELD_MAX +758 drivers/dma/fsl-edma-common.c

9d831528a6567d Angelo Dureghello 2018-08-19  675  
526bb30b847c23 Benoît Monin      2026-09-11  676  struct dma_async_tx_descriptor *
526bb30b847c23 Benoît Monin      2026-09-11  677  fsl_edma_prep_peripheral_dma_vec(struct dma_chan *chan, const struct dma_vec *vecs,
526bb30b847c23 Benoît Monin      2026-09-11  678  				 size_t nb, enum dma_transfer_direction direction,
526bb30b847c23 Benoît Monin      2026-09-11  679  				 unsigned long flags)
526bb30b847c23 Benoît Monin      2026-09-11  680  {
526bb30b847c23 Benoît Monin      2026-09-11  681  	struct fsl_edma_chan *fsl_chan = to_fsl_edma_chan(chan);
526bb30b847c23 Benoît Monin      2026-09-11  682  	dma_addr_t src_addr, dst_addr, last_sg;
526bb30b847c23 Benoît Monin      2026-09-11  683  	struct fsl_edma_desc *fsl_desc;
526bb30b847c23 Benoît Monin      2026-09-11  684  	u16 soff, doff, iter;
526bb30b847c23 Benoît Monin      2026-09-11  685  	u32 nbytes;
526bb30b847c23 Benoît Monin      2026-09-11  686  	int i;
526bb30b847c23 Benoît Monin      2026-09-11  687  
526bb30b847c23 Benoît Monin      2026-09-11  688  	if (!is_slave_direction(direction))
526bb30b847c23 Benoît Monin      2026-09-11  689  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  690  
526bb30b847c23 Benoît Monin      2026-09-11  691  	if (!fsl_edma_prep_slave_dma(fsl_chan, direction))
526bb30b847c23 Benoît Monin      2026-09-11  692  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  693  
526bb30b847c23 Benoît Monin      2026-09-11  694  	fsl_desc = fsl_edma_alloc_desc(fsl_chan, nb);
526bb30b847c23 Benoît Monin      2026-09-11  695  	if (!fsl_desc)
526bb30b847c23 Benoît Monin      2026-09-11  696  		return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  697  	fsl_desc->iscyclic = flags & DMA_PREP_REPEAT;
526bb30b847c23 Benoît Monin      2026-09-11  698  	fsl_desc->dirn = direction;
526bb30b847c23 Benoît Monin      2026-09-11  699  
526bb30b847c23 Benoît Monin      2026-09-11  700  	if (direction == DMA_MEM_TO_DEV) {
526bb30b847c23 Benoît Monin      2026-09-11  701  		if (!fsl_chan->cfg.src_addr_width)
526bb30b847c23 Benoît Monin      2026-09-11  702  			fsl_chan->cfg.src_addr_width = fsl_chan->cfg.dst_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  703  		fsl_chan->attr =
526bb30b847c23 Benoît Monin      2026-09-11  704  			fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width,
526bb30b847c23 Benoît Monin      2026-09-11  705  					      fsl_chan->cfg.dst_addr_width);
526bb30b847c23 Benoît Monin      2026-09-11  706  		nbytes = fsl_chan->cfg.dst_addr_width * fsl_chan->cfg.dst_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  707  	} else {
526bb30b847c23 Benoît Monin      2026-09-11  708  		if (!fsl_chan->cfg.dst_addr_width)
526bb30b847c23 Benoît Monin      2026-09-11  709  			fsl_chan->cfg.dst_addr_width = fsl_chan->cfg.src_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  710  		fsl_chan->attr =
526bb30b847c23 Benoît Monin      2026-09-11  711  			fsl_edma_get_tcd_attr(fsl_chan->cfg.src_addr_width,
526bb30b847c23 Benoît Monin      2026-09-11  712  					      fsl_chan->cfg.dst_addr_width);
526bb30b847c23 Benoît Monin      2026-09-11  713  		nbytes = fsl_chan->cfg.src_addr_width * fsl_chan->cfg.src_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  714  	}
526bb30b847c23 Benoît Monin      2026-09-11  715  
526bb30b847c23 Benoît Monin      2026-09-11  716  	for (i = 0; i < nb; i++) {
526bb30b847c23 Benoît Monin      2026-09-11  717  		if (direction == DMA_MEM_TO_DEV) {
526bb30b847c23 Benoît Monin      2026-09-11  718  			src_addr = vecs[i].addr;
526bb30b847c23 Benoît Monin      2026-09-11  719  			dst_addr = fsl_chan->dma_dev_addr;
526bb30b847c23 Benoît Monin      2026-09-11  720  			soff = fsl_chan->cfg.dst_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  721  			doff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  722  		} else if (direction == DMA_DEV_TO_MEM) {
526bb30b847c23 Benoît Monin      2026-09-11  723  			src_addr = fsl_chan->dma_dev_addr;
526bb30b847c23 Benoît Monin      2026-09-11  724  			dst_addr = vecs[i].addr;
526bb30b847c23 Benoît Monin      2026-09-11  725  			soff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  726  			doff = fsl_chan->cfg.src_addr_width;
526bb30b847c23 Benoît Monin      2026-09-11  727  		} else {
526bb30b847c23 Benoît Monin      2026-09-11  728  			/* DMA_DEV_TO_DEV */
526bb30b847c23 Benoît Monin      2026-09-11  729  			src_addr = fsl_chan->cfg.src_addr;
526bb30b847c23 Benoît Monin      2026-09-11  730  			dst_addr = fsl_chan->cfg.dst_addr;
526bb30b847c23 Benoît Monin      2026-09-11  731  			soff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  732  			doff = 0;
526bb30b847c23 Benoît Monin      2026-09-11  733  		}
526bb30b847c23 Benoît Monin      2026-09-11  734  
526bb30b847c23 Benoît Monin      2026-09-11  735  		/*
526bb30b847c23 Benoît Monin      2026-09-11  736  		 * Choose the suitable burst length if dma_vec length is not
526bb30b847c23 Benoît Monin      2026-09-11  737  		 * multiple of burst length so that the whole transfer length is
526bb30b847c23 Benoît Monin      2026-09-11  738  		 * multiple of minor loop(burst length).
526bb30b847c23 Benoît Monin      2026-09-11  739  		 */
526bb30b847c23 Benoît Monin      2026-09-11  740  		if (nbytes && vecs[i].len % nbytes) {
526bb30b847c23 Benoît Monin      2026-09-11  741  			u32 width = (direction == DMA_DEV_TO_MEM) ? doff : soff;
526bb30b847c23 Benoît Monin      2026-09-11  742  			u32 burst = (direction == DMA_DEV_TO_MEM) ?
526bb30b847c23 Benoît Monin      2026-09-11  743  						fsl_chan->cfg.src_maxburst :
526bb30b847c23 Benoît Monin      2026-09-11  744  						fsl_chan->cfg.dst_maxburst;
526bb30b847c23 Benoît Monin      2026-09-11  745  			int j;
526bb30b847c23 Benoît Monin      2026-09-11  746  
526bb30b847c23 Benoît Monin      2026-09-11  747  			for (j = burst; j > 1; j--) {
526bb30b847c23 Benoît Monin      2026-09-11  748  				if (!(vecs[i].len % (j * width))) {
526bb30b847c23 Benoît Monin      2026-09-11  749  					nbytes = j * width;
526bb30b847c23 Benoît Monin      2026-09-11  750  					break;
526bb30b847c23 Benoît Monin      2026-09-11  751  				}
526bb30b847c23 Benoît Monin      2026-09-11  752  			}
526bb30b847c23 Benoît Monin      2026-09-11  753  			/* Set burst size as 1 if there's no suitable one */
526bb30b847c23 Benoît Monin      2026-09-11  754  			if (j == 1)
526bb30b847c23 Benoît Monin      2026-09-11  755  				nbytes = width;
526bb30b847c23 Benoît Monin      2026-09-11  756  		}
526bb30b847c23 Benoît Monin      2026-09-11  757  
526bb30b847c23 Benoît Monin      2026-09-11 @758  		if (!nbytes || vecs[i].len / nbytes > FIELD_MAX(EDMA_TCD_ITER_MASK))
526bb30b847c23 Benoît Monin      2026-09-11  759  			goto err_free_desc;
526bb30b847c23 Benoît Monin      2026-09-11  760  
526bb30b847c23 Benoît Monin      2026-09-11  761  		iter = vecs[i].len / nbytes;
526bb30b847c23 Benoît Monin      2026-09-11  762  		if (i < nb - 1) {
526bb30b847c23 Benoît Monin      2026-09-11  763  			last_sg = fsl_desc->tcd[(i + 1)].ptcd;
526bb30b847c23 Benoît Monin      2026-09-11  764  			fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  765  					  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  766  					  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  767  					  false, false, true);
526bb30b847c23 Benoît Monin      2026-09-11  768  		} else {
526bb30b847c23 Benoît Monin      2026-09-11  769  			if (fsl_desc->iscyclic) {
526bb30b847c23 Benoît Monin      2026-09-11  770  				last_sg = fsl_desc->tcd[0].ptcd;
526bb30b847c23 Benoît Monin      2026-09-11  771  				fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  772  						  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  773  						  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  774  						  true, false, true);
526bb30b847c23 Benoît Monin      2026-09-11  775  			} else {
526bb30b847c23 Benoît Monin      2026-09-11  776  				last_sg = 0;
526bb30b847c23 Benoît Monin      2026-09-11  777  				fsl_edma_fill_tcd(fsl_chan, fsl_desc->tcd[i].vtcd, src_addr,
526bb30b847c23 Benoît Monin      2026-09-11  778  						  dst_addr, fsl_chan->attr, soff,
526bb30b847c23 Benoît Monin      2026-09-11  779  						  nbytes, 0, iter, iter, doff, last_sg,
526bb30b847c23 Benoît Monin      2026-09-11  780  						  true, true, false);
526bb30b847c23 Benoît Monin      2026-09-11  781  			}
526bb30b847c23 Benoît Monin      2026-09-11  782  		}
526bb30b847c23 Benoît Monin      2026-09-11  783  	}
526bb30b847c23 Benoît Monin      2026-09-11  784  
526bb30b847c23 Benoît Monin      2026-09-11  785  	return vchan_tx_prep(&fsl_chan->vchan, &fsl_desc->vdesc, flags);
526bb30b847c23 Benoît Monin      2026-09-11  786  
526bb30b847c23 Benoît Monin      2026-09-11  787  err_free_desc:
526bb30b847c23 Benoît Monin      2026-09-11  788  	fsl_edma_free_desc(&fsl_desc->vdesc);
526bb30b847c23 Benoît Monin      2026-09-11  789  	return NULL;
526bb30b847c23 Benoît Monin      2026-09-11  790  }
526bb30b847c23 Benoît Monin      2026-09-11  791  

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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v10 0/2] dmaengine: fsl-edma: Scatter/gather improvements
@ 2026-09-11 13:11 Benoît Monin
  2026-09-11 13:11 ` [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining Benoît Monin
  0 siblings, 1 reply; 5+ messages in thread
From: Benoît Monin @ 2026-09-11 13:11 UTC (permalink / raw)
  To: Frank Li, Vinod Koul
  Cc: Thomas Petazzoni, Frank Li, imx, dmaengine, linux-kernel,
	Benoît Monin

This series adds support for scatter/gather DMA transfers via dma_vec
and dynamic descriptor chaining to the Freescale eDMA controller driver.

The first patch implements the .device_prep_peripheral_dma_vec() callback,
enabling the DMA engine to accept an array of dma_vec structures. This
callback supports both regular and cyclic transfer modes.

The second patch introduces dynamic scatter/gather chaining, which allows
multiple DMA descriptors to be linked together without stopping the channel.
This optimization eliminates idle periods when back-to-back transfers are
submitted, improving throughput and reducing latency. The implementation
carefully preserves cyclic transfer semantics and respects hardware
constraints on platforms with split register layouts.

I tested it on the i.MX93. The dynamic scatter/gather chaining should
work with other eDMA controller with split register layout.

Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
---
Changes in v10:
- Don't move backslash in fsl-edma-common.h to minimize diff, no
  functional changes.
- Link to v9: https://patch.msgid.link/20260909-fsl-edma-dyn-sg-v9-0-60bb2e678e8f@bootlin.com

Changes in v9:
- Rebased and retested on v7.3-rc1.
- Drop the check on CSR E_LINK flag as it is never set in the driver.
- Add FSL_EDMA_DRV_CSR_LINKCH flag for eDMA3 and eDMA4 to indicate which
  controllers can link SG descriptors.
- Count and limit the number of linked SG descriptors once per
  issue_pending() call, instead of O(n^2).
- Link to v8:
https://patch.msgid.link/20260803-fsl-edma-dyn-sg-v8-0-dc2b0317206d@bootlin.com

Changes in v8:
- Enforce that major channel linking in not used when linking a descriptor
  in fsl_edma_link_sg() by checking all TCD, not just the first one.
- Don't compare the descriptor link_sg_id with the CSR LINKCH field
  if major channel linking is enabled, to avoid completing unfinished
  descriptors in fsl_edma_tx_chan_handler().
- Handle the completion of the last transaction of a linked SG chain if
  the previous interrupt was missed by checking for the channel completion.
- Add comments to clarify the assumptions I made.
- Link to v7: https://patch.msgid.link/20260728-fsl-edma-dyn-sg-v7-0-10dffb4167c2@bootlin.com

Changes in v7:
- In fsl_edma_prep_peripheral_dma_vec(), make sure that CITER/BITER
  values fit in their registers.
- Add the identifier to all TCD of a linked transaction so that we can
  always identify it when handling the end-of-transfer interrupt.
- Handle missed/coalesced end-of-transfer interrupt even when the transfer
  is completed.
- Link to v6: https://patch.msgid.link/20260710-fsl-edma-dyn-sg-v6-0-831b96be3f31@bootlin.com

Changes in v6:
- Link DMA transactions in fsl_edma_issue_pending() when they are issued,
  not when submitted.
- Add an identifier to linked transactions to handle missed/coalesced
  end-of-transfer interrupt.
- Link to v5: https://patch.msgid.link/20260702-fsl-edma-dyn-sg-v5-0-16787185be49@bootlin.com

Changes in v5:
- Rebased on v7.2-rc1.
- Add a call to dma_wmb() to ensure that dlast_sga is updated
  before csr when linking scatter/gather transactions.
- Don't update TCD registers if updating csr requires clearing the
  channel DONE bit to avoid a status mismatch in fsl_edma_tx_chan_handler().
- Link to v4: https://patch.msgid.link/20260518-fsl-edma-dyn-sg-v4-0-8ce7d95b1ce9@bootlin.com

Changes in v4:
- To keep transactions in order, link DMA transaction to the end of
  submitted list first, only lookup the issued list is the submitted
  list is empty.
- Link to v3: https://patch.msgid.link/20260511-fsl-edma-dyn-sg-v3-0-98a181775dae@bootlin.com

Changes in v3:
- Fix formatting errors reported by Frank Li.
- Add fsl_edma_tx_submit() to link the DMA transactions
  when they are submitted, not when they are prepared.
- Link to v2: https://patch.msgid.link/20260506-fsl-edma-dyn-sg-v2-0-66439cdd414e@bootlin.com

Changes in v2:
- Drop the RFC prefix, as asked by Frank Li
- No code change
- Link to v1: https://patch.msgid.link/20260430-fsl-edma-dyn-sg-v1-0-4e0ecbe2df66@bootlin.com

To: Frank Li <Frank.Li@nxp.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Frank Li <Frank.Li@kernel.org>
Cc: imx@lists.linux.dev
Cc: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

---
Benoît Monin (2):
      dmaengine: fsl-edma: Implement device_prep_peripheral_dma_vec
      dmaengine: fsl-edma: Support dynamic scatter/gather chaining

 drivers/dma/fsl-edma-common.c | 254 +++++++++++++++++++++++++++++++++++++++++-
 drivers/dma/fsl-edma-common.h |  15 ++-
 drivers/dma/fsl-edma-main.c   |   2 +
 drivers/dma/fsl-edma-trace.h  |   5 +
 4 files changed, 268 insertions(+), 8 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260428-fsl-edma-dyn-sg-960731e37da2

Best regards,
--  
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-24  3:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24  3:39 [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-09-23 13:16 kernel test robot
2026-09-11 13:11 [PATCH v10 0/2] dmaengine: fsl-edma: Scatter/gather improvements Benoît Monin
2026-09-11 13:11 ` [PATCH v10 2/2] dmaengine: fsl-edma: Support dynamic scatter/gather chaining Benoît Monin
2026-09-11 13:23   ` sashiko-bot
2026-09-11 14:14   ` Frank Li

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.