Skip to contentSkip to conversation

arc: Rework Kconfig choice menus

PATCH In review Tom Rini 2 participants 5 messages Mar 15, 2025 – Mar 18, 2025 Synopsys ARC architecture

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 arc: Rework Kconfig choice menus

Currently we get a number of warnings about using "select" statements on "choice" options and that this as no effect. Rework some of these so that we use "depends on" rather than select for the CPU, and have the CPU select the MMU version. The MMU version is no longer prompted for.

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

---
 arch/arc/Kconfig | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/arc/Kconfig +6 -16
index 6ae66bb163c0..be9774dc2896 100644
@@ -66,28 +66,20 @@ config CPU_ARCHS38
 
 endchoice
 
-choice
-	prompt "MMU Version"
-	default ARC_MMU_V3 if CPU_ARC770D
-	default ARC_MMU_V2 if CPU_ARC750D
-	default ARC_MMU_ABSENT if CPU_ARCEM6
-	default ARC_MMU_ABSENT if CPU_ARCHS36
-	default ARC_MMU_V4 if CPU_ARCHS38
-
 config ARC_MMU_ABSENT
-	bool "No MMU"
+	bool
 	help
 	  No MMU
 
 config ARC_MMU_V2
-	bool "MMU v2"
+	bool
 	depends on CPU_ARC750D
 	help
 	  Fixed the deficiency of v1 - possible thrashing in memcpy sceanrio
 	  when 2 D-TLB and 1 I-TLB entries index into same 2way set.
 
 config ARC_MMU_V3
-	bool "MMU v3"
+	bool
 	depends on CPU_ARC770D
 	help
 	  Introduced with ARC700 4.10: New Features
@@ -95,13 +87,11 @@ config ARC_MMU_V3
 	  Shared Address Spaces (SASID)
 
 config ARC_MMU_V4
-	bool "MMU v4"
+	bool
 	depends on CPU_ARCHS38
 	help
 	  Introduced as a part of ARC HS38 release.
 
-endchoice
-
 config ARC_MMU_VER
 	int
 	default 0 if ARC_MMU_ABSENT
@@ -172,14 +162,14 @@ config TARGET_AXS103
 
 config TARGET_EMSDP
 	bool "Synopsys EM Software Development Platform"
-	select CPU_ARCEM6
+	depends on CPU_ARCEM6
 
 config TARGET_HSDK
 	bool "Support Synopsys HSDK or HSDK-4xD board"
 
 config TARGET_IOT_DEVKIT
 	bool "Synopsys Brite IoT Development kit"
-	select CPU_ARCEM6
+	depends on CPU_ARCEM6
 
 endchoice
 
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 arc: Migrate to SYS_{BIG,LITTLE}_ENDIAN fully

With the way we now prompt for big or little endian support, the "select ... if ..." portion of the ARC symbol doesn't work as intended. But now that we do have a globally visible prompt for big or little, switch to using that fully instead of a custom symbol.

Fixes cbef295441b4 ("Kconfig: Unify endian support option")

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

---
 arch/Kconfig                  | 2 --
 arch/arc/Kconfig              | 5 -----
 configs/nsim_700be_defconfig  | 2 +-
 configs/nsim_hs38be_defconfig | 2 +-
 4 files changed, 2 insertions(+), 9 deletions(-)
arch/Kconfig +0 -2
index 35b19f9bfdca..e5a003d1ddc4 100644
@@ -82,8 +82,6 @@ config ARC
 	select TIMER
 	select SUPPORT_BIG_ENDIAN
 	select SUPPORT_LITTLE_ENDIAN
-	select SYS_BIG_ENDIAN if CPU_BIG_ENDIAN
-	select SYS_LITTLE_ENDIAN if !CPU_BIG_ENDIAN
 
 config ARM
 	bool "ARM architecture"
arch/arc/Kconfig +0 -5
index be9774dc2896..ab90aa90e8ae 100644
@@ -99,11 +99,6 @@ config ARC_MMU_VER
 	default 3 if ARC_MMU_V3
 	default 4 if ARC_MMU_V4
 
-config CPU_BIG_ENDIAN
-	bool "Enable Big Endian Mode"
-	help
-	  Build kernel for Big Endian Mode of ARC CPU
-
 config SYS_ICACHE_OFF
 	bool "Do not enable icache"
 	help
configs/nsim_700be_defconfig +1 -1
index 4832195f6b47..f51d17516550 100644
@@ -1,5 +1,4 @@
 CONFIG_ARC=y
-CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_TARGET_NSIM=y
 CONFIG_NSIM_BOARD_CPPFLAGS="-mcpu=arc700 -mlock -mswape"
 CONFIG_TEXT_BASE=0x81000000
@@ -14,6 +13,7 @@ CONFIG_DEBUG_UART_BASE=0xf0000000
 CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEBUG_UART=y
