Commit 2a20b08f authored by Marc Zyngier's avatar Marc Zyngier Committed by Catalin Marinas

ACPI: irq: Prevent unregistering of GIC SGIs

When using ACPI on arm64, which implies the GIC IRQ model, no
table should ever provide a GSI number in the range [0:15],
as these are reserved for IPIs.

However, drivers tend to call acpi_unregister_gsi() with any
random GSI number provided by half baked tables, which results
in an exploding kernel when its IPIs have been unconfigured.

In order to catch this, check for the silly case early, warn
that something is going wrong and avoid the above disaster.
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Tested-by: default avatardann frazier <dann.frazier@canonical.com>
Tested-by: default avatarHanjun Guo <guohanjun@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Reviewed-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Link: https://lore.kernel.org/r/20210421164317.1718831-3-maz@kernel.orgSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 1ecd5b12
...@@ -75,8 +75,12 @@ void acpi_unregister_gsi(u32 gsi) ...@@ -75,8 +75,12 @@ void acpi_unregister_gsi(u32 gsi)
{ {
struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id, struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
DOMAIN_BUS_ANY); DOMAIN_BUS_ANY);
int irq = irq_find_mapping(d, gsi); int irq;
if (WARN_ON(acpi_irq_model == ACPI_IRQ_MODEL_GIC && gsi < 16))
return;
irq = irq_find_mapping(d, gsi);
irq_dispose_mapping(irq); irq_dispose_mapping(irq);
} }
EXPORT_SYMBOL_GPL(acpi_unregister_gsi); EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment