diff mbox

[U-Boot,v3,04/13] sunxi: simplify ACTLR.SMP bit set #ifdef

Message ID 1485912970-7567-5-git-send-email-andre.przywara@arm.com
State Accepted
Commit 85db5831ad4b62719775ff0fd0918a944755b967
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Andre Przywara Feb. 1, 2017, 1:36 a.m. UTC
Instead of enumerating all SoC families that need that bit set, let's
just express this more clearly: The SMP bits needs to be set on
SMP capable ARMv7 CPUs. It's much easier in Kconfig to express it the
other way round, so we use ! CPU_IS_UP and ! ARM64.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/Kconfig            | 4 ++++
 arch/arm/mach-sunxi/board.c | 5 +----
 board/sunxi/Kconfig         | 2 ++
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Jagan Teki Feb. 3, 2017, 10:52 a.m. UTC | #1
On Wed, Feb 1, 2017 at 2:36 AM, Andre Przywara <andre.przywara@arm.com> wrote:
> Instead of enumerating all SoC families that need that bit set, let's
> just express this more clearly: The SMP bits needs to be set on
> SMP capable ARMv7 CPUs. It's much easier in Kconfig to express it the
> other way round, so we use ! CPU_IS_UP and ! ARM64.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  arch/arm/Kconfig            | 4 ++++
>  arch/arm/mach-sunxi/board.c | 5 +----
>  board/sunxi/Kconfig         | 2 ++
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc36723..98791c0 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -126,6 +126,10 @@ config ENABLE_ARM_SOC_BOOT0_HOOK
>           ARM_SOC_BOOT0_HOOK which contains the required assembler
>           preprocessor code.
>
> +config ARM_CORTEX_CPU_IS_UP
> +       bool
> +       default n

Better to place this in sunxi, since no other code using this expect
sunxi and the name CORTEX may also refer arm64 use something 32
related.

thanks!
Andre Przywara Feb. 6, 2017, 11:29 a.m. UTC | #2
Hi,

On 03/02/17 10:52, Jagan Teki wrote:
> On Wed, Feb 1, 2017 at 2:36 AM, Andre Przywara <andre.przywara@arm.com> wrote:
>> Instead of enumerating all SoC families that need that bit set, let's
>> just express this more clearly: The SMP bits needs to be set on
>> SMP capable ARMv7 CPUs. It's much easier in Kconfig to express it the
>> other way round, so we use ! CPU_IS_UP and ! ARM64.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>>  arch/arm/Kconfig            | 4 ++++
>>  arch/arm/mach-sunxi/board.c | 5 +----
>>  board/sunxi/Kconfig         | 2 ++
>>  3 files changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index fc36723..98791c0 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -126,6 +126,10 @@ config ENABLE_ARM_SOC_BOOT0_HOOK
>>           ARM_SOC_BOOT0_HOOK which contains the required assembler
>>           preprocessor code.
>>
>> +config ARM_CORTEX_CPU_IS_UP
>> +       bool
>> +       default n
> 
> Better to place this in sunxi, since no other code using this expect
> sunxi and the name CORTEX may also refer arm64 use something 32
> related.

Sigh, can you please check back with Maxime on what's the right thing here?
http://lists.denx.de/pipermail/u-boot/2017-January/279417.html

If it's about the name, shall we use ARM_CORTEX_V7_CPU_IS_UP?

I was briefly tempted to unify all ACTLR.SMP bit sets from all over the
ARM code, but this looks like a can of worms to me, so I'd rather keep
this one closed.

Cheers,
Andre.
Maxime Ripard Feb. 7, 2017, 3:22 p.m. UTC | #3
On Mon, Feb 06, 2017 at 11:29:26AM +0000, Andre Przywara wrote:
> Hi,
> 
> On 03/02/17 10:52, Jagan Teki wrote:
> > On Wed, Feb 1, 2017 at 2:36 AM, Andre Przywara <andre.przywara@arm.com> wrote:
> >> Instead of enumerating all SoC families that need that bit set, let's
> >> just express this more clearly: The SMP bits needs to be set on
> >> SMP capable ARMv7 CPUs. It's much easier in Kconfig to express it the
> >> other way round, so we use ! CPU_IS_UP and ! ARM64.
> >>
> >> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> >> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> >> ---
> >>  arch/arm/Kconfig            | 4 ++++
> >>  arch/arm/mach-sunxi/board.c | 5 +----
> >>  board/sunxi/Kconfig         | 2 ++
> >>  3 files changed, 7 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> >> index fc36723..98791c0 100644
> >> --- a/arch/arm/Kconfig
> >> +++ b/arch/arm/Kconfig
> >> @@ -126,6 +126,10 @@ config ENABLE_ARM_SOC_BOOT0_HOOK
> >>           ARM_SOC_BOOT0_HOOK which contains the required assembler
> >>           preprocessor code.
> >>
> >> +config ARM_CORTEX_CPU_IS_UP
> >> +       bool
> >> +       default n
> > 
> > Better to place this in sunxi, since no other code using this expect
> > sunxi and the name CORTEX may also refer arm64 use something 32
> > related.
> 
> Sigh, can you please check back with Maxime on what's the right thing here?
> http://lists.denx.de/pipermail/u-boot/2017-January/279417.html
> 
> If it's about the name, shall we use ARM_CORTEX_V7_CPU_IS_UP?
> 
> I was briefly tempted to unify all ACTLR.SMP bit sets from all over the
> ARM code, but this looks like a can of worms to me, so I'd rather keep
> this one closed.

There's at least one other SoC in a similar situation (imx7 solo), so
I think it should really be made generic. I don't really care about
the name though, but keeping it in sunxi is just creating yet another
candidate for a duplicated and redundant option.

Maxime
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc36723..98791c0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -126,6 +126,10 @@  config ENABLE_ARM_SOC_BOOT0_HOOK
 	  ARM_SOC_BOOT0_HOOK which contains the required assembler
 	  preprocessor code.
 
+config ARM_CORTEX_CPU_IS_UP
+	bool
+	default n
+
 config USE_ARCH_MEMCPY
 	bool "Use an assembly optimized implementation of memcpy"
 	default y
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 58fbacb..fdcf68e 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -180,10 +180,7 @@  void s_init(void)
 	/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */
 #endif
 
-#if defined CONFIG_MACH_SUN6I || \
-    defined CONFIG_MACH_SUN7I || \
-    defined CONFIG_MACH_SUN8I || \
-    defined CONFIG_MACH_SUN9I
+#if !defined(CONFIG_ARM_CORTEX_CPU_IS_UP) && !defined(CONFIG_ARM64)
 	/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
 	asm volatile(
 		"mrc p15, 0, r0, c1, c0, 1\n"
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 37b4252..ea0d658 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -50,12 +50,14 @@  choice
 config MACH_SUN4I
 	bool "sun4i (Allwinner A10)"
 	select CPU_V7
+	select ARM_CORTEX_CPU_IS_UP
 	select SUNXI_GEN_SUN4I
 	select SUPPORT_SPL
 
 config MACH_SUN5I
 	bool "sun5i (Allwinner A13)"
 	select CPU_V7
+	select ARM_CORTEX_CPU_IS_UP
 	select SUNXI_GEN_SUN4I
 	select SUPPORT_SPL