Skip to content

Commit c33c43f

Browse files
Ming WangKAGA-KOKO
authored andcommitted
irqchip/loongson-pch-lpc: Use legacy domain for PCH-LPC IRQ controller
On certain Loongson platforms, drivers attempting to request a legacy ISA IRQ directly via request_irq() (e.g., IRQ 4) may fail. The virtual IRQ descriptor is not fully initialized and lacks a valid irqchip. This issue does not affect ACPI-enumerated devices described in DSDT, as their interrupts are properly mapped via the GSI translation path. This indicates the LPC irqdomain itself is functional but is not correctly handling direct VIRQ-to-HWIRQ mappings. The root cause is the use of irq_domain_create_linear(). This API sets up a domain for dynamic, on-demand mapping, typically triggered by a GSI request. It does not pre-populate the mappings for the legacy VIRQ range (0-15). Consequently, if no ACPI device claims a specific GSI (e.g., GSI 4), the corresponding VIRQ (e.g., VIRQ 4) is never mapped to the LPC domain. A direct call to request_irq(4, ...) then fails because the kernel cannot resolve this VIRQ to a hardware interrupt managed by the LPC controller. The PCH-LPC interrupt controller is an i8259-compatible legacy device that requires a deterministic, static 1-to-1 mapping for IRQs 0-15 to support legacy drivers. Fix this by replacing irq_domain_create_linear() with irq_domain_create_legacy(). This API is specifically designed for such controllers. It establishes the required static 1-to-1 VIRQ-to-HWIRQ mapping for the entire legacy range (0-15) immediately upon domain creation. This ensures that any VIRQ in this range is always resolvable, making direct calls to request_irq() for legacy IRQs function correctly. Signed-off-by: Ming Wang <wangming01@loongson.cn> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent ba9d484 commit c33c43f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/irqchip/irq-loongson-pch-lpc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,13 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent,
200200
goto iounmap_base;
201201
}
202202

203-
priv->lpc_domain = irq_domain_create_linear(irq_handle, LPC_COUNT,
204-
&pch_lpc_domain_ops, priv);
203+
/*
204+
* The LPC interrupt controller is a legacy i8259-compatible device,
205+
* which requires a static 1:1 mapping for IRQs 0-15.
206+
* Use irq_domain_create_legacy to establish this static mapping early.
207+
*/
208+
priv->lpc_domain = irq_domain_create_legacy(irq_handle, LPC_COUNT, 0, 0,
209+
&pch_lpc_domain_ops, priv);
205210
if (!priv->lpc_domain) {
206211
pr_err("Failed to create IRQ domain\n");
207212
goto free_irq_handle;

0 commit comments

Comments
 (0)