linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Similar SoCs with different CPUs and interrupt bindings
@ 2022-09-21  7:46 Geert Uytterhoeven
  2022-09-21  8:49 ` Krzysztof Kozlowski
  2022-09-21  9:20 ` Robin Murphy
  0 siblings, 2 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2022-09-21  7:46 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Andre Przywara, Conor Dooley, Samuel Holland, Biju Das,
	Chris Paterson, Atish Patra, Lad, Prabhakar,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-riscv, Linux ARM, Linux-Renesas, Linux Kernel Mailing List

        Hi Rob, Krzysztof,

This is a topic that came up at the RISC-V BoF at Plumbers, and it was
suggested to bring it up with you.

The same SoC may be available with either RISC-V or other (e.g. ARM) CPU
cores (an example of this are the Renesas RZ/Five and RZ/G2UL SoCs).
To avoid duplication, we would like to have:
  - <riscv-soc>.dtsi includes <base-soc>.dtsi,
  - <arm-soc>.dtsi includes <base-soc>.dtsi.

Unfortunately RISC-V and ARM typically use different types of interrupt
controllers, using different bindings (e.g. 2-cell vs. 3-cell), and
possibly using different interrupt numbers.  Hence the interrupt-parent
and interrupts{-extended} properties should be different, too.

Possible solutions[1]:
  1. interrupt-map

  2. Use a SOC_PERIPHERAL_IRQ() macro in interrupts properties in
     <base-soc>.dtsi, with
       - #define SOC_PERIPHERAL_IRQ(nr, na) nr          // RISC-V
       - #define SOC_PERIPHERAL_IRQ(nr, na) GIC_SPI na  // ARM
     Note that the cpp/dtc combo does not support arithmetic, so even
     the simple case where nr = 32 + na cannot be simplified.

  3. Wrap inside RISCV() and ARM() macros, e.g.:

        RISCV(interrupts = <412 IRQ_TYPE_LEVEL_HIGH>;)
        ARM(interrupts = <GIC_SPI 380 IRQ_TYPE_LEVEL_HIGH>;)

     Cfr. ARM() and THUMB() in arch/arm/include/asm/unified.h, as used
     to express the same operation using plain ARM or ARM Thumb
     instructions.

Personally, I'm leaning towards the third solution, as it is the most
flexible, and allows us to extend to more than 2 interrupt controllers.

Note that this is actually not a new issue.  For years, ARM SoCs have
existed with multiple types of cores on the same die, using Cortex-A
cores for the application, and Cortex-R/SuperH/V850/... cores for
real-time and/or baseband operation.  So far this wasn't an issue, as
only the Cortex-A cores ran Linux, and we ignored the other cores (and
the related interrupt controllers and hierarchy) in DT.

What do you think?
Thanks for your comments!

[1] https://lore.kernel.org/lkml/20220815050815.22340-7-samuel@sholland.org

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-09-22  6:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21  7:46 Similar SoCs with different CPUs and interrupt bindings Geert Uytterhoeven
2022-09-21  8:49 ` Krzysztof Kozlowski
2022-09-21  9:20   ` Lad, Prabhakar
2022-09-21  9:26     ` Krzysztof Kozlowski
2022-09-21 10:07       ` Lad, Prabhakar
2022-09-21 10:08       ` Geert Uytterhoeven
2022-09-21 10:10         ` Krzysztof Kozlowski
2022-09-21 21:05         ` Conor Dooley
2022-09-21 10:14       ` Robin Murphy
2022-09-21 10:17         ` Krzysztof Kozlowski
2022-09-21 10:27           ` Robin Murphy
2022-09-21 10:10   ` Geert Uytterhoeven
2022-09-21  9:20 ` Robin Murphy
2022-09-21 10:13   ` Geert Uytterhoeven
2022-09-21 10:20     ` Krzysztof Kozlowski
2022-09-22  6:30   ` Arnd Bergmann
2022-09-22  6:40     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).