# \[PATCH v1 1/1\] dmaengine: acpi: Check for errors from acpi\_register\_gsi() separately

- Subsystems: DMA GENERIC OFFLOAD ENGINE SUBSYSTEM, THE REST
- Maintainers: Vinod Koul, Linus Torvalds
- Status: LANDED (15cb0321a55e · 2021-08-06 16:18)
- Landed in mainline as 15cb0321a55e on 2021-08-06.
- List: dmaengine
- 4 messages, 2 authors
- Page: https://ratatoskr.run/dmaengine/2021/08/1465613/t

## \[PATCH v1 1/1\] dmaengine: acpi: Check for errors from acpi\_register\_gsi() separately

- From: Andy Shevchenko \<andriy.shevchenko@linux.intel.com\>
- Date: 2021-08-02 17:55:15 
- Message: https://ratatoskr.run/dmaengine/2021/08/1465613.md

```text
While IRQ test agaist the returned variable in practice is a good enough
there is still a room for theoretical mistake in case the vIRQ of the
device contains the same error code that acpi_register_gsi() may return.
Due to this, check for error code separately from matching the vIRQs.

Besides that, append documentation to tell why acpi_gsi_to_irq() can't
be used and we call acpi_register_gsi() instead.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/acpi-dma.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
index 52768dc8ce12..5906eae26e2a 100644
--- a/drivers/dma/acpi-dma.c
+++ b/drivers/dma/acpi-dma.c
@@ -75,8 +75,16 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,
 	    si->mmio_base_high != upper_32_bits(mem))
 		return 0;
 
-	/* Match device by Linux vIRQ */
+	/*
+	 * acpi_gsi_to_irq() can't be used because some platforms do not save
+	 * registered IRQs in the MP table. Instead we just try to register
+	 * the GSI, which is the core part of the above mentioned function.
+	 */
 	ret = acpi_register_gsi(NULL, si->gsi_interrupt, si->interrupt_mode, si->interrupt_polarity);
+	if (ret < 0)
+		return 0;
+
+	/* Match device by Linux vIRQ */
 	if (ret != irq)
 		return 0;
 
-- 
2.30.2

```

## Re: \[PATCH v1 1/1\] dmaengine: acpi: Check for errors from acpi\_register\_gsi() separately

- From: Vinod Koul \<vkoul@kernel.org\>
- Date: 2021-08-06 13:44:56 
- Message: https://ratatoskr.run/dmaengine/2021/08/1470319.md

```text
On 02-08-21, 20:55, Andy Shevchenko wrote:
> While IRQ test agaist the returned variable in practice is a good enough
> there is still a room for theoretical mistake in case the vIRQ of the
> device contains the same error code that acpi_register_gsi() may return.
> Due to this, check for error code separately from matching the vIRQs.
> 
> Besides that, append documentation to tell why acpi_gsi_to_irq() can't
> be used and we call acpi_register_gsi() instead.

patch fails to apply, pls rebase

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/acpi-dma.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c
> index 52768dc8ce12..5906eae26e2a 100644
> --- a/drivers/dma/acpi-dma.c
> +++ b/drivers/dma/acpi-dma.c
> @@ -75,8 +75,16 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,
>  	    si->mmio_base_high != upper_32_bits(mem))
>  		return 0;
>  
> -	/* Match device by Linux vIRQ */
> +	/*
> +	 * acpi_gsi_to_irq() can't be used because some platforms do not save
> +	 * registered IRQs in the MP table. Instead we just try to register
> +	 * the GSI, which is the core part of the above mentioned function.
> +	 */
>  	ret = acpi_register_gsi(NULL, si->gsi_interrupt, si->interrupt_mode, si->interrupt_polarity);
> +	if (ret < 0)
> +		return 0;
> +
> +	/* Match device by Linux vIRQ */
>  	if (ret != irq)
>  		return 0;
>  
> -- 
> 2.30.2

-- 
~Vinod
```

## Re: \[PATCH v1 1/1\] dmaengine: acpi: Check for errors from acpi\_register\_gsi() separately

- From: Andy Shevchenko \<andriy.shevchenko@linux.intel.com\>
- Date: 2021-08-06 15:29:34 
- Message: https://ratatoskr.run/dmaengine/2021/08/1470396.md

```text
On Fri, Aug 06, 2021 at 07:14:50PM +0530, Vinod Koul wrote:
> On 02-08-21, 20:55, Andy Shevchenko wrote:
> > While IRQ test agaist the returned variable in practice is a good enough
> > there is still a room for theoretical mistake in case the vIRQ of the
> > device contains the same error code that acpi_register_gsi() may return.
> > Due to this, check for error code separately from matching the vIRQs.
> > 
> > Besides that, append documentation to tell why acpi_gsi_to_irq() can't
> > be used and we call acpi_register_gsi() instead.
> 
> patch fails to apply, pls rebase

I don't see that you applied the previous patch [1].
Care to apply it, please?

[1]: https://lore.kernel.org/dmaengine/20210730202715.24375-1-andriy.shevchenko@linux.intel.com/T/#u

-- 
With Best Regards,
Andy Shevchenko


```

## Re: \[PATCH v1 1/1\] dmaengine: acpi: Check for errors from acpi\_register\_gsi() separately

- From: Vinod Koul \<vkoul@kernel.org\>
- Date: 2021-08-06 16:19:44 
- Message: https://ratatoskr.run/dmaengine/2021/08/1470422.md

```text
On 06-08-21, 18:29, Andy Shevchenko wrote:
> On Fri, Aug 06, 2021 at 07:14:50PM +0530, Vinod Koul wrote:
> > On 02-08-21, 20:55, Andy Shevchenko wrote:
> > > While IRQ test agaist the returned variable in practice is a good enough
> > > there is still a room for theoretical mistake in case the vIRQ of the
> > > device contains the same error code that acpi_register_gsi() may return.
> > > Due to this, check for error code separately from matching the vIRQs.
> > > 
> > > Besides that, append documentation to tell why acpi_gsi_to_irq() can't
> > > be used and we call acpi_register_gsi() instead.
> > 
> > patch fails to apply, pls rebase
> 
> I don't see that you applied the previous patch [1].
> Care to apply it, please?

Sorry, somehow that one was pushed to queue but never got applied!

Have applied both now

> 
> [1]: https://lore.kernel.org/dmaengine/20210730202715.24375-1-andriy.shevchenko@linux.intel.com/T/#u
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 

-- 
~Vinod
```
