irqchip/gic/gic-v3: prevent GSI to SGI translations
Subsystems (3)
RFC PATCH 1/1 irqchip/gic/gic-v3: prevent GSI to SGI translations
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.
---
Hi,
marking this as an RFC because:
- I don't know if we really can forbid IPIs in ACPI tables. We certainly pushed back against this multiple times on the DT side.
- I don't know if this is the right place to filter this out.
This was triggered by an SSDT table wrongly containing an interrupt resource entry of "0", for a debug UART without an interrupt line connected [1] (about to be fixed). This overwrote the IPI0 trigger method to "level", which prevented SGI0 to be enabled again *after* a CPU offline/online cycle.
It required some debugging to find this firmware problem, so I am proposing an explicit error message, and to actually deny registering this interrupt.
Cheers,
Andre
drivers/irqchip/irq-gic-v3.c | 6 ++++++ drivers/irqchip/irq-gic.c | 6 ++++++ 2 files changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +6 -0
@@ -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 ];
drivers/irqchip/irq-gic.c +6 -0
@@ -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 ];
Signature · 1 line
2.25.1
[irqchip: irq/irqchip-fixes] irqchip/gic, gic-v3: Prevent GSI to SGI translations
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:
Commit-ID: 544808f7e21cb9ccdb8f3aa7de594c05b1419061 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/544808f7e21cb9ccdb8f3aa7de594c05b1419061 Author: Andre Przywara <[email protected]> AuthorDate: Mon, 04 Apr 2022 12:08:42 +01:00 Committer: Marc Zyngier <[email protected]> CommitterDate: Tue, 05 Apr 2022 16:33:47 +01:00
irqchip/gic, gic-v3: Prevent GSI to SGI translations
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.
--- drivers/irqchip/irq-gic-v3.c | 6 ++++++ drivers/irqchip/irq-gic.c | 6 ++++++ 2 files changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +6 -0
@@ -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 ];
drivers/irqchip/irq-gic.c +6 -0
@@ -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 ];