DMA Engine development
 help / color / mirror / Atom feed
* [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off
@ 2024-03-20 16:32 Andy Shevchenko
  2024-03-20 16:36 ` Andy Shevchenko
  2024-03-21 11:49 ` Heiner Kallweit
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-03-20 16:32 UTC (permalink / raw)
  To: Uwe Kleine-König, dmaengine, linux-kernel
  Cc: Vinod Koul, Andy Shevchenko, Heiner Kallweit

When iDMA 64-bit device is powered off, the IRQ status register
is all 1:s. This is never happen in real case and signalling that
the device is simply powered off. Don't try to serve interrupts
that are not ours.

Fixes: 667dfed98615 ("dmaengine: add a driver for Intel integrated DMA 64-bit")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Closes: https://lore.kernel.org/r/700bbb84-90e1-4505-8ff0-3f17ea8bc631@gmail.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/idma64.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 78a938969d7d..1b60e73d9322 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -173,6 +173,10 @@ static irqreturn_t idma64_irq(int irq, void *dev)
 
 	dev_vdbg(idma64->dma.dev, "%s: status=%#x\n", __func__, status);
 
+	/* Since IRQ may be shared, check if DMA controller is powered on */
+	if (status == GENMASK(31, 0))
+		return IRQ_NONE;
+
 	/* Check if we have any interrupt from the DMA controller */
 	if (!status)
 		return IRQ_NONE;
-- 
2.43.0.rc1.1.gbec44491f096


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

* Re: [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off
  2024-03-20 16:32 [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off Andy Shevchenko
@ 2024-03-20 16:36 ` Andy Shevchenko
  2024-03-21 11:49 ` Heiner Kallweit
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-03-20 16:36 UTC (permalink / raw)
  To: Uwe Kleine-König, dmaengine, linux-kernel
  Cc: Vinod Koul, Heiner Kallweit

On Wed, Mar 20, 2024 at 06:32:10PM +0200, Andy Shevchenko wrote:
> When iDMA 64-bit device is powered off, the IRQ status register
> is all 1:s. This is never happen in real case and signalling that
> the device is simply powered off. Don't try to serve interrupts
> that are not ours.

...

>  	dev_vdbg(idma64->dma.dev, "%s: status=%#x\n", __func__, status);

Dunno if I actually also need to move this message to after the checks...

> +	/* Since IRQ may be shared, check if DMA controller is powered on */
> +	if (status == GENMASK(31, 0))
> +		return IRQ_NONE;
> +
>  	/* Check if we have any interrupt from the DMA controller */
>  	if (!status)
>  		return IRQ_NONE;

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off
  2024-03-20 16:32 [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off Andy Shevchenko
  2024-03-20 16:36 ` Andy Shevchenko
@ 2024-03-21 11:49 ` Heiner Kallweit
  2024-03-21 12:02   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2024-03-21 11:49 UTC (permalink / raw)
  To: Andy Shevchenko, Uwe Kleine-König, dmaengine, linux-kernel
  Cc: Vinod Koul

On 20.03.2024 17:32, Andy Shevchenko wrote:
> diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
> index 78a938969d7d..1b60e73d9322 100644
> --- a/drivers/dma/idma64.c
> +++ b/drivers/dma/idma64.c
> @@ -173,6 +173,10 @@ static irqreturn_t idma64_irq(int irq, void *dev)
>  
>  	dev_vdbg(idma64->dma.dev, "%s: status=%#x\n", __func__, status);
>  
> +	/* Since IRQ may be shared, check if DMA controller is powered on */
> +	if (status == GENMASK(31, 0))
> +		return IRQ_NONE;
> +
>  	/* Check if we have any interrupt from the DMA controller */
>  	if (!status)
>  		return IRQ_NONE;
> -- 2.43.0.rc1.1.gbec44491f096

Tested-by: Heiner Kallweit <hkallweit1@gmail.com>

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

* Re: [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off
  2024-03-21 11:49 ` Heiner Kallweit
@ 2024-03-21 12:02   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-03-21 12:02 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Uwe Kleine-König, dmaengine, linux-kernel, Vinod Koul

On Thu, Mar 21, 2024 at 12:49:20PM +0100, Heiner Kallweit wrote:
> On 20.03.2024 17:32, Andy Shevchenko wrote:

...

> >  	dev_vdbg(idma64->dma.dev, "%s: status=%#x\n", __func__, status);
> >  
> > +	/* Since IRQ may be shared, check if DMA controller is powered on */
> > +	if (status == GENMASK(31, 0))
> > +		return IRQ_NONE;
> > +
> >  	/* Check if we have any interrupt from the DMA controller */
> >  	if (!status)
> >  		return IRQ_NONE;
> > -- 2.43.0.rc1.1.gbec44491f096
> 
> Tested-by: Heiner Kallweit <hkallweit1@gmail.com>

Thank you! I think I'll move the test to be before the debug message as it
makes no sense to print when we have powered off device.
Nevertheless, I'll take your tag if no objections for v2.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2024-03-21 12:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20 16:32 [PATCH v1 1/1] idma64: Don't try to serve interrupts when device is powered off Andy Shevchenko
2024-03-20 16:36 ` Andy Shevchenko
2024-03-21 11:49 ` Heiner Kallweit
2024-03-21 12:02   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox