Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/irq: Add a quirk for controllers with their own definition of interrupt-map

Since commit 041284181226 ("of/irq: Allow matching of an interrupt-map
local to an interrupt controller"), a handful of interrupt controllers
have stopped working correctly. This is due to the DT exposing a
non-sensical interrupt-map property, and their drivers relying on the
kernel ignoring this property.

Since we cannot realistically fix this terrible behaviour, add a quirk
for the limited set of devices that have implemented this monster,
and document that this is a pretty bad practice.

Fixes: 041284181226 ("of/irq: Allow matching of an interrupt-map local to an interrupt controller")
Cc: Rob Herring <robh@kernel.org>
Cc: John Crispin <john@phrozen.org>
Cc: Biwen Li <biwen.li@nxp.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20211201114102.13446-1-maz@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Marc Zyngier and committed by
Rob Herring
de4adddc cc5faf26

+25 -2
+25 -2
drivers/of/irq.c
··· 76 76 } 77 77 EXPORT_SYMBOL_GPL(of_irq_find_parent); 78 78 79 + /* 80 + * These interrupt controllers abuse interrupt-map for unspeakable 81 + * reasons and rely on the core code to *ignore* it (the drivers do 82 + * their own parsing of the property). 83 + * 84 + * If you think of adding to the list for something *new*, think 85 + * again. There is a high chance that you will be sent back to the 86 + * drawing board. 87 + */ 88 + static const char * const of_irq_imap_abusers[] = { 89 + "CBEA,platform-spider-pic", 90 + "sti,platform-spider-pic", 91 + "realtek,rtl-intc", 92 + "fsl,ls1021a-extirq", 93 + "fsl,ls1043a-extirq", 94 + "fsl,ls1088a-extirq", 95 + "renesas,rza1-irqc", 96 + NULL, 97 + }; 98 + 79 99 /** 80 100 * of_irq_parse_raw - Low level interrupt tree parsing 81 101 * @addr: address specifier (start of "reg" property of the device) in be32 format ··· 179 159 /* 180 160 * Now check if cursor is an interrupt-controller and 181 161 * if it is then we are done, unless there is an 182 - * interrupt-map which takes precedence. 162 + * interrupt-map which takes precedence except on one 163 + * of these broken platforms that want to parse 164 + * interrupt-map themselves for $reason. 183 165 */ 184 166 bool intc = of_property_read_bool(ipar, "interrupt-controller"); 185 167 186 168 imap = of_get_property(ipar, "interrupt-map", &imaplen); 187 - if (imap == NULL && intc) { 169 + if (intc && 170 + (!imap || of_device_compatible_match(ipar, of_irq_imap_abusers))) { 188 171 pr_debug(" -> got it !\n"); 189 172 return 0; 190 173 }