ACPI: Generic GSI: Do not attempt to map non-GSI IRQs during bus scan
authorAgustin Vega-Frias <agustinv@codeaurora.org>
Thu, 2 Feb 2017 23:23:57 +0000 (18:23 -0500)
committerMarc Zyngier <marc.zyngier@arm.com>
Fri, 3 Feb 2017 15:03:40 +0000 (15:03 +0000)
ACPI extended IRQ resources may contain a Resource Source field to specify
an alternate interrupt controller, attempting to map them as GSIs is
incorrect, so just disable the platform resource.

Since this field is currently ignored, we make this change conditional
on CONFIG_ACPI_GENERIC_GSI to keep the current behavior on x86 platforms,
in case some existing ACPI tables are using this incorrectly.

Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Agustin Vega-Frias <agustinv@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/acpi/resource.c

index cb57962ef7c4560793842ca271bfd1eb5650b422..8b11d6d385dcd22a75f9f8bfdf9bd81856bf87ba 100644 (file)
@@ -43,6 +43,19 @@ static inline bool
 acpi_iospace_resource_valid(struct resource *res) { return true; }
 #endif
 
+#if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
+static inline bool is_gsi(struct acpi_resource_extended_irq *ext_irq)
+{
+       return ext_irq->resource_source.string_length == 0 &&
+              ext_irq->producer_consumer == ACPI_CONSUMER;
+}
+#else
+static inline bool is_gsi(struct acpi_resource_extended_irq *ext_irq)
+{
+       return true;
+}
+#endif
+
 static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
 {
        u64 reslen = end - start + 1;
@@ -470,9 +483,12 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
                        acpi_dev_irqresource_disabled(res, 0);
                        return false;
                }
-               acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
+               if (is_gsi(ext_irq))
+                       acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
                                         ext_irq->triggering, ext_irq->polarity,
                                         ext_irq->sharable, false);
+               else
+                       acpi_dev_irqresource_disabled(res, 0);
                break;
        default:
                res->flags = 0;