Skip to contentSkip to conversation

of/irq: Don't ignore interrupt-controller when interrupt-map failed

PATCH In review Marc Zyngier 4 participants 8 messages Nov 12, 2021 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of/irq: Don't ignore interrupt-controller when interrupt-map failed

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>
---
 drivers/of/irq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/of/irq.c +10 -3
index 32be5a03951f..508fb1717de3 100644
@@ -161,9 +161,10 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 		 * if it is then we are done, unless there is an
 		 * interrupt-map which takes precedence.
 		 */
+		bool intc = of_property_read_bool(ipar, "interrupt-controller");
+
 		imap = of_get_property(ipar, "interrupt-map", &imaplen);
-		if (imap == NULL &&
-		    of_property_read_bool(ipar, "interrupt-controller")) {
+		if (imap == NULL && intc) {
 			pr_debug(" -> got it !\n");
 			return 0;
 		}
@@ -244,8 +245,14 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
 			pr_debug(" -> imaplen=%d\n", imaplen);
 		}
-		if (!match)
+		if (!match) {
+			if (intc) {
+				pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);
+				return 0;
+			}
+
 			goto fail;
+		}
 
 		/*
 		 * Successfully parsed an interrrupt-map translation; copy new
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 43 lines · Marc Zyngier

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>
---
 drivers/of/irq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/of/irq.c +3 -2
index 32be5a03951f..508fb1717de3 100644
@@ -161,9 +161,10 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
                 * if it is then we are done, unless there is an
                 * interrupt-map which takes precedence.
                 */
+               bool intc = of_property_read_bool(ipar, "interrupt-controller");
+
                imap = of_get_property(ipar, "interrupt-map", &imaplen);
-               if (imap == NULL &&
-                   of_property_read_bool(ipar, "interrupt-controller")) {
+               if (imap == NULL && intc) {
                        pr_debug(" -> got it !\n");
                        return 0;
                }

drivers/of/irq.c int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · line 250

Quoted 7 lines
drivers/of/irq.c +3 -1
@@ -244,8 +245,14 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
                        pr_debug(" -> imaplen=%d\n", imaplen);
                }
-               if (!match)
+               if (!match) {
+                       if (intc) {
+                               pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);

Let's make this a WARN for !IS_ENABLED(CONFIG_PASEMI). (whatever the right kconfig symbol is).

Quoted 11 lines
drivers/of/irq.c +4 -1
+                               return 0;
+                       }
+
                        goto fail;
+               }
 
                /*
                 * Successfully parsed an interrrupt-map translation; copy new
--

2.30.2

#2 lore raw
Quoted 5 lines · Rob Herring
Quoted 3 lines · Marc Zyngier
(quoted diff) +0 -0
@@ -244,8 +245,14 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
Quoted 9 lines

Review int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · line 250

Quoted 6 lines
(quoted diff) +3 -1
                        pr_debug(" -> imaplen=%d\n", imaplen);
                }
-               if (!match)
+               if (!match) {
+                       if (intc) {
+                               pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);

Let's make this a WARN for !IS_ENABLED(CONFIG_PASEMI). (whatever the right kconfig symbol is).

I've folded this in.

	M.
drivers/of/irq.c +7 -1
index 508fb1717de3..b10f015b2e37 100644
@@ -247,7 +247,13 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 		}
 		if (!match) {
 			if (intc) {
-				pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);
+				/*
+				 * The PASEMI Nemo is a known offender, so
+				 * let's only warn for anyone else.
+				 */
+				WARN(!IS_ENABLED(CONFIG_PPC_PASEMI),
+				     "%pOF interrupt-map failed, using interrupt-controller\n",
+				     ipar);
 				return 0;
 			}
 
Signature · 1 line
Without deviation from the norm, progress is not possible.
#3 lore raw
In reply to Marc Zyngier
Quoted 14 lines · Marc Zyngier

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Quoted 6 lines
Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>

I'm not qualified to review this, but since 041284181226 was merged via my tree along with the rest of the Apple stuff, let me know if you'd like me to merge this.

I see Rob has a comment, so if you want to take care merging it yourself, that's certainly fine with me.

Quoted 40 lines
---
 drivers/of/irq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/of/irq.c +10 -3
index 32be5a03951f..508fb1717de3 100644
@@ -161,9 +161,10 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 		 * if it is then we are done, unless there is an
 		 * interrupt-map which takes precedence.
 		 */
+		bool intc = of_property_read_bool(ipar, "interrupt-controller");
+
 		imap = of_get_property(ipar, "interrupt-map", &imaplen);
