RE: [PATCH 1/3] dmaengine: sh: rz-dmac: Reinitialize lmdescriptor head

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vinod,

Thanks for the feedback.

> -----Original Message-----
> From: Vinod Koul <vkoul@xxxxxxxxxx>
> Sent: Friday, March 31, 2023 1:15 PM
> To: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>; Geert
> Uytterhoeven <geert+renesas@xxxxxxxxx>; dmaengine@xxxxxxxxxxxxxxx; linux-
> renesas-soc@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH 1/3] dmaengine: sh: rz-dmac: Reinitialize lmdescriptor
> head
> 
> On 24-03-23, 09:49, Biju Das wrote:
> > Reinitialize link mode descriptor head during terminate_all().
> > It fixes the incorrect serial messages during serial transfer when DMA
> > is enabled.
> >
> > Based on a patch in the BSP by Long Luu <long.luu.ur@xxxxxxxxxxx>
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > ---
> >  drivers/dma/sh/rz-dmac.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index
> > 6b62e01ba658..a04a37ce03fd 100644
> > --- a/drivers/dma/sh/rz-dmac.c
> > +++ b/drivers/dma/sh/rz-dmac.c
> > @@ -534,11 +534,18 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan,
> > struct scatterlist *sgl,  static int rz_dmac_terminate_all(struct
> > dma_chan *chan)  {
> >  	struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> > +	struct rz_lmdesc *lmdesc = channel->lmdesc.base;
> >  	unsigned long flags;
> > +	unsigned int i;
> > +
> >  	LIST_HEAD(head);
> >
> >  	rz_dmac_disable_hw(channel);
> >  	spin_lock_irqsave(&channel->vc.lock, flags);
> > +
> > +	for (i = 0; i < DMAC_NR_LMDESC; i++)
> > +		lmdesc[i].header = 0;
> 
> Any reason not to use memset for this?

1) If I use memset, then it need to set 64 * 8 * 4 = 2048 bytes compared to 
64 * 4 =256 bytes here and consistently we use the above logic in the driver.
https://elixir.bootlin.com/linux/v6.0-rc4/source/drivers/dma/sh/rz-dmac.c#L239

2) Another reason is if we do memset, eventhough there will not be any new irq,
irqthread may be still running which can cause DMA bus Error due to nxla
being null with memset. Currently nxla being assigned during probe.

https://elixir.bootlin.com/linux/v6.0-rc4/source/drivers/dma/sh/rz-dmac.c#L214

Cheers,
Biju


> 
> > +
> >  	list_splice_tail_init(&channel->ld_active, &channel->ld_free);
> >  	list_splice_tail_init(&channel->ld_queue, &channel->ld_free);
> >  	spin_unlock_irqrestore(&channel->vc.lock, flags);
> > --
> > 2.25.1
> 
> --
> ~Vinod




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux