Patchwork [V2] dmaengine: axi-dmac: assign `copy_align` property

login
register
mail settings
Submitter Alexandru Ardelean
Date Feb. 26, 2019, 8:52 a.m.
Message ID <20190226085235.28899-1-alexandru.ardelean@analog.com>
Download mbox | patch
Permalink /patch/735801/
State New
Headers show

Comments

Alexandru Ardelean - Feb. 26, 2019, 8:52 a.m.
The `copy_align` property is a generic property that describes alignment
for DMA memcpy & sg ops.
It serves mostly an informational purpose, and can be used in DMA tests, to
pass the info to know what alignment to expect.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---

Changelog v1 -> v2:
* re-applied & moved the `copy_align` assignment; apparently it was
  conflicting with another patch from another series

 drivers/dma/dma-axi-dmac.c | 1 +
 1 file changed, 1 insertion(+)
kbuild test robot - Feb. 26, 2019, 5:43 p.m.
Hi Alexandru,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0-rc8 next-20190226]
[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/Alexandru-Ardelean/dmaengine-axi-dmac-assign-copy_align-property/20190226-215236
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.2.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=8.2.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers//dma/dma-axi-dmac.c: In function 'axi_dmac_probe':
>> drivers//dma/dma-axi-dmac.c:670:36: error: 'struct axi_dmac_chan' has no member named 'address_align_mask'; did you mean 'align_mask'?
     dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
                                       ^~~~~~~~~~~~~~~~~~
                                       align_mask

vim +670 drivers//dma/dma-axi-dmac.c

   606	
   607	static int axi_dmac_probe(struct platform_device *pdev)
   608	{
   609		struct device_node *of_channels, *of_chan;
   610		struct dma_device *dma_dev;
   611		struct axi_dmac *dmac;
   612		struct resource *res;
   613		int ret;
   614	
   615		dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
   616		if (!dmac)
   617			return -ENOMEM;
   618	
   619		dmac->irq = platform_get_irq(pdev, 0);
   620		if (dmac->irq < 0)
   621			return dmac->irq;
   622		if (dmac->irq == 0)
   623			return -EINVAL;
   624	
   625		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   626		dmac->base = devm_ioremap_resource(&pdev->dev, res);
   627		if (IS_ERR(dmac->base))
   628			return PTR_ERR(dmac->base);
   629	
   630		dmac->clk = devm_clk_get(&pdev->dev, NULL);
   631		if (IS_ERR(dmac->clk))
   632			return PTR_ERR(dmac->clk);
   633	
   634		INIT_LIST_HEAD(&dmac->chan.active_descs);
   635	
   636		of_channels = of_get_child_by_name(pdev->dev.of_node, "adi,channels");
   637		if (of_channels == NULL)
   638			return -ENODEV;
   639	
   640		for_each_child_of_node(of_channels, of_chan) {
   641			ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
   642			if (ret) {
   643				of_node_put(of_chan);
   644				of_node_put(of_channels);
   645				return -EINVAL;
   646			}
   647		}
   648		of_node_put(of_channels);
   649	
   650		pdev->dev.dma_parms = &dmac->dma_parms;
   651		dma_set_max_seg_size(&pdev->dev, dmac->chan.max_length);
   652	
   653		dma_dev = &dmac->dma_dev;
   654		dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);
   655		dma_cap_set(DMA_CYCLIC, dma_dev->cap_mask);
   656		dma_dev->device_free_chan_resources = axi_dmac_free_chan_resources;
   657		dma_dev->device_tx_status = dma_cookie_status;
   658		dma_dev->device_issue_pending = axi_dmac_issue_pending;
   659		dma_dev->device_prep_slave_sg = axi_dmac_prep_slave_sg;
   660		dma_dev->device_prep_dma_cyclic = axi_dmac_prep_dma_cyclic;
   661		dma_dev->device_prep_interleaved_dma = axi_dmac_prep_interleaved;
   662		dma_dev->device_terminate_all = axi_dmac_terminate_all;
   663		dma_dev->device_synchronize = axi_dmac_synchronize;
   664		dma_dev->dev = &pdev->dev;
   665		dma_dev->chancnt = 1;
   666		dma_dev->src_addr_widths = BIT(dmac->chan.src_width);
   667		dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
   668		dma_dev->directions = BIT(dmac->chan.direction);
   669		dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
 > 670		dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
   671		INIT_LIST_HEAD(&dma_dev->channels);
   672	
   673		dmac->chan.vchan.desc_free = axi_dmac_desc_free;
   674		vchan_init(&dmac->chan.vchan, dma_dev);
   675	
   676		ret = clk_prepare_enable(dmac->clk);
   677		if (ret < 0)
   678			return ret;
   679	
   680		axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_MASK, 0x00);
   681	
   682		ret = dma_async_device_register(dma_dev);
   683		if (ret)
   684			goto err_clk_disable;
   685	
   686		ret = of_dma_controller_register(pdev->dev.of_node,
   687			of_dma_xlate_by_chan_id, dma_dev);
   688		if (ret)
   689			goto err_unregister_device;
   690	
   691		ret = request_irq(dmac->irq, axi_dmac_interrupt_handler, IRQF_SHARED,
   692			dev_name(&pdev->dev), dmac);
   693		if (ret)
   694			goto err_unregister_of;
   695	
   696		platform_set_drvdata(pdev, dmac);
   697	
   698		return 0;
   699	
   700	err_unregister_of:
   701		of_dma_controller_free(pdev->dev.of_node);
   702	err_unregister_device:
   703		dma_async_device_unregister(&dmac->dma_dev);
   704	err_clk_disable:
   705		clk_disable_unprepare(dmac->clk);
   706	
   707		return ret;
   708	}
   709	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Ardelean, Alexandru - Feb. 27, 2019, 8:12 a.m.
