diff mbox

[44/62] ARM: integrator: refine CPU selection

Message ID 1395257399-359545-45-git-send-email-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann March 19, 2014, 7:29 p.m. UTC
This adds a new Kconfig option for the Integrator platform to
choose between ARMv4/ARMv5 based CPUs and those based on ARMv6/ARMv7,
which is required because we cannot have both classes enabled in the
same kernel at compile time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-integrator/Kconfig | 11 +++++++++++
 arch/arm/mm/Kconfig              | 28 ++++++++++++++--------------
 2 files changed, 25 insertions(+), 14 deletions(-)

Comments

Russell King - ARM Linux March 19, 2014, 8:49 p.m. UTC | #1
On Wed, Mar 19, 2014 at 08:29:41PM +0100, Arnd Bergmann wrote:
> This adds a new Kconfig option for the Integrator platform to
> choose between ARMv4/ARMv5 based CPUs and those based on ARMv6/ARMv7,
> which is required because we cannot have both classes enabled in the
> same kernel at compile time.

Wouldn't it just be easier to make the older CPUs depend on
!CPU_V6 && !CPU_V7 rather than trying to hack this for each platform?
Arnd Bergmann March 19, 2014, 9:05 p.m. UTC | #2
On Wednesday 19 March 2014 20:49:47 Russell King - ARM Linux wrote:
> On Wed, Mar 19, 2014 at 08:29:41PM +0100, Arnd Bergmann wrote:
> > This adds a new Kconfig option for the Integrator platform to
> > choose between ARMv4/ARMv5 based CPUs and those based on ARMv6/ARMv7,
> > which is required because we cannot have both classes enabled in the
> > same kernel at compile time.
> 
> Wouldn't it just be easier to make the older CPUs depend on
> !CPU_V6 && !CPU_V7 rather than trying to hack this for each platform?

It's only two platforms: integrator and realview. Actually I took two
different approaches on these, and wanted to make up my mind first
which one is better. Any suggestion?

I have a mild preference to always using 'select' on the CPU_* symbol
from the platform, mostly for consistency. The downside is that it
gets a little messy for Integrator, but that's just one platform in
the end.

At some point, I think I got into circular dependencies when one CPU
depended on another one being disabled, but I don't remember exactly
what case that was.

	Arnd
Arnd Bergmann March 20, 2014, 10:48 a.m. UTC | #3
On Wednesday 19 March 2014, Arnd Bergmann wrote:
> On Wednesday 19 March 2014 20:49:47 Russell King - ARM Linux wrote:
> > On Wed, Mar 19, 2014 at 08:29:41PM +0100, Arnd Bergmann wrote:
> > > This adds a new Kconfig option for the Integrator platform to
> > > choose between ARMv4/ARMv5 based CPUs and those based on ARMv6/ARMv7,
> > > which is required because we cannot have both classes enabled in the
> > > same kernel at compile time.
> > 
> > Wouldn't it just be easier to make the older CPUs depend on
> > !CPU_V6 && !CPU_V7 rather than trying to hack this for each platform?
> 
> It's only two platforms: integrator and realview. Actually I took two
> different approaches on these, and wanted to make up my mind first
> which one is better. Any suggestion?
> 
> I have a mild preference to always using 'select' on the CPU_* symbol
> from the platform, mostly for consistency. The downside is that it
> gets a little messy for Integrator, but that's just one platform in
> the end.
> 
> At some point, I think I got into circular dependencies when one CPU
> depended on another one being disabled, but I don't remember exactly
> what case that was.
> 

Nevermind, I'll drop this patch for now, I just had an idea to do it
better: Since Linus and I are trying to get Integrator and Realview
moved over into ARCH_MULTIPLATFORM anyway, I'll defer the CPU selection
question until that's done.

Within ARCH_MULTIPLATFORM, we already want to deal with booting machines
that are described entirely in DT and have no platform specific code,
but we also want to be able to select the CPU types built into the
kernel for them.

For the v6/v6k/v7 selection, we can do this through the top-level
multiplatform options we already have, as we don't expose the
differences between the individual core implementations for the most
part. We can potentially leave PJ4 and PJ4B as user-selectable.

For the v4/v4t/v5 selection, I would allow any CPU to be manually
enabled with a dependency on the ARCH_MULTI_V* option. Platforms
that know what they have should obviously keep selecting the one
they want. I would leave strongarm and xscale out of the selection,
because I don't expect any platform based on those cores to ever
become enabled for ARCH_MULTIPLATFORM, but all the others should
be selectable.

For the moment, I'll keep using my patches locally in order to
keep randconfig building, and I'll follow up with a new patch
after integrator and realview are part of multiplatform. That
may take a while, but I'm sure we'll get there eventually.

	Arnd
Linus Walleij March 25, 2014, 8:34 p.m. UTC | #4
On Thu, Mar 20, 2014 at 11:48 AM, Arnd Bergmann <arnd@arndb.de> wrote:

> Nevermind, I'll drop this patch for now, I just had an idea to do it
> better: Since Linus and I are trying to get Integrator and Realview
> moved over into ARCH_MULTIPLATFORM anyway, I'll defer the CPU selection
> question until that's done.

Integrator is blocked by one single thing: <mach/memory.h>
bus_to_virt/virt_to_bus.

If we can get some consensus on Santosh's patches
(or however we want to solve that) I'll do multiplatform for
Integrator any day.

Yours,
Linus Walleij
Arnd Bergmann March 25, 2014, 11:42 p.m. UTC | #5
On Tuesday 25 March 2014 21:34:21 Linus Walleij wrote:
> On Thu, Mar 20, 2014 at 11:48 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > Nevermind, I'll drop this patch for now, I just had an idea to do it
> > better: Since Linus and I are trying to get Integrator and Realview
> > moved over into ARCH_MULTIPLATFORM anyway, I'll defer the CPU selection
> > question until that's done.
> 
> Integrator is blocked by one single thing: <mach/memory.h>
> bus_to_virt/virt_to_bus.
> 
> If we can get some consensus on Santosh's patches
> (or however we want to solve that) I'll do multiplatform for
> Integrator any day.

Yes, I know. My point is that once the two are multiplatform, we wouldn't
do the CPU selection patches like this anymore. Instead, I would just do

config CPU_ARM920T
	bool "Support ARM920T processor" if ARCH_MULTI_V4T
	...

config CPU_ARM926T
	bool "Support ARM920T processor" if ARCH_MULTI_V5
	...

...

In a multiplatform kernel, there is nothing wrong with just letting
users turn on arbitrary combinations of CPUs as long as they are
compatible at run-time (i.e. not v5+v7 combined). This will also let
you run qemu images using the MACH_VIRT target and any CPU emulation.

Of course, most platforms will still select the CPUs they actually
use, but you can always add more.

	Arnd
Linus Walleij March 26, 2014, 10:27 a.m. UTC | #6
On Wed, Mar 26, 2014 at 12:42 AM, Arnd Bergmann <arnd@arndb.de> wrote:

> My point is that once the two are multiplatform, we wouldn't
> do the CPU selection patches like this anymore. Instead, I would just do
>
> config CPU_ARM920T
>         bool "Support ARM920T processor" if ARCH_MULTI_V4T
>         ...
>
> config CPU_ARM926T
>         bool "Support ARM920T processor" if ARCH_MULTI_V5
>         ...

Ah I see, that's elegant. Yes let's go for this.

Yours,
Linus Walleij
diff mbox

Patch

diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index ba43321..8c797e77 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -2,6 +2,17 @@  if ARCH_INTEGRATOR
 
 menu "Integrator Options"
 
+choice
+	prompt "CPU architecture level"
+
+config ARCH_INTEGRATOR_V4_V5
+	bool "ARMv4 or ARMv5 CPUs"
+
+config ARCH_INTEGRATOR_V6_V7
+	bool "ARMv6 or ARMv7 CPUs"
+
+endchoice
+
 config ARCH_INTEGRATOR_AP
 	bool "Support Integrator/AP and Integrator/PP2 platforms"
 	select CLKSRC_MMIO
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 8c94496..af76df4 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -21,7 +21,7 @@  config CPU_ARM7TDMI
 
 # ARM720T
 config CPU_ARM720T
-	bool "Support ARM720T processor" if ARCH_INTEGRATOR
+	bool "Support ARM720T processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v4T
 	select CPU_ABRT_LV4T
 	select CPU_CACHE_V4
@@ -39,7 +39,7 @@  config CPU_ARM720T
 
 # ARM740T
 config CPU_ARM740T
-	bool "Support ARM740T processor" if ARCH_INTEGRATOR
+	bool "Support ARM740T processor" if ARCH_INTEGRATOR_V4_V5
 	depends on !MMU
 	select CPU_32v4T
 	select CPU_ABRT_LV4T