+CONFIG_SYS_BIG_ENDIAN=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200n8"
configs/nsim_hs38be_defconfig +1 -1
index 67de123d16bb..3ae76cd140bb 100644
@@ -1,6 +1,5 @@
 CONFIG_ARC=y
 CONFIG_ISA_ARCV2=y
-CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_TARGET_NSIM=y
 CONFIG_NSIM_BOARD_CPPFLAGS="-mcpu=archs"
 CONFIG_TEXT_BASE=0x81000000
@@ -15,6 +14,7 @@ CONFIG_DEBUG_UART_BASE=0xf0000000
 CONFIG_DEBUG_UART_CLOCK=70000000
 CONFIG_SYS_CLK_FREQ=70000000
 CONFIG_DEBUG_UART=y
+CONFIG_SYS_BIG_ENDIAN=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200n8"
Signature · 1 line
2.43.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] arc: Migrate to SYS_{BIG,LITTLE}_ENDIAN fully

Hi Tom,

Quoted 11 lines

With the way we now prompt for big or little endian support, the "select ... if ..." portion of the ARC symbol doesn't work as intended. But now that we do have a globally visible prompt for big or little, switch to using that fully instead of a custom symbol.

Fixes cbef295441b4 ("Kconfig: Unify endian support option")

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

Thanks a lot for that wery much needed fix for ARC!

#3 lore raw
In reply to Tom Rini

Hi Tom,

Quoted 4 lines

Currently we get a number of warnings about using "select" statements on "choice" options and that this as no effect. Rework some of these so that we use "depends on" rather than select for the CPU, and have the CPU select the MMU version. The MMU version is no longer prompted for.

Thanks a lot for these fixes.

I'm wondering though if these warnings only have started to appear recently, i.e. how come we haven't notice them before?

Quoted 14 lines

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

---
 arch/arc/Kconfig | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/arc/Kconfig +0 -0
index 6ae66bb163c0..be9774dc2896 100644

arch/arc/Kconfig config CPU_ARCHS38 · line 75

Quoted 10 lines
arch/arc/Kconfig +0 -7
@@ -66,28 +66,20 @@ config CPU_ARCHS38
 
 endchoice
 
-choice
-       prompt "MMU Version"
-       default ARC_MMU_V3 if CPU_ARC770D
-       default ARC_MMU_V2 if CPU_ARC750D
-       default ARC_MMU_ABSENT if CPU_ARCEM6
-       default ARC_MMU_ABSENT if CPU_ARCHS36
-       default ARC_MMU_V4 if CPU_ARCHS38

Well, here the idea was that some users may want to override MMU settings for their particular SoC/design. See ARC cores are very configurable and it's possible to mix and match certain components.

For example, it's possible to start from a full-blown ARC770 and deconfigure MMU from it, effectively getting something like ARC725, but not exactly as some other properties of ARC770 will still be in place as opposed to a true ARC725.

Thus we used to have a "default" which comes with a particular template (ARC770D for example) with ability to override it.

arch/arc/Kconfig config CPU_ARCHS38 · line 70

Quoted 3 lines
arch/arc/Kconfig +1 -1
 config ARC_MMU_ABSENT
-       bool "No MMU"
+       bool

I thought that comment of these "bool" values will be seen in "menuconfig" GUI helping a user to see what's that...

[snip]

arch/arc/Kconfig config TARGET_AXS103 · line 165

Quoted 9 lines
arch/arc/Kconfig +1 -1
 config ARC_MMU_VER
         int
         default 0 if ARC_MMU_ABSENT
@@ -172,14 +162,14 @@ config TARGET_AXS103
 
 config TARGET_EMSDP
         bool "Synopsys EM Software Development Platform"
-       select CPU_ARCEM6
+       depends on CPU_ARCEM6

Here we had "select" because this particualr board (EM Software Development Platform) does come with ARC EM6 CPU, and so I though that selection of the board enforces use of the processor. But maybe I'm wrong here i nhow that's meant to be implemented properly.

-Alexey
________________________________
From: Tom Rini <[email protected]>
Sent: Saturday, March 15, 2025 1:29 AM
To: [email protected] <[email protected]>
Cc: Alexey Brodkin <[email protected]>; Eugeniy Paltsev <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH 1/2] arc: Rework Kconfig choice menus

Currently we get a number of warnings about using "select" statements on "choice" options and that this as no effect. Rework some of these so that we use "depends on" rather than select for the CPU, and have the CPU select the MMU version. The MMU version is no longer prompted for.

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

---
 arch/arc/Kconfig | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/arc/Kconfig +6 -16
index 6ae66bb163c0..be9774dc2896 100644
@@ -66,28 +66,20 @@ config CPU_ARCHS38
 
 endchoice
 
-choice
-       prompt "MMU Version"
-       default ARC_MMU_V3 if CPU_ARC770D
-       default ARC_MMU_V2 if CPU_ARC750D
-       default ARC_MMU_ABSENT if CPU_ARCEM6
-       default ARC_MMU_ABSENT if CPU_ARCHS36
-       default ARC_MMU_V4 if CPU_ARCHS38
-
 config ARC_MMU_ABSENT
-       bool "No MMU"
+       bool
         help
           No MMU
 
 config ARC_MMU_V2
-       bool "MMU v2"
+       bool
         depends on CPU_ARC750D
         help
           Fixed the deficiency of v1 - possible thrashing in memcpy sceanrio
           when 2 D-TLB and 1 I-TLB entries index into same 2way set.
 
 config ARC_MMU_V3
-       bool "MMU v3"
+       bool
         depends on CPU_ARC770D
         help
           Introduced with ARC700 4.10: New Features
@@ -95,13 +87,11 @@ config ARC_MMU_V3
           Shared Address Spaces (SASID)
 
 config ARC_MMU_V4
-       bool "MMU v4"
+       bool
         depends on CPU_ARCHS38
         help
           Introduced as a part of ARC HS38 release.
 
-endchoice
-
 config ARC_MMU_VER
         int
         default 0 if ARC_MMU_ABSENT
@@ -172,14 +162,14 @@ config TARGET_AXS103
 
 config TARGET_EMSDP
         bool "Synopsys EM Software Development Platform"
-       select CPU_ARCEM6
+       depends on CPU_ARCEM6
 
 config TARGET_HSDK
         bool "Support Synopsys HSDK or HSDK-4xD board"
 
 config TARGET_IOT_DEVKIT
         bool "Synopsys Brite IoT Development kit"
-       select CPU_ARCEM6
+       depends on CPU_ARCEM6
 
 endchoice
 

--
2.43.0

author
#4 lore raw
Quoted 11 lines · Alexey Brodkin

Hi Tom,

Quoted 4 lines

Currently we get a number of warnings about using "select" statements on "choice" options and that this as no effect. Rework some of these so that we use "depends on" rather than select for the CPU, and have the CPU select the MMU version. The MMU version is no longer prompted for.

Thanks a lot for these fixes.

I'm wondering though if these warnings only have started to appear recently, i.e. how come we haven't notice them before?

They've always existed, it's just that you need to run a Kconfig linting tool to get them. We have one (which can be invoked two ways) and it's a bit verbose and notes many things as possible issues, rather than definitively something as an issue.

Quoted 51 lines
Quoted 14 lines

---
Cc: Alexey Brodkin <[email protected]>
Cc: Eugeniy Paltsev <[email protected]>
Cc: [email protected]

---
 arch/arc/Kconfig | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/arc/Kconfig +0 -0
index 6ae66bb163c0..be9774dc2896 100644

arch/arc/Kconfig config CPU_ARCHS38 · line 75

Quoted 10 lines
arch/arc/Kconfig +0 -7
@@ -66,28 +66,20 @@ config CPU_ARCHS38
 
 endchoice
 
-choice
-       prompt "MMU Version"
-       default ARC_MMU_V3 if CPU_ARC770D
-       default ARC_MMU_V2 if CPU_ARC750D
-       default ARC_MMU_ABSENT if CPU_ARCEM6
-       default ARC_MMU_ABSENT if CPU_ARCHS36
-       default ARC_MMU_V4 if CPU_ARCHS38

Well, here the idea was that some users may want to override MMU settings for their particular SoC/design. See ARC cores are very configurable and it's possible to mix and match certain components.

For example, it's possible to start from a full-blown ARC770 and deconfigure MMU from it, effectively getting something like ARC725, but not exactly as some other properties of ARC770 will still be in place as opposed to a true ARC725.

Thus we used to have a "default" which comes with a particular template (ARC770D for example) with ability to override it.

arch/arc/Kconfig config CPU_ARCHS38 · line 70

Quoted 3 lines
arch/arc/Kconfig +1 -1
 config ARC_MMU_ABSENT
-       bool "No MMU"
+       bool

I thought that comment of these "bool" values will be seen in "menuconfig" GUI helping a user to see what's that...

[snip]

Quoted 5 lines
arch/arc/Kconfig +0 -0
 config ARC_MMU_VER
         int
         default 0 if ARC_MMU_ABSENT
@@ -172,14 +162,14 @@ config TARGET_AXS103
 
Quoted 9 lines

arch/arc/Kconfig config TARGET_AXS103 · line 165

Quoted 4 lines
arch/arc/Kconfig +1 -1
 config TARGET_EMSDP
         bool "Synopsys EM Software Development Platform"
-       select CPU_ARCEM6
+       depends on CPU_ARCEM6

Here we had "select" because this particualr board (EM Software Development Platform) does come with ARC EM6 CPU, and so I though that selection of the board enforces use of the processor. But maybe I'm wrong here i nhow that's meant to be implemented properly.

So, with more details on what the intention was I need to think harder about what to suggest as a fix. The good news at least is that for this patch, doing nothing won't change the behavior we have today.

It might just be that we drop the select/imply statements, except for TARGET_EMSDP which requires thinking harder still, and expand the help texts.

Signature · 1 line
Tom