diff mbox series

[RFC,1/3] ARM: Introduce ARM_SINGLE_ARMV7R for ARMv7-R platforms

Message ID 20220630083641.21835-2-vladimir.murzin@arm.com (mailing list archive)
State New, archived
Headers show
Series ARM: Support Cortex-R platform(s) | expand

Commit Message

Vladimir Murzin June 30, 2022, 8:36 a.m. UTC
Similar to ARM_SINGLE_ARMV7M introduce the new config symbol
ARM_SINGLE_ARMV7R which groups config symbols required by ARMv7-R (and
above) platforms.

This would allow supporting multiple ARMv7-R platforms in one kernel
image. However, to be bootable such kernel image requires to share the
same main memory layout.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/Kconfig          | 19 ++++++++++++++++++-
 arch/arm/Kconfig.debug    |  6 ++++--
 arch/arm/Makefile         |  2 ++
 arch/arm/kernel/devtree.c |  3 ++-
 4 files changed, 26 insertions(+), 4 deletions(-)

Comments

Arnd Bergmann June 30, 2022, 9:22 a.m. UTC | #1
On Thu, Jun 30, 2022 at 10:36 AM Vladimir Murzin
<vladimir.murzin@arm.com> wrote:
>  config ARM_SINGLE_ARMV7M
> -       def_bool !MMU
> +       bool "ARM Cortex-M based platforms"
>         select ARM_NVIC
>         select AUTO_ZRELADDR
>         select TIMER_OF
> @@ -315,6 +320,18 @@ config ARM_SINGLE_ARMV7M
>         select SPARSE_IRQ
>         select USE_OF
>
> +config ARM_SINGLE_ARMV7R
> +       bool "ARM Cortex-R based platforms"
> +       select AUTO_ZRELADDR
> +       select TIMER_OF
> +       select COMMON_CLK
> +       select CPU_V7
> +       select NO_IOPORT_MAP
> +       select SPARSE_IRQ
> +       select USE_OF
> +

I was actually hoping to eventually kill off the
ARM_SINGLE_ARMV7M and ARCH_MULTIPLATFORM symbols
and just select the other symbols from CONFIG_ARM directly, like

        select SPARSE_IRQ if !ARCH_RPC
        select TIMER_OF if OF
        select USE_OF if !(CPU_SA110 || CPU_SA1100)
        select COMMON_CLK if !(ARCH_FOOTBRIDGE || ARCH_RPC)
        ...

That can of course be done independently from your series, but
it looks like ARM_SINGLE_ARMV7M and ARM_SINGLE_ARMV7R
are mostly the same here, except for the ARM_NVIC selects that
could be done by the platforms, and the CPU_V7/CPU_V7M
difference that could be folded into the CPU selection menu.

       Arnd
Vladimir Murzin July 1, 2022, 9:22 a.m. UTC | #2
On 6/30/22 10:22, Arnd Bergmann wrote:
> On Thu, Jun 30, 2022 at 10:36 AM Vladimir Murzin
> <vladimir.murzin@arm.com> wrote:
>>  config ARM_SINGLE_ARMV7M
>> -       def_bool !MMU
>> +       bool "ARM Cortex-M based platforms"
>>         select ARM_NVIC
>>         select AUTO_ZRELADDR
>>         select TIMER_OF
>> @@ -315,6 +320,18 @@ config ARM_SINGLE_ARMV7M
>>         select SPARSE_IRQ
>>         select USE_OF
>>
>> +config ARM_SINGLE_ARMV7R
>> +       bool "ARM Cortex-R based platforms"
>> +       select AUTO_ZRELADDR
>> +       select TIMER_OF
>> +       select COMMON_CLK
>> +       select CPU_V7
>> +       select NO_IOPORT_MAP
>> +       select SPARSE_IRQ
>> +       select USE_OF
>> +
> 
> I was actually hoping to eventually kill off the
> ARM_SINGLE_ARMV7M and ARCH_MULTIPLATFORM symbols
> and just select the other symbols from CONFIG_ARM directly, like
> 
>         select SPARSE_IRQ if !ARCH_RPC
>         select TIMER_OF if OF
>         select USE_OF if !(CPU_SA110 || CPU_SA1100)
>         select COMMON_CLK if !(ARCH_FOOTBRIDGE || ARCH_RPC)
>         ...
> 
> That can of course be done independently from your series, but
> it looks like ARM_SINGLE_ARMV7M and ARM_SINGLE_ARMV7R
> are mostly the same here, except for the ARM_NVIC selects that
> could be done by the platforms, and the CPU_V7/CPU_V7M
> difference that could be folded into the CPU selection menu.
> 

That sounds interesting! Moving NVIC into platforms looks straightforward,
yet CPU selection would require some surgery:
 - CPU_V7/CPU_V7M are not user selectable at the moment
 - We still need some hint from the platform if it supports more
   than one CPU variant, no?

