ARM: shmobile: SMP virt_to_phys() conversion
Magnus Damm
maintainercover ARM: shmobile: SMP virt_to_phys() conversion
ARM: shmobile: SMP virt_to_phys() conversion
[PATCH 01/06] ARM: shmobile: Add SMP boot function and argument [PATCH 02/06] ARM: shmobile: Add SCU boot function using argument [PATCH 03/06] ARM: shmobile: r8a7779 SMP with SCU boot fn and args [PATCH 04/06] ARM: shmobile: sh73a0 SMP with SCU boot fn and args [PATCH 05/06] ARM: shmobile: EMEV2 SMP with SCU boot fn and args [PATCH 06/06] ARM: shmobile: Remove old SCU boot code
This series replaces the inline virtual to physical address conversion code in the mach-shmobile assembly files with C code making use of virt_to_phys().
This is one of several series of code that rework code not to rely on CONFIG_MEMORY_START/SIZE which in turn is needed for ARCH_MULTIPLATFORM.
---
Written against renesas.git renesas-next-20130607
arch/arm/mach-shmobile/headsmp-scu.S | 35 ++++++++++---------------- arch/arm/mach-shmobile/headsmp.S | 13 +++++++-- arch/arm/mach-shmobile/include/mach/common.h | 6 ++-- arch/arm/mach-shmobile/smp-emev2.c | 6 ++-- arch/arm/mach-shmobile/smp-r8a7779.c | 6 ++-- arch/arm/mach-shmobile/smp-sh73a0.c | 6 ++-- 6 files changed, 40 insertions(+), 32 deletions(-)
Magnus Damm
maintainerPATCH 1/6 ARM: shmobile: Add SMP boot function and argument
From: Magnus Damm <[email protected]>
Add code for mach-shmobile to allow specifying boot function and argument. Will initially be used for SMP together with SCU but may in the future also be used for deep sleep resume. This patch removes one inline virtual to physical address conversion.
---
arch/arm/mach-shmobile/headsmp.S | 13 ++++++++++--- arch/arm/mach-shmobile/include/mach/common.h | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-)
arch/arm/mach-shmobile/headsmp.S +10 -3
@@ -27,7 +27,14 @@ ENDPROC(shmobile_invalidate_start) * We need _long_ jump to the physical address. */ .align 12 -ENTRY(shmobile_secondary_vector) +ENTRY(shmobile_boot_vector) + ldr r0, 2f ldr pc, 1f -1: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET -ENDPROC(shmobile_secondary_vector) +ENDPROC(shmobile_boot_vector) + + .globl shmobile_boot_fn +shmobile_boot_fn: +1: .space 4 + .globl shmobile_boot_arg +shmobile_boot_arg: +2: .space 4
arch/arm/mach-shmobile/include/mach/common.h +3 -1
@@ -7,7 +7,9 @@ extern void shmobile_setup_delay(unsigne unsigned int mult, unsigned int div);struct twd_local_timer ;extern void shmobile_setup_console (void ); -extern void shmobile_secondary_vector (void ); +extern void shmobile_boot_vector (void ); +extern unsigned long shmobile_boot_fn; +extern unsigned long shmobile_boot_arg;extern void shmobile_secondary_vector_scu (void );struct clk ;extern int shmobile_clk_init (void );
Magnus Damm
maintainerPATCH 2/6 ARM: shmobile: Add SCU boot function using argument
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Add a shmoible_boot_scu function that assumes that the base address of the SCU is passed in r0. This code is free from inline virtual to physical address conversion.
---
arch/arm/mach-shmobile/headsmp-scu.S | 13 +++++++++++++ arch/arm/mach-shmobile/include/mach/common.h | 1 + 2 files changed, 14 insertions(+)
arch/arm/mach-shmobile/headsmp-scu.S +13 -0
@@ -51,6 +51,19 @@ ENTRY(shmobile_secondary_vector_scu) 2: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET ENDPROC(shmobile_secondary_vector_scu) +ENTRY(shmobile_boot_scu) + @ r0 = SCU base address + mrc p15, 0, r1, c0, c0, 5 @ read MIPDR + and r1, r1, #3 @ mask out cpu ID + lsl r1, r1, #3 @ we will shift by cpu_id * 8 bits + ldr r2, [r0, #8] @ SCU Power Status Register + mov r3, #3 + bic r2, r2, r3, lsl r1 @ Clear bits of our CPU (Run Mode) + str r2, [r0, #8] @ write back + + b shmobile_invalidate_start +ENDPROC(shmobile_boot_scu) + .text .globl shmobile_scu_base shmobile_scu_base:
arch/arm/mach-shmobile/include/mach/common.h +1 -0
@@ -11,6 +11,7 @@ extern void shmobile_boot_vector(void);extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_arg;extern void shmobile_secondary_vector_scu (void ); +extern void shmobile_boot_scu (void );struct clk ;extern int shmobile_clk_init (void );extern void shmobile_handle_irq_intc (struct pt_regs *);
Magnus Damm
maintainerPATCH 3/6 ARM: shmobile: r8a7779 SMP with SCU boot fn and args
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Let r8a7779 make use of shmobile_boot_fn and shmobile_boot_arg together with shmobile_boot_scu and the SCU base address.
---
arch/arm/mach-shmobile/smp-r8a7779.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/smp-r8a7779.c +4 -2
@@ -101,8 +101,10 @@ static void __init r8a7779_smp_prepare_c {scu_enable (shmobile_scu_base); -/* Map the reset vector (in headsmp-scu.S) */ -__raw_writel (__pa (shmobile_secondary_vector_scu),AVECR ); +/* Map the reset vector (in headsmp-scu.S, headsmp.S) */ +__raw_writel (__pa (shmobile_boot_vector),AVECR ); + shmobile_boot_fn =virt_to_phys (shmobile_boot_scu); + shmobile_boot_arg = (unsigned long )shmobile_scu_base;/* enable cache coherency on booting CPU */ scu_power_mode (shmobile_scu_base,SCU_PM_NORMAL );
Magnus Damm
maintainerPATCH 4/6 ARM: shmobile: sh73a0 SMP with SCU boot fn and args
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Let sh73a0 make use of shmobile_boot_fn and shmobile_boot_arg together with shmobile_boot_scu and the SCU base address.
---
arch/arm/mach-shmobile/smp-sh73a0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/smp-sh73a0.c +4 -2
@@ -64,9 +64,11 @@ static void __init sh73a0_smp_prepare_cp {scu_enable (shmobile_scu_base); -/* Map the reset vector (in headsmp-scu.S) */ +/* Map the reset vector (in headsmp-scu.S, headsmp.S) */ __raw_writel (0 ,APARMBAREA );/* 4k */ -__raw_writel (__pa (shmobile_secondary_vector_scu),SBAR ); +__raw_writel (__pa (shmobile_boot_vector),SBAR ); + shmobile_boot_fn =virt_to_phys (shmobile_boot_scu); + shmobile_boot_arg = (unsigned long )shmobile_scu_base;/* enable cache coherency on booting CPU */ scu_power_mode (shmobile_scu_base,SCU_PM_NORMAL );
Magnus Damm
maintainerPATCH 5/6 ARM: shmobile: EMEV2 SMP with SCU boot fn and args
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Let EMEV2 make use of shmobile_boot_fn and shmobile_boot_arg together with shmobile_boot_scu and the SCU base address.
---
arch/arm/mach-shmobile/smp-emev2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +4 -2
@@ -40,8 +40,10 @@ static void __init emev2_smp_prepare_cpu {scu_enable (shmobile_scu_base); -/* Tell ROM loader about our vector (in headsmp-scu.S) */ -emev2_set_boot_vector (__pa (shmobile_secondary_vector_scu)); +/* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */ +emev2_set_boot_vector (__pa (shmobile_boot_vector)); + shmobile_boot_fn =virt_to_phys (shmobile_boot_scu); + shmobile_boot_arg = (unsigned long )shmobile_scu_base;/* enable cache coherency on booting CPU */ scu_power_mode (shmobile_scu_base,SCU_PM_NORMAL );
Magnus Damm
maintainerPATCH 6/6 ARM: shmobile: Remove old SCU boot code
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Remove shmobile_secondary_vector_scu now when all SCU enabled SMP platforms instead make use of shmobile_boot_scu. This removes two inline virtual to physical address conversions.
---
arch/arm/mach-shmobile/headsmp-scu.S | 22 +--------------------- arch/arm/mach-shmobile/include/mach/common.h | 1 - 2 files changed, 1 insertion(+), 22 deletions(-)
arch/arm/mach-shmobile/headsmp-scu.S +1 -21
@@ -25,32 +25,12 @@ __CPUINIT /* - * Reset vector for secondary CPUs. + * Boot code for secondary CPUs. * * First we turn on L1 cache coherency for our CPU. Then we jump to * shmobile_invalidate_start that invalidates the cache and hands over control * to the common ARM startup code. - * This function will be mapped to address 0 by the SBAR register. - * A normal branch is out of range here so we need a long jump. We jump to - * the physical address as the MMU is still turned off. */ - .align 12 -ENTRY(shmobile_secondary_vector_scu) - mrc p15, 0, r0, c0, c0, 5 @ read MIPDR - and r0, r0, #3 @ mask out cpu ID - lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits - ldr r1, 2f - ldr r1, [r1] @ SCU base address - ldr r2, [r1, #8] @ SCU Power Status Register - mov r3, #3 - bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) - str r2, [r1, #8] @ write back - - ldr pc, 1f -1: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET -2: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET -ENDPROC(shmobile_secondary_vector_scu) - ENTRY(shmobile_boot_scu) @ r0 = SCU base address mrc p15, 0, r1, c0, c0, 5 @ read MIPDR
arch/arm/mach-shmobile/include/mach/common.h +0 -1
@@ -10,7 +10,6 @@ extern void shmobile_setup_console(void)extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_arg; -extern void shmobile_secondary_vector_scu (void );extern void shmobile_boot_scu (void );struct clk ;extern int shmobile_clk_init (void );
PATCH 1/6 ARM: shmobile: Add SMP boot function and argument
In reply to Magnus DammQuoted 7 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add code for mach-shmobile to allow specifying boot function and argument. Will initially be used for SMP together with SCU but may in the future also be used for deep sleep resume. This patch removes one inline virtual to physical address conversion.
Quoted 6 lines
Signed-off-by Magnus Damm <[email protected]>---
arch/arm/mach-shmobile/headsmp.S | 13 ++++++++++--- arch/arm/mach-shmobile/include/mach/common.h | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-)
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.
PATCH 2/6 ARM: shmobile: Add SCU boot function using argument
In reply to Magnus DammQuoted 6 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add a
shmoible_boot_scufunction that assumes that the base address of the SCU is passed in r0. This code is free from inline virtual to physical address conversion.
Quoted 6 lines
Signed-off-by Magnus Damm <[email protected]>---
arch/arm/mach-shmobile/headsmp-scu.S | 13 +++++++++++++ arch/arm/mach-shmobile/include/mach/common.h | 1 + 2 files changed, 14 insertions(+)
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.
PATCH 3/6 ARM: shmobile: r8a7779 SMP with SCU boot fn and args
In reply to Magnus DammQuoted 4 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Let r8a7779 make use of
shmobile_boot_fnandshmobile_boot_argtogether withshmobile_boot_scuand the SCU base address.
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.
PATCH 4/6 ARM: shmobile: sh73a0 SMP with SCU boot fn and args
In reply to Magnus DammQuoted 10 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Let sh73a0 make use of
shmobile_boot_fnandshmobile_boot_argtogether withshmobile_boot_scuand the SCU base address.Signed-off-by Magnus Damm <[email protected]>---
arch/arm/mach-shmobile/smp-sh73a0.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.
PATCH 5/6 ARM: shmobile: EMEV2 SMP with SCU boot fn and args
In reply to Magnus DammQuoted 10 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Let EMEV2 make use of
shmobile_boot_fnandshmobile_boot_argtogether withshmobile_boot_scuand the SCU base address.Signed-off-by Magnus Damm <[email protected]>---
arch/arm/mach-shmobile/smp-emev2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.
PATCH 6/6 ARM: shmobile: Remove old SCU boot code
In reply to Magnus DammQuoted 6 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Remove
shmobile_secondary_vector_scunow when all SCU enabled SMP platforms instead make use ofshmobile_boot_scu. This removes two inline virtual to physical address conversions.
Quoted 6 lines
Signed-off-by Magnus Damm <[email protected]>---
arch/arm/mach-shmobile/headsmp-scu.S | 22 +--------------------- arch/arm/mach-shmobile/include/mach/common.h | 1 - 2 files changed, 1 insertion(+), 22 deletions(-)
Thanks, I have queued this up for v3.11 in the (new) cleanup-boot branch.