of/irq: Fix root interrupt controller handling
Subsystems (4)
Geert Uytterhoeven
maintainercover of/irq: Fix root interrupt controller handling
Hi all,
On ARM, the main interrupt controller is typically the GIC, and one can safely put "interrupt-parent = <&gic>;" in the root node. The GIC node has an interrupts property, but it points to itself, causing of_irq_init() to treat it as the root interrupt controller.
On RISC-V, the main interrupt controller is typically the PLIC. However, one can not put "interrupt-parent = <&plic>;" in the root node, as that would cause a kernel panic ("No interrupt controller found"). The main difference with ARM is that the PLIC is not the root interrupt
controller: its interrupt parent is the RISC-V CPU or Hart-Level Interrupt Controller (HLIC). The latter is the root interrupt controller, and despite having no interrupts property, it is currently not considered the root interrupt controller when an interrupt-parent property is present in the root node.
This series fixes the issue in of_irq_init(), and moves the "interrupt-parent = <&plic>;" for the RZ/Five (R9A07G043F) SoC from the soc node to the top node, like was done recently for the very similar RZ/G2UL (R9A07G043U) SoC[1].
Thanks for your comments!
Geert Uytterhoeven (2):
of/irq: Ignore interrupt parent for nodes without interrupts
riscv: dts: renesas: r9a07g043f: Move interrupt-parent to top node
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 3 ++- drivers/of/irq.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 12 lines
2.43.0
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsGeert Uytterhoeven
maintainerPATCH 1/2 of/irq: Ignore interrupt parent for nodes without interrupts
The Devicetree Specification states:
The root of the interrupt tree is determined when traversal of the interrupt tree reaches an interrupt controller node without an interrupts property and thus no explicit interrupt parent.
However, of_irq_init() gratuitously assumes that a node without interrupts has an actual interrupt parent if it finds an interrupt-parent property higher up in the device tree. Hence when such a property is present (e.g. in the root node), the root interrupt controller may not be detected as such, causing a panic:
OF: of_irq_init: children remain, but no parents Kernel panic - not syncing: No interrupt controller found.
Commit e91033621d56e055 ("of/irq: Use interrupts-extended to find parent") already fixed a first part, by checking for the presence of an interrupts-extended property. Fix the second part by only calling of_irq_find_parent() when an interrupts property is present.
--- drivers/of/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/irq.c +1 -1
@@ -663,7 +663,7 @@ void __init of_irq_init(const struct of_device_id *matches)* are the same distance away from the root irq controller. */ desc->interrupt_parent =of_parse_phandle (np,"interrupts-extended" ,0 ); -if (!desc->interrupt_parent) +if (!desc->interrupt_parent &&of_property_present (np,"interrupts" )) desc->interrupt_parent =of_irq_find_parent (np);if (desc->interrupt_parent == np) {of_node_put (desc->interrupt_parent);
Signature · 1 line
2.43.0
Rob Herring
maintainerRe: [PATCH/RFC 1/2] of/irq: Ignore interrupt parent for nodes without interrupts
Quoted 13 lines · Geert Uytterhoeven
The Devicetree Specification states:
The root of the interrupt tree is determined when traversal of the interrupt tree reaches an interrupt controller node without an interrupts property and thus no explicit interrupt parent.
However,
of_irq_init()gratuitously assumes that a node without interrupts has an actual interrupt parent if it finds an interrupt-parent property higher up in the device tree. Hence when such a property is present (e.g. in the root node), the root interrupt controller may not be detected as such, causing a panic:
Quoted 7 lines
OF:
of_irq_init: children remain, but no parents Kernel panic - not syncing: No interrupt controller found.Commit
e91033621d56e055("of/irq: Use interrupts-extended to find parent") already fixed a first part, by checking for the presence of an interrupts-extended property. Fix the second part by only callingof_irq_find_parent()when an interrupts property is present.
Seems reasonable. Why the RFC tag?
Normally I'd worry about some ancient PPC or Sparc system, but they don't use of_irq_init().
Rob
Re: [PATCH/RFC 1/2] of/irq: Ignore interrupt parent for nodes without interrupts
Hi Rob,
Quoted 17 lines · Rob Herring
Quoted 15 lines · Geert Uytterhoeven
The Devicetree Specification states:
The root of the interrupt tree is determined when traversal of the interrupt tree reaches an interrupt controller node without an interrupts property and thus no explicit interrupt parent.
However,
of_irq_init()gratuitously assumes that a node without interrupts has an actual interrupt parent if it finds an interrupt-parent property higher up in the device tree. Hence when such a property is present (e.g. in the root node), the root interrupt controller may not be detected as such, causing a panic:OF:
of_irq_init: children remain, but no parents Kernel panic - not syncing: No interrupt controller found.
Quoted 6 lines
Quoted 4 lines
Commit
e91033621d56e055("of/irq: Use interrupts-extended to find parent") already fixed a first part, by checking for the presence of an interrupts-extended property. Fix the second part by only callingof_irq_find_parent()when an interrupts property is present.Seems reasonable. Why the RFC tag?
Perhaps you might object to putting interrupt-parent in the root node if it does not point to the root interrupt controller, or if it does not help to simplify interrupts-extended to interrupts (like e.g. for ARM arch timer)?
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 2/2 riscv: dts: renesas: r9a07g043f: Move interrupt-parent to top node
In reply to Geert UytterhoevenMove the "interrupt-parent = <&plic>" property from the soc node to the top node, for consistency with arch/arm64/boot/dts/renesas/r9a07g043u.dtsi.
--- arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2 -1
@@ -12,6 +12,8 @@ #include <arm64/renesas/r9a07g043.dtsi> / { + interrupt-parent = <&plic>; + cpus { #address-cells = <1>; #size-cells = <0>;
@@ -52,7 +54,6 @@ &pinctrl { &soc { dma-noncoherent; - interrupt-parent = <&plic>; irqc: interrupt-controller@110a0000 { compatible = "renesas,r9a07g043f-irqc";
Signature · 1 line
2.43.0