Cheers
Vladimir

>        Arnd
Arnd Bergmann July 1, 2022, 11:24 a.m. UTC | #3
On Fri, Jul 1, 2022 at 11:22 AM Vladimir Murzin <vladimir.murzin@arm.com> wrote:
> On 6/30/22 10:22, Arnd Bergmann wrote:
> > On Thu, Jun 30, 2022 at 10:36 AM Vladimir Murzin
> >         ...
> >
> > That can of course be done independently from your series, but
> > it looks like ARM_SINGLE_ARMV7M and ARM_SINGLE_ARMV7R
> > are mostly the same here, except for the ARM_NVIC selects that
> > could be done by the platforms, and the CPU_V7/CPU_V7M
> > difference that could be folded into the CPU selection menu.
> >
>
> That sounds interesting! Moving NVIC into platforms looks straightforward,
> yet CPU selection would require some surgery:
>  - CPU_V7/CPU_V7M are not user selectable at the moment
>  - We still need some hint from the platform if it supports more
>    than one CPU variant, no?

Right, the two options still need to be visible somewhere. An obvious
place for this would be the CPU architecture select that currently
depends on ARCH_MULTIPLATFORM and contains the choice
between V4/v4TV5/V6/V6K/V7 but could be extended to cover
V7M and V7R, as well as possibly being extended to V7VE and
V8. I would also consider turning this into a 'choice' list where you
only pick the minimum CPU type, so e.g. enabling V6K lets you
pick V6K/V7/V7VE/V8 based machines but not
V4/V4T/V5/V6/V7M/V7R.

       Arnd
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7630ba9cb6cc..0dda6523724d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -304,8 +304,13 @@  config MMU
 	  Select if you want MMU-based virtualised addressing space
 	  support by paged memory management. If unsure, say 'Y'.
 
+choice
+	prompt "ARM system type"
+	depends on !MMU
+	default ARM_SINGLE_ARMV7M
+
 config ARM_SINGLE_ARMV7M
-	def_bool !MMU
+       bool "ARM Cortex-M based platforms"
 	select ARM_NVIC
 	select AUTO_ZRELADDR
 	select TIMER_OF
@@ -315,6 +320,18 @@  config ARM_SINGLE_ARMV7M
 	select SPARSE_IRQ
 	select USE_OF
 
+config ARM_SINGLE_ARMV7R
+       bool "ARM Cortex-R based platforms"
+	select AUTO_ZRELADDR
+	select TIMER_OF
+	select COMMON_CLK
+	select CPU_V7
+	select NO_IOPORT_MAP
+	select SPARSE_IRQ
+	select USE_OF
+
+endchoice
+
 config ARCH_MMAP_RND_BITS_MIN
 	default 8
 
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9b0aa4822d69..832d624203b8 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1904,7 +1904,8 @@  config DEBUG_UART_8250_PALMCHIP
 
 config DEBUG_UNCOMPRESS
 	bool "Enable decompressor debugging via DEBUG_LL output"
-	depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M
+	depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M || \
+		   ARM_SINGLE_ARMV7R
 	depends on DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \
 		     (!DEBUG_TEGRA_UART || !ZBOOT_ROM) && \
 		     !DEBUG_BRCMSTB_UART && !DEBUG_SEMIHOSTING
@@ -1922,7 +1923,8 @@  config DEBUG_UNCOMPRESS
 config UNCOMPRESS_INCLUDE
 	string
 	default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \
-					PLAT_SAMSUNG || ARM_SINGLE_ARMV7M
+					PLAT_SAMSUNG || ARM_SINGLE_ARMV7M || \
+					ARM_SINGLE_ARMV7R
 	default "mach/uncompress.h"
 
 config EARLY_PRINTK
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c8e3633f5434..985df6b00b49 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -245,9 +245,11 @@  platdirs := $(patsubst %,arch/arm/plat-%/,$(sort $(plat-y)))
 
 ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
 ifneq ($(CONFIG_ARM_SINGLE_ARMV7M),y)
+ifneq ($(CONFIG_ARM_SINGLE_ARMV7R),y)
 KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
 endif
 endif
+endif
 
 export	TEXT_OFFSET GZFLAGS MMUEXT
 
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 02839d8b6202..ce2c67c9301e 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -194,7 +194,8 @@  const struct machine_desc * __init setup_machine_fdt(void *dt_virt)
 {
 	const struct machine_desc *mdesc, *mdesc_best = NULL;
 
-#if defined(CONFIG_ARCH_MULTIPLATFORM) || defined(CONFIG_ARM_SINGLE_ARMV7M)
+#if defined(CONFIG_ARCH_MULTIPLATFORM) || defined(CONFIG_ARM_SINGLE_ARMV7M) || \
+    defined(CONFIG_ARM_SINGLE_ARMV7R)
 	DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
 		.l2c_aux_val = 0x0,
 		.l2c_aux_mask = ~0x0,