On Tue, 2019-02-26 at 10:52 +0200, Alexandru Ardelean wrote:
> The `copy_align` property is a generic property that describes alignment

> for DMA memcpy & sg ops.

> It serves mostly an informational purpose, and can be used in DMA tests,

> to

> pass the info to know what alignment to expect.

> 


build bot said this doesn't compile.
I think this patch needs to come later after some more updates have been
pushed for this driver.

> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> ---

> 

> Changelog v1 -> v2:

> * re-applied & moved the `copy_align` assignment; apparently it was

>   conflicting with another patch from another series

> 

>  drivers/dma/dma-axi-dmac.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c

> index ffc0adc2f6ce..5ec223ff7e1a 100644

> --- a/drivers/dma/dma-axi-dmac.c

> +++ b/drivers/dma/dma-axi-dmac.c

> @@ -666,6 +666,7 @@ static int axi_dmac_probe(struct platform_device

> *pdev)

>  	dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);

>  	dma_dev->directions = BIT(dmac->chan.direction);

>  	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;

> +	dma_dev->copy_align = (dmac->chan.address_align_mask + 1);

>  	INIT_LIST_HEAD(&dma_dev->channels);

>  

>  	dmac->chan.vchan.desc_free = axi_dmac_desc_free;
Vinod Koul - Feb. 27, 2019, 10:55 a.m.
On 27-02-19, 08:12, Ardelean, Alexandru wrote:
> On Tue, 2019-02-26 at 10:52 +0200, Alexandru Ardelean wrote:
> > The `copy_align` property is a generic property that describes alignment
> > for DMA memcpy & sg ops.
> > It serves mostly an informational purpose, and can be used in DMA tests,
> > to
> > pass the info to know what alignment to expect.
> > 
> 
> build bot said this doesn't compile.
> I think this patch needs to come later after some more updates have been
> pushed for this driver.

Well build bot has no idea about that (like me), so better to put them
in a series and send (that way bot and me know which should come first)

> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> > 
> > Changelog v1 -> v2:
> > * re-applied & moved the `copy_align` assignment; apparently it was
> >   conflicting with another patch from another series
> > 
> >  drivers/dma/dma-axi-dmac.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> > index ffc0adc2f6ce..5ec223ff7e1a 100644
> > --- a/drivers/dma/dma-axi-dmac.c
> > +++ b/drivers/dma/dma-axi-dmac.c
> > @@ -666,6 +666,7 @@ static int axi_dmac_probe(struct platform_device
> > *pdev)
> >  	dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
> >  	dma_dev->directions = BIT(dmac->chan.direction);
> >  	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
> > +	dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
> >  	INIT_LIST_HEAD(&dma_dev->channels);
> >  
> >  	dmac->chan.vchan.desc_free = axi_dmac_desc_free;

Patch

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index ffc0adc2f6ce..5ec223ff7e1a 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -666,6 +666,7 @@  static int axi_dmac_probe(struct platform_device *pdev)
 	dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
 	dma_dev->directions = BIT(dmac->chan.direction);
 	dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
+	dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
 	INIT_LIST_HEAD(&dma_dev->channels);
 
 	dmac->chan.vchan.desc_free = axi_dmac_desc_free;