-		if (imap == NULL &&
-		    of_property_read_bool(ipar, "interrupt-controller")) {
+		if (imap == NULL && intc) {
 			pr_debug(" -> got it !\n");
 			return 0;
 		}
@@ -244,8 +245,14 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
 			pr_debug(" -> imaplen=%d\n", imaplen);
 		}
-		if (!match)
+		if (!match) {
+			if (intc) {
+				pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);
+				return 0;
+			}
+
 			goto fail;
+		}
 
 		/*
 		 * Successfully parsed an interrrupt-map translation; copy new
Signature · 1 line
2.30.2
#4 lore raw
Quoted 23 lines · Bjorn Helgaas
Quoted 14 lines · Marc Zyngier

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Quoted 6 lines
Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Quoted 6 lines

I'm not qualified to review this, but since 041284181226 was merged via my tree along with the rest of the Apple stuff, let me know if you'd like me to merge this.

I see Rob has a comment, so if you want to take care merging it yourself, that's certainly fine with me.

I have a couple of IRQ patches that need to go in, so happy to route it via the irqchip tree if Rob gives his blessing.

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Reviewed-by
#5 lore raw
Quoted 30 lines · Marc Zyngier
Quoted 27 lines · Bjorn Helgaas
Quoted 14 lines · Marc Zyngier

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Quoted 6 lines
Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>

I'm not qualified to review this, but since 041284181226 was merged via my tree along with the rest of the Apple stuff, let me know if you'd like me to merge this.

Quoted 5 lines
Quoted 2 lines

I see Rob has a comment, so if you want to take care merging it yourself, that's certainly fine with me.

I have a couple of IRQ patches that need to go in, so happy to route it via the irqchip tree if Rob gives his blessing.

I have stuff for rc1 too, but feel free to take it:

With the WARN added,

#6 lore raw
In reply to Bjorn Helgaas
Quoted 63 lines · Bjorn Helgaas
Quoted 14 lines · Marc Zyngier

Since 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller"), the irq code favors using an interrupt-map over a interrupt-controller property if both are available, while the earlier behaviour was to ignore the interrupt-map altogether.

However, we now end-up with the opposite behaviour, which is to ignore the interrupt-controller property even if the interrupt-map fails to match its input. This new behaviour breaks the AmigaOne X1000 machine, which ships with an extremely "creative" (read:
broken) device tree.

Fix this by allowing the interrupt-controller property to be selected when interrupt-map fails to match anything.

Quoted 6 lines
Fixes 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc Rob Herring <[email protected]>
Cc Bjorn Helgaas <[email protected]>

I'm not qualified to review this, but since 041284181226 was merged via my tree along with the rest of the Apple stuff, let me know if you'd like me to merge this.

I see Rob has a comment, so if you want to take care merging it yourself, that's certainly fine with me.

Quoted 35 lines
---
  drivers/of/irq.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
drivers/of/irq.c +10 -3
index 32be5a03951f..508fb1717de3 100644
@@ -161,9 +161,10 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
  		 * if it is then we are done, unless there is an
  		 * interrupt-map which takes precedence.
  		 */
+		bool intc = of_property_read_bool(ipar, "interrupt-controller");
+
  		imap = of_get_property(ipar, "interrupt-map", &imaplen);
-		if (imap == NULL &&
-		    of_property_read_bool(ipar, "interrupt-controller")) {
+		if (imap == NULL && intc) {
  			pr_debug(" -> got it !\n");
  			return 0;
  		}
@@ -244,8 +245,14 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
 
  			pr_debug(" -> imaplen=%d\n", imaplen);
  		}
-		if (!match)
+		if (!match) {
+			if (intc) {
+				pr_debug("%pOF interrupt-map failed, using interrupt-controller\n", ipar);
+				return 0;
+			}
+
  			goto fail;
+		}
 
Quoted 5 lines
Quoted 5 lines
drivers/of/irq.c +0 -0
  		/*
  		 * Successfully parsed an interrrupt-map translation; copy new
Signature · 1 line
2.30.2

Could you please merge it asap for the RC1? Then we can compile the RC1 without these patches.

Thanks to all for your help and sorry for bother you with all these mails. I do this work alongside my main job and actually I don't have time for bisecting.

-- Christian

#7 lore raw
Quoted 3 lines · Christian Zigotzky

Could you please merge it asap for the RC1? Then we can compile the RC1 without these patches.

I don't think there is any rush. Plenty of things are broken at this stage, and that's completely expected after merging a few thousand patches. It is not like we are at -rc7 with a critical issue to address right before release.

The problem is understood, the fix identified, and we have a patch under review. This really is as good as it gets.

Quoted 3 lines

Thanks to all for your help and sorry for bother you with all these mails. I do this work alongside my main job and actually I don't have time for bisecting.

And we're grateful for your help in identifying the problem.

"Don't Panic!".

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.