lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 May 2023 09:40:43 +0000
From:   Clark Wang <xiaoning.wang@....com>
To:     Dhruva Gole <d-gole@...com>,
        "broonie@...nel.org" <broonie@...nel.org>
CC:     "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] spi: lpspi: disable lpspi module irq in DMA mode

Hi Dhruva,

> -----Original Message-----
> From: Dhruva Gole <d-gole@...com>
> Sent: 2023年5月5日 17:16
> To: Clark Wang <xiaoning.wang@....com>; broonie@...nel.org
> Cc: linux-spi@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH] spi: lpspi: disable lpspi module irq in DMA mode
> 
> 
> 
> On 05/05/23 12:05, Clark Wang wrote:
> > When all bits of IER are set to 0, we still can observe the lpspi irq
> > events when using DMA mode to transfer data.
> >
> > So disable irq to avoid the too much irq events.
> >
> > Signed-off-by: Clark Wang <xiaoning.wang@....com>
> > ---
> >   drivers/spi/spi-fsl-lpspi.c | 7 ++++++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> > index f2341ab99556..4b70038ceb6b 100644
> > --- a/drivers/spi/spi-fsl-lpspi.c
> > +++ b/drivers/spi/spi-fsl-lpspi.c
> > @@ -910,9 +910,14 @@ static int fsl_lpspi_probe(struct platform_device
> *pdev)
> >   	ret = fsl_lpspi_dma_init(&pdev->dev, fsl_lpspi, controller);
> >   	if (ret == -EPROBE_DEFER)
> >   		goto out_pm_get;
> > -
> 
> Any reason to delete this line?

Both of the if statements are used to determine the return value of fsl_lpspi_dma_init(), so I remove this line.

> 
> >   	if (ret < 0)
> >   		dev_err(&pdev->dev, "dma setup error %d, use pio\n", ret);
> > +	else
> > +		/*
> > +		 * disable LPSPI module IRQ when enable DMA mode successfully,
> > +		 * to prevent the unexpected LPSPI module IRQ events.
> > +		 */
> > +		disable_irq(irq);
> 
> Just wondering, have you actually seen any unexpected LPSPI module IRQ
> events? If this was causing issues earlier then maybe add a fixes tag?

Yes, I have observed this issue. 
The reason for this problem is that some older platforms are designed to combine LPSPI interrupt and LPSPI DMA channel interrupt into one shared interrupt number because the IRQ interrupt number is not enough.
When the problem occurs, we can observe that if the interrupt comes too many times and too quickly, it will trigger the IRQ in the LPSPI driver while DMA is still processing the previous DMA request(through the shared dma channel interrupt), resulting in data messing.

Best Regards,
Clark Wang
> 
> >
> >   	ret = devm_spi_register_controller(&pdev->dev, controller);
> >   	if (ret < 0) {
> 
> --
> Thanks and Regards,
> Dhruva Gole

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