]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
irqchip/gic, gic-v3: Prevent GSI to SGI translations
authorAndre Przywara <andre.przywara@arm.com>
Mon, 4 Apr 2022 11:08:42 +0000 (12:08 +0100)
committerMarc Zyngier <maz@kernel.org>
Tue, 5 Apr 2022 15:33:47 +0000 (16:33 +0100)
At the moment the GIC IRQ domain translation routine happily converts
ACPI table GSI numbers below 16 to GIC SGIs (Software Generated
Interrupts aka IPIs). On the Devicetree side we explicitly forbid this
translation, actually the function will never return HWIRQs below 16 when
using a DT based domain translation.

We expect SGIs to be handled in the first part of the function, and any
further occurrence should be treated as a firmware bug, so add a check
and print to report this explicitly and avoid lengthy debug sessions.

Fixes: 64b499d8df40 ("irqchip/gic-v3: Configure SGIs as standard interrupts")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220404110842.2882446-1-andre.przywara@arm.com
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-gic.c

index 9b6316582515c249506871b222feca91f47254a8..b252d5534547c006b757dd2fc8db02ff92469b4e 100644 (file)
@@ -1466,6 +1466,12 @@ static int gic_irq_domain_translate(struct irq_domain *d,
                if(fwspec->param_count != 2)
                        return -EINVAL;
 
+               if (fwspec->param[0] < 16) {
+                       pr_err(FW_BUG "Illegal GSI%d translation request\n",
+                              fwspec->param[0]);
+                       return -EINVAL;
+               }
+
                *hwirq = fwspec->param[0];
                *type = fwspec->param[1];
 
index 58ba835bee1f393fe4be3b0c3dab04367fc0c9bb..09c710ecc387de31ebd52b1d24be719c3206cfd2 100644 (file)
@@ -1123,6 +1123,12 @@ static int gic_irq_domain_translate(struct irq_domain *d,
                if(fwspec->param_count != 2)
                        return -EINVAL;
 
+               if (fwspec->param[0] < 16) {
+                       pr_err(FW_BUG "Illegal GSI%d translation request\n",
+                              fwspec->param[0]);
+                       return -EINVAL;
+               }
+
                *hwirq = fwspec->param[0];
                *type = fwspec->param[1];