@@ -71,7 +71,7 @@  config CPU_ARM9TDMI
 
 # ARM920T
 config CPU_ARM920T
-	bool "Support ARM920T processor" if ARCH_INTEGRATOR
+	bool "Support ARM920T processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v4T
 	select CPU_ABRT_EV4T
 	select CPU_CACHE_V4WT
@@ -89,7 +89,7 @@  config CPU_ARM920T
 
 # ARM922T
 config CPU_ARM922T
-	bool "Support ARM922T processor" if ARCH_INTEGRATOR
+	bool "Support ARM922T processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v4T
 	select CPU_ABRT_EV4T
 	select CPU_CACHE_V4WT
@@ -127,7 +127,7 @@  config CPU_ARM925T
 
 # ARM926T
 config CPU_ARM926T
-	bool "Support ARM926T processor" if ARCH_INTEGRATOR
+	bool "Support ARM926T processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v5
 	select CPU_ABRT_EV5TJ
 	select CPU_CACHE_VIVT
@@ -163,7 +163,7 @@  config CPU_FA526
 
 # ARM940T
 config CPU_ARM940T
-	bool "Support ARM940T processor" if ARCH_INTEGRATOR
+	bool "Support ARM940T processor" if ARCH_INTEGRATOR_V4_V5
 	depends on !MMU
 	select CPU_32v4T
 	select CPU_ABRT_NOMMU
@@ -181,7 +181,7 @@  config CPU_ARM940T
 
 # ARM946E-S
 config CPU_ARM946E
-	bool "Support ARM946E-S processor" if ARCH_INTEGRATOR
+	bool "Support ARM946E-S processor" if ARCH_INTEGRATOR_V4_V5
 	depends on !MMU
 	select CPU_32v5
 	select CPU_ABRT_NOMMU
@@ -198,7 +198,7 @@  config CPU_ARM946E
 
 # ARM1020 - needs validating
 config CPU_ARM1020
-	bool "Support ARM1020T (rev 0) processor" if ARCH_INTEGRATOR
+	bool "Support ARM1020T (rev 0) processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v5
 	select CPU_ABRT_EV4T
 	select CPU_CACHE_V4WT
@@ -216,7 +216,7 @@  config CPU_ARM1020
 
 # ARM1020E - needs validating
 config CPU_ARM1020E
-	bool "Support ARM1020E processor" if ARCH_INTEGRATOR
+	bool "Support ARM1020E processor" if ARCH_INTEGRATOR_V4_V5
 	depends on n
 	select CPU_32v5
 	select CPU_ABRT_EV4T
@@ -229,7 +229,7 @@  config CPU_ARM1020E
 
 # ARM1022E
 config CPU_ARM1022
-	bool "Support ARM1022E processor" if ARCH_INTEGRATOR
+	bool "Support ARM1022E processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v5
 	select CPU_ABRT_EV4T
 	select CPU_CACHE_VIVT
@@ -247,7 +247,7 @@  config CPU_ARM1022
 
 # ARM1026EJ-S
 config CPU_ARM1026
-	bool "Support ARM1026EJ-S processor" if ARCH_INTEGRATOR
+	bool "Support ARM1026EJ-S processor" if ARCH_INTEGRATOR_V4_V5
 	select CPU_32v5
 	select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10
 	select CPU_CACHE_VIVT
@@ -358,7 +358,7 @@  config CPU_PJ4B
 
 # ARMv6
 config CPU_V6
-	bool "Support ARM V6 processor" if ARCH_INTEGRATOR
+	bool "Support ARM V6 processor" if ARCH_INTEGRATOR_V6_V7
 	select CPU_32v6
 	select CPU_ABRT_EV6
 	select CPU_CACHE_V6
@@ -371,7 +371,7 @@  config CPU_V6
 
 # ARMv6k
 config CPU_V6K
-	bool "Support ARM V6K processor" if ARCH_INTEGRATOR
+	bool "Support ARM V6K processor" if ARCH_INTEGRATOR_V6_V7
 	select CPU_32v6
 	select CPU_32v6K
 	select CPU_ABRT_EV6
@@ -385,7 +385,7 @@  config CPU_V6K
 
 # ARMv7
 config CPU_V7
-	bool "Support ARM V7 processor" if ARCH_INTEGRATOR
+	bool "Support ARM V7 processor" if ARCH_INTEGRATOR_V6_V7
 	select CPU_32v6K
 	select CPU_32v7
 	select CPU_ABRT_EV7