Resend [PATCH 00/10] ARM: SMP initialization consolidation
Subsystems (8)
From: Rob Herring <[email protected]>
Resending since the patches didn't make it thru the 1st time.
In order to avoid duplicating the same platform code yet again for a new platform, this series consolidates platforms using similar SMP startup code to a common implementation. A new kconfig entry SMP_COMMON_PEN is added for platforms using the common pen functions.
OMAP uses a h/w mechansism for its pen, but it seems like it could use the same mechansism.
Rob
Rob Herring (10):
ARM: move Versatile SMP pen code to common location
ARM: ux500: convert to use common secondary pen code
ARM: msm: use common secondary pen code
ARM: add common scu_init_cpus
ARM: omap: use common scu_init_cpus
ARM: realview: use common scu_init_cpus
ARM: vexpress: use common scu_init_cpus
ARM: ux500: use common scu_init_cpus
ARM: shmobile: use common scu_init_cpus
ARM: move set_cpu_present calls to common smp code
arch/arm/Kconfig | 8 ++ arch/arm/include/asm/smp.h | 4 + arch/arm/include/asm/smp_scu.h | 1 + arch/arm/kernel/Makefile | 3 +- arch/arm/kernel/headsmp.S | 40 ++++++++++ arch/arm/kernel/smp.c | 4 + arch/arm/kernel/smp_pen.c | 104 +++++++++++++++++++++++++ arch/arm/kernel/smp_scu.c | 19 +++++ arch/arm/mach-msm/Makefile | 2 +- arch/arm/mach-msm/headsmp.S | 40 ---------- arch/arm/mach-msm/platsmp.c | 84 +------------------- arch/arm/mach-omap2/omap-smp.c | 25 +------ arch/arm/mach-realview/include/mach/smp.h | 3 + arch/arm/mach-realview/platsmp.c | 30 +------- arch/arm/mach-shmobile/include/mach/common.h | 2 +- arch/arm/mach-shmobile/platsmp.c | 20 +----- arch/arm/mach-shmobile/smp-sh73a0.c | 6 +- arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/Makefile | 2 +- arch/arm/mach-ux500/headsmp.S | 37 --------- arch/arm/mach-ux500/include/mach/smp.h | 4 +- arch/arm/mach-ux500/platsmp.c | 105 +------------------------- arch/arm/mach-vexpress/ct-ca9x4.c | 9 +-- arch/arm/mach-vexpress/include/mach/smp.h | 3 + arch/arm/mach-vexpress/platsmp.c | 9 +-- arch/arm/plat-versatile/Makefile | 1 - arch/arm/plat-versatile/headsmp.S | 40 ---------- arch/arm/plat-versatile/platsmp.c | 104 ------------------------- 28 files changed, 210 insertions(+), 500 deletions(-) create mode 100644 arch/arm/kernel/headsmp.S create mode 100644 arch/arm/kernel/smp_pen.c delete mode 100644 arch/arm/mach-msm/headsmp.S delete mode 100644 arch/arm/mach-ux500/headsmp.S delete mode 100644 arch/arm/plat-versatile/headsmp.S delete mode 100644 arch/arm/plat-versatile/platsmp.c
PATCH 1/10 ARM: move Versatile SMP pen code to common location
From: Rob Herring <[email protected]>
The same secondary boot pen code is used by several platforms besides ARM Ltd boards, so move it to a shared location.
--- arch/arm/Kconfig | 7 ++ arch/arm/include/asm/smp.h | 4 + arch/arm/kernel/Makefile | 3 +- arch/arm/kernel/headsmp.S | 40 +++++++++++ arch/arm/kernel/smp_pen.c | 104 +++++++++++++++++++++++++++++ arch/arm/mach-realview/include/mach/smp.h | 3 + arch/arm/mach-realview/platsmp.c | 4 +- arch/arm/mach-vexpress/include/mach/smp.h | 3 + arch/arm/mach-vexpress/platsmp.c | 4 +- arch/arm/plat-versatile/Makefile | 1 - arch/arm/plat-versatile/headsmp.S | 40 ----------- arch/arm/plat-versatile/platsmp.c | 104 ----------------------------- 12 files changed, 165 insertions(+), 152 deletions(-) create mode 100644 arch/arm/kernel/headsmp.S create mode 100644 arch/arm/kernel/smp_pen.c delete mode 100644 arch/arm/plat-versatile/headsmp.S delete mode 100644 arch/arm/plat-versatile/platsmp.c
arch/arm/Kconfig +7 -0
@@ -1057,6 +1057,7 @@ config PLAT_PXA config PLAT_VERSATILE bool + select SMP_COMMON_PEN if SMP config ARM_TIMER_SP804 bool
@@ -1381,6 +1382,12 @@ config HAVE_ARM_SCU help This option enables support for the ARM system coherency unit +config SMP_COMMON_PEN + bool + depends on SMP + help + This option enables common secondary boot pen code. + config HAVE_ARM_TWD bool depends on SMP
arch/arm/include/asm/smp.h +4 -0
@@ -73,6 +73,10 @@ extern void platform_secondary_init(unsigned int cpu);*/ extern void platform_smp_prepare_cpus (unsigned int ); +extern void pen_secondary_init (unsigned int cpu); +extern int pen_boot_secondary (unsigned int cpu,struct task_struct *); +extern void pen_secondary_startup (void ); +/* * Initial data for bringing up a secondary CPU. */
arch/arm/kernel/Makefile +2 -1
@@ -23,7 +23,7 @@ obj-$(CONFIG_LEDS) += leds.o obj-$(CONFIG_OC_ETM) += etm.o obj-$(CONFIG_ISA_DMA_API) += dma.o -obj-$(CONFIG_ARCH_ACORN) += ecard.o +obj-$(CONFIG_ARCH_ACORN) += ecard.o obj-$(CONFIG_FIQ) += fiq.o obj-$(CONFIG_MODULES) += armksyms.o module.o obj-$(CONFIG_ARTHUR) += arthur.o
@@ -32,6 +32,7 @@ obj-$(CONFIG_PCI) += bios32.o isa.o obj-$(CONFIG_PM_SLEEP) += sleep.o obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o obj-$(CONFIG_SMP) += smp.o smp_tlb.o +obj-$(CONFIG_SMP_COMMON_PEN) += headsmp.o smp_pen.o obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
arch/arm/kernel/headsmp.S new file +40 -0
@@ -0,0 +1,40 @@ +/* + * linux/arch/arm/kernel/headsmp.S + * + * Copyright (c) 2003 ARM Limited + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/linkage.h> +#include <linux/init.h> + + __INIT + +/* + * Entry point for secondary CPUs. + * This provides a "holding pen" into which all secondary cores are held + * until we're ready for them to initialise. + */ +ENTRY(pen_secondary_startup) + mrc p15, 0, r0, c0, c0, 5 + and r0, r0, #15 + adr r4, 1f + ldmia r4, {r5, r6} + sub r4, r4, r5 + add r6, r6, r4 +pen: ldr r7, [r6] + cmp r7, r0 + bne pen + + /* + * we've been released from the holding pen: secondary_stack + * should now contain the SVC stack for this core + */ + b secondary_startup + + .align +1: .long . + .long pen_release
arch/arm/kernel/smp_pen.c new file +104 -0
104 lines not on this page · raw message
arch/arm/mach-realview/include/mach/smp.h +3 -0
@@ -3,6 +3,9 @@#include <asm/hardware/gic.h> +#define boot_secondary pen_boot_secondary +#define platform_secondary_init pen_secondary_init +/* * We use IRQ1 as the IPI */
arch/arm/mach-realview/platsmp.c +1 -3
@@ -24,8 +24,6 @@#include "core.h" -extern void versatile_secondary_startup (void ); -static void __iomem *scu_base_addr (void ) {if (machine_is_realview_eb_mp ())
@@ -82,6 +80,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)* until it receives a soft interrupt, and then the * secondary CPU branches to this address. */ -__raw_writel (BSYM (virt_to_phys (versatile_secondary_startup)), +__raw_writel (BSYM (virt_to_phys (pen_secondary_startup)),__io_address (REALVIEW_SYS_FLAGSSET )); }
arch/arm/mach-vexpress/include/mach/smp.h +3 -0
@@ -3,6 +3,9 @@#include <asm/hardware/gic.h> +#define boot_secondary pen_boot_secondary +#define platform_secondary_init pen_secondary_init +/* * We use IRQ1 as the IPI */
arch/arm/mach-vexpress/platsmp.c +1 -3
@@ -20,8 +20,6 @@#include "core.h" -extern void versatile_secondary_startup (void ); -/* * Initialise the CPU possible map early - this describes the CPUs * which may be present or become present in the system.
@@ -46,6 +44,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)* secondary CPU branches to this address. */ writel (~0 ,MMIO_P2V (V2M_SYS_FLAGSCLR )); -writel (BSYM (virt_to_phys (versatile_secondary_startup)), +writel (BSYM (virt_to_phys (pen_secondary_startup)),MMIO_P2V (V2M_SYS_FLAGSSET )); }
arch/arm/plat-versatile/Makefile +0 -1
@@ -3,4 +3,3 @@ obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o -obj-$(CONFIG_SMP) += headsmp.o platsmp.o
arch/arm/plat-versatile/headsmp.S deleted +0 -40
@@ -1,40 +0,0 @@ -/* - * linux/arch/arm/plat-versatile/headsmp.S - * - * Copyright (c) 2003 ARM Limited - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/linkage.h> -#include <linux/init.h> - - __INIT - -/* - * Realview/Versatile Express specific entry point for secondary CPUs. - * This provides a "holding pen" into which all secondary cores are held - * until we're ready for them to initialise. - */ -ENTRY(versatile_secondary_startup) - mrc p15, 0, r0, c0, c0, 5 - and r0, r0, #15 - adr r4, 1f - ldmia r4, {r5, r6} - sub r4, r4, r5 - add r6, r6, r4 -pen: ldr r7, [r6] - cmp r7, r0 - bne pen - - /* - * we've been released from the holding pen: secondary_stack - * should now contain the SVC stack for this core - */ - b secondary_startup - - .align -1: .long . - .long pen_release
arch/arm/plat-versatile/platsmp.c deleted +0 -104
104 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/10 ARM: ux500: convert to use common secondary pen code
In reply to Rob HerringFrom: Rob Herring <[email protected]>
--- arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/Makefile | 2 +- arch/arm/mach-ux500/headsmp.S | 37 --------------- arch/arm/mach-ux500/include/mach/smp.h | 4 +- arch/arm/mach-ux500/platsmp.c | 79 +------------------------------- 5 files changed, 5 insertions(+), 118 deletions(-) delete mode 100644 arch/arm/mach-ux500/headsmp.S
arch/arm/mach-ux500/Kconfig +1 -0
@@ -7,6 +7,7 @@ config UX500_SOC_COMMON select HAS_MTU select NOMADIK_GPIO select ARM_ERRATA_753970 + select SMP_COMMON_PEN if SMP menu "Ux500 SoC"
arch/arm/mach-ux500/Makefile +1 -1
@@ -12,7 +12,7 @@ obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ board-mop500-u8500uib.o \ board-mop500-pins.o obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o -obj-$(CONFIG_SMP) += platsmp.o headsmp.o +obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o
arch/arm/mach-ux500/headsmp.S deleted +0 -37
@@ -1,37 +0,0 @@ -/* - * Copyright (c) 2009 ST-Ericsson - * This file is based ARM Realview platform - * Copyright (c) 2003 ARM Limited - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/linkage.h> -#include <linux/init.h> - - __INIT - -/* - * U8500 specific entry point for secondary CPUs. - */ -ENTRY(u8500_secondary_startup) - mrc p15, 0, r0, c0, c0, 5 - and r0, r0, #15 - adr r4, 1f - ldmia r4, {r5, r6} - sub r4, r4, r5 - add r6, r6, r4 -pen: ldr r7, [r6] - cmp r7, r0 - bne pen - - /* - * we've been released from the holding pen: secondary_stack - * should now contain the SVC stack for this core - */ - b secondary_startup - -1: .long . - .long pen_release
arch/arm/mach-ux500/include/mach/smp.h +2 -2
@@ -11,8 +11,8 @@#include <asm/hardware/gic.h> -/* This is required to wakeup the secondary core */ -extern void u8500_secondary_startup (void ); +#define boot_secondary pen_boot_secondary +#define platform_secondary_init pen_secondary_init/* * We use IRQ1 as the IPI
arch/arm/mach-ux500/platsmp.c +1 -78
97 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 3/10 ARM: msm: use common secondary pen code
In reply to Rob HerringFrom: Rob Herring <[email protected]>
--- arch/arm/Kconfig | 1 + arch/arm/mach-msm/Makefile | 2 +- arch/arm/mach-msm/headsmp.S | 40 ----------------------- arch/arm/mach-msm/platsmp.c | 73 ++----------------------------------------- 4 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 arch/arm/mach-msm/headsmp.S
arch/arm/Kconfig +1 -0
@@ -647,6 +647,7 @@ config ARCH_MSM select GENERIC_CLOCKEVENTS select ARCH_REQUIRE_GPIOLIB select CLKDEV_LOOKUP + select SMP_COMMON_PEN if SMP help Support for Qualcomm MSM/QSD based systems. This runs on the apps processor of the MSM/QSD and depends on a shared memory
arch/arm/mach-msm/Makefile +1 -1
@@ -16,7 +16,7 @@ obj-$(CONFIG_MSM_SMD) += last_radio_log.o obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o -obj-$(CONFIG_SMP) += headsmp.o platsmp.o +obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o
arch/arm/mach-msm/headsmp.S deleted +0 -40
@@ -1,40 +0,0 @@ -/* - * linux/arch/arm/mach-realview/headsmp.S - * - * Copyright (c) 2003 ARM Limited - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/linkage.h> -#include <linux/init.h> - - __CPUINIT - -/* - * MSM specific entry point for secondary CPUs. This provides - * a "holding pen" into which all secondary cores are held until we're - * ready for them to initialise. - */ -ENTRY(msm_secondary_startup) - mrc p15, 0, r0, c0, c0, 5 - and r0, r0, #15 - adr r4, 1f - ldmia r4, {r5, r6} - sub r4, r4, r5 - add r6, r6, r4 -pen: ldr r7, [r6] - cmp r7, r0 - bne pen - - /* - * we've been released from the holding pen: secondary_stack - * should now contain the SVC stack for this core - */ - b secondary_startup - - .align -1: .long . - .long pen_release
arch/arm/mach-msm/platsmp.c +3 -70
95 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 4/10 ARM: add common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Cortex-A9 SCU based platforms use the same code for smp_init_cpus, so create a common implementation for systems with an SCU.
--- arch/arm/include/asm/smp_scu.h | 1 + arch/arm/kernel/smp_scu.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/include/asm/smp_scu.h +1 -0
@@ -7,6 +7,7 @@#ifndef __ASSEMBLER__unsigned int scu_get_core_count (void __iomem *); +void scu_init_cpus (void __iomem *);void scu_enable (void __iomem *);int scu_power_mode (void __iomem *,unsigned int );#endif
arch/arm/kernel/smp_scu.c +19 -0
@@ -29,6 +29,25 @@ unsigned int __init scu_get_core_count(void __iomem *scu_base)return (ncores &0x03 ) +1 ; } +void __init scu_init_cpus (void __iomem *scu_base) +{ +unsigned int i, ncores; + + ncores =scu_get_core_count (scu_base); + +/* sanity check */ +if (ncores >NR_CPUS ) { +printk (KERN_WARNING +"SCU: No. of cores (%d) greater than configured " +"maximum of %d - clipping\n" , + ncores,NR_CPUS ); + ncores =NR_CPUS ; + } + +for (i =0 ; i < ncores; i++) +set_cpu_possible (i, true); +} +/* * Enable the SCU */
Signature · 1 line
1.7.1
PATCH 5/10 ARM: omap: use common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert omap to use common scu_init_cpus function.
--- arch/arm/mach-omap2/omap-smp.c | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/omap-smp.c +1 -15
@@ -99,25 +99,11 @@ static void __init wakeup_secondary(void)*/ void __init smp_init_cpus (void ) { -unsigned int i, ncores; -/* Never released */ scu_base =ioremap (OMAP44XX_SCU_BASE ,SZ_256 );BUG_ON (!scu_base); - ncores =scu_get_core_count (scu_base); - -/* sanity check */ -if (ncores >NR_CPUS ) { -printk (KERN_WARNING -"OMAP4: no. of cores (%d) greater than configured " -"maximum of %d - clipping\n" , - ncores,NR_CPUS ); - ncores =NR_CPUS ; - } - -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); +scu_init_cpus (scu_base); }void __init platform_smp_prepare_cpus (unsigned int max_cpus)
Signature · 1 line
1.7.1
PATCH 6/10 ARM: realview: use common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert realview to use common scu_init_cpus function.
--- arch/arm/mach-realview/platsmp.c | 17 +---------------- 1 files changed, 1 insertions(+), 16 deletions(-)
arch/arm/mach-realview/platsmp.c +1 -16
@@ -43,22 +43,7 @@ static void __iomem *scu_base_addr(void)*/ void __init smp_init_cpus (void ) { -void __iomem *scu_base =scu_base_addr (); -unsigned int i, ncores; - - ncores = scu_base ?scu_get_core_count (scu_base) :1 ; - -/* sanity check */ -if (ncores >NR_CPUS ) { -printk (KERN_WARNING -"Realview: no. of cores (%d) greater than configured " -"maximum of %d - clipping\n" , - ncores,NR_CPUS ); - ncores =NR_CPUS ; - } - -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); +scu_init_cpus (scu_base_addr ()); }void __init platform_smp_prepare_cpus (unsigned int max_cpus)
Signature · 1 line
1.7.1
PATCH 7/10 ARM: vexpress: use common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert Versatile Express to use common scu_init_cpus function.
--- arch/arm/mach-vexpress/ct-ca9x4.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/arm/mach-vexpress/ct-ca9x4.c +1 -4
@@ -206,10 +206,7 @@ static void __init ct_ca9x4_init(void)#ifdef CONFIG_SMP static void ct_ca9x4_init_cpu_map (void ) { -int i, ncores =scu_get_core_count (MMIO_P2V (A9_MPCORE_SCU )); - -for (i =0 ; i < ncores; ++i) -set_cpu_possible (i, true); +scu_init_cpus (MMIO_P2V (A9_MPCORE_SCU )); }static void ct_ca9x4_smp_enable (unsigned int max_cpus)
Signature · 1 line
1.7.1
PATCH 8/10 ARM: ux500: use common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert ux500 to use common scu_init_cpus function.
--- arch/arm/mach-ux500/platsmp.c | 17 +---------------- 1 files changed, 1 insertions(+), 16 deletions(-)
arch/arm/mach-ux500/platsmp.c +1 -16
@@ -69,22 +69,7 @@ static void __init wakeup_secondary(void)*/ void __init smp_init_cpus (void ) { -void __iomem *scu_base =scu_base_addr (); -unsigned int i, ncores; - - ncores = scu_base ?scu_get_core_count (scu_base) :1 ; - -/* sanity check */ -if (ncores >NR_CPUS ) { -printk (KERN_WARNING -"U8500: no. of cores (%d) greater than configured " -"maximum of %d - clipping\n" , - ncores,NR_CPUS ); - ncores =NR_CPUS ; - } - -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); +scu_init_cpus (scu_base_addr ()); }void __init platform_smp_prepare_cpus (unsigned int max_cpus)
Signature · 1 line
1.7.1
PATCH 9/10 ARM: shmobile: use common scu_init_cpus
In reply to Rob HerringFrom: Rob Herring <[email protected]>
Convert shmobile to use common scu_init_cpus function.
--- arch/arm/mach-shmobile/include/mach/common.h | 2 +- arch/arm/mach-shmobile/platsmp.c | 15 ++------------- arch/arm/mach-shmobile/smp-sh73a0.c | 6 ++---- 3 files changed, 5 insertions(+), 18 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +1 -1
@@ -41,7 +41,7 @@ extern void sh73a0_pinmux_init(void);extern struct clk sh73a0_extal1_clk;extern struct clk sh73a0_extal2_clk; -extern unsigned int sh73a0_get_core_count (void ); +extern void sh73a0_smp_init_cpus (void );extern void sh73a0_secondary_init (unsigned int cpu);extern int sh73a0_boot_secondary (unsigned int cpu);extern void sh73a0_smp_prepare_cpus (void );
arch/arm/mach-shmobile/platsmp.c +2 -13
@@ -20,14 +20,6 @@#include <asm/mach-types.h> #include <mach/common.h> -static unsigned int __init shmobile_smp_get_core_count (void ) -{ -if (machine_is_ag5evm ()) -return sh73a0_get_core_count (); - -return 1 ; -} -static void __init shmobile_smp_prepare_cpus (void ) {if (machine_is_ag5evm ())
@@ -52,11 +44,8 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)void __init smp_init_cpus (void ) { -unsigned int ncores =shmobile_smp_get_core_count (); -unsigned int i; - -for (i =0 ; i < ncores; i++) -set_cpu_possible (i, true); +if (machine_is_ag5evm ()) +sh73a0_smp_init_cpus (); }void __init platform_smp_prepare_cpus (unsigned int max_cpus)
arch/arm/mach-shmobile/smp-sh73a0.c +2 -4
@@ -55,11 +55,9 @@ static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)__raw_writel (tmp, scu_base +8 ); } -unsigned int __init sh73a0_get_core_count (void ) +void __init sh73a0_smp_init_cpus (void ) { -void __iomem *scu_base =scu_base_addr (); - -return scu_get_core_count (scu_base); +scu_init_cpus (scu_base_addr ()); }void __cpuinit sh73a0_secondary_init (unsigned int cpu)
Signature · 1 line
1.7.1
PATCH 10/10 ARM: move set_cpu_present calls to common smp code
In reply to Rob HerringFrom: Rob Herring <[email protected]>
All platforms do the same thing and mark all cores present, so move this to common smp init code. A platform can still override this and mark a core not present if that is ever desired.
--- arch/arm/kernel/smp.c | 4 ++++ arch/arm/mach-msm/platsmp.c | 11 +---------- arch/arm/mach-omap2/omap-smp.c | 9 --------- arch/arm/mach-realview/platsmp.c | 9 --------- arch/arm/mach-shmobile/platsmp.c | 5 ----- arch/arm/mach-ux500/platsmp.c | 9 --------- arch/arm/mach-vexpress/ct-ca9x4.c | 4 ---- arch/arm/mach-vexpress/platsmp.c | 5 +---- 8 files changed, 6 insertions(+), 50 deletions(-)
arch/arm/kernel/smp.c +4 -0
@@ -351,6 +351,7 @@ void __init smp_prepare_boot_cpu(void)void __init smp_prepare_cpus (unsigned int max_cpus) { +int i;unsigned int ncores =num_possible_cpus ();smp_store_cpu_info (smp_processor_id ());
@@ -361,6 +362,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)if (max_cpus > ncores) max_cpus = ncores; +for (i =0 ; i < max_cpus; i++) +set_cpu_present (i, true); +if (max_cpus >1 ) {/* * Enable the local timer or broadcast device for the
arch/arm/mach-msm/platsmp.c +1 -10
@@ -87,13 +87,4 @@ void __init smp_init_cpus(void) }void __init platform_smp_prepare_cpus (unsigned int max_cpus) -{ -int i; - -/* -* Initialise the present map, which describes the set of CPUs -* actually populated at the present time. -*/ -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -} +{}
arch/arm/mach-omap2/omap-smp.c +0 -9
@@ -108,15 +108,6 @@ void __init smp_init_cpus(void)void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -int i; - -/* -* Initialise the present map, which describes the set of CPUs -* actually populated at the present time. -*/ -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -/* * Initialise the SCU and wake up the secondary core using * wakeup_secondary().
arch/arm/mach-realview/platsmp.c +0 -9
@@ -48,15 +48,6 @@ void __init smp_init_cpus(void)void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -int i; - -/* -* Initialise the present map, which describes the set of CPUs -* actually populated at the present time. -*/ -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -scu_enable (scu_base_addr ());/*
arch/arm/mach-shmobile/platsmp.c +0 -5
@@ -50,10 +50,5 @@ void __init smp_init_cpus(void)void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -int i; - -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -shmobile_smp_prepare_cpus (); }
arch/arm/mach-ux500/platsmp.c +0 -9
@@ -74,15 +74,6 @@ void __init smp_init_cpus(void)void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -int i; - -/* -* Initialise the present map, which describes the set of CPUs -* actually populated at the present time. -*/ -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -scu_enable (scu_base_addr ());wakeup_secondary (); }
arch/arm/mach-vexpress/ct-ca9x4.c +0 -4
@@ -211,10 +211,6 @@ static void ct_ca9x4_init_cpu_map(void)static void ct_ca9x4_smp_enable (unsigned int max_cpus) { -int i; -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); -scu_enable (MMIO_P2V (A9_MPCORE_SCU )); }#endif
arch/arm/mach-vexpress/platsmp.c +1 -4
@@ -31,10 +31,7 @@ void __init smp_init_cpus(void)void __init platform_smp_prepare_cpus (unsigned int max_cpus) { -/* -* Initialise the present map, which describes the set of CPUs -* actually populated@the present time. -*/ +/* Enable the SCU */ ct_desc->smp_enable (max_cpus);/*
Signature · 1 line
1.7.1
Quoted 11 lines · Rob Herring
From: Rob Herring <[email protected]>
Resending since the patches didn't make it thru the 1st time.
In order to avoid duplicating the same platform code yet again for a new platform, this series consolidates platforms using similar SMP startup code to a common implementation. A new kconfig entry
SMP_COMMON_PENis added for platforms using the common pen functions.OMAP uses a h/w mechansism for its pen, but it seems like it could use the same mechansism.
Have you seen Russell's response to similar attempts posted a few months back?
https://lkml.org/lkml/2010/11/30/243
and
http://lists.linaro.org/pipermail/linaro-dev/2010-November/001663.html
Just something to look over and consider.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 10 lines · Stephen Boyd
Have you seen Russell's response to similar attempts posted a few months back?
https://lkml.org/lkml/2010/11/30/243
and
http://lists.linaro.org/pipermail/linaro-dev/2010-November/001663.html
Just something to look over and consider.
I know of one SoC which has three cores on it, where two are optimized for performance and one for low power. They're all connected to the SCU, and so are visible as three symetric CPUs.
Such a SoC may wish to do things differently from the current approach (which is basically bring up all cores at boot) particularly as the performance gained from each CPU is far from identical. So I've been nervous about moving the CPU map initialization into core code.
Note that the low power CPU may not be the last in the set, so merely limiting the system to two CPUs is not the answer.
Quoted 7 lines · Russell King - ARM Linux
Such a SoC may wish to do things differently from the current approach (which is basically bring up all cores at boot) particularly as the performance gained from each CPU is far from identical. So I've been nervous about moving the CPU map initialization into core code.
Note that the low power CPU may not be the last in the set, so merely limiting the system to two CPUs is not the answer.
If I read the patches correctly, it's still strictly opt-in per platform. When a platform wants to support the setup you mentioned or something even stranger, all it would have to do is provide its own versions of the SMP pen and scu init function, right?
Arnd
Quoted 10 lines · Arnd Bergmann
Quoted 7 lines · Russell King - ARM Linux
Such a SoC may wish to do things differently from the current approach (which is basically bring up all cores at boot) particularly as the performance gained from each CPU is far from identical. So I've been nervous about moving the CPU map initialization into core code.
Note that the low power CPU may not be the last in the set, so merely limiting the system to two CPUs is not the answer.
If I read the patches correctly, it's still strictly opt-in per platform.
Except where things are moved into the generic code, such as the setting of present CPUs.
Quoted 3 lines
When a platform wants to support the setup you mentioned or something even stranger, all it would have to do is provide its own versions of the SMP pen and scu init function, right?
No.
As I've already said in the past, I doubt that very many platforms actually need the SMP pen stuff. There are two situations where you need that:
1. If you have more than two CPUs, _and_ you have no way to control which of those CPUs are triggered to jump into the kernel.
2. If you have hotplug and you have no way to power down or reset the CPUs.
There seems to be few platforms which fall into (1) - most SMP implementations are based around two CPUs today so if you only have one secondary CPU, there's no point triggering it via a soft irq to enter the kernel, then hold it in a pen, then release it from the pen, etc.
Those which seem to fall into (2) do so because they've cut'n'pasted the code from the Realview platforms, along with its bugs with the auxillary control register, which subseqently get tweaked.
My feeling is that most of the hotplug implementations are just basic "this seems to approximately work" kind of things rather than someone taking a look at what the hardware supports and doing something more useful (such as powering down the CPU, placing it in reset, etc.)
However, (2) is dependent on (1) as both share pen_release. (2) needs to be sorted by platforms before the (1) can be eliminated from platform code.
I'd much rather see the pen_release stuff being eliminated from platforms where it's not necessary, rather than being turned into a generic thing which everyone uses because its there. Not only should this simplify the code, but also reduce the size of the platform SMP support code.
Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Russell King - ARM Linux
Such a SoC may wish to do things differently from the current approach (which is basically bring up all cores at boot) particularly as the performance gained from each CPU is far from identical. So I've been nervous about moving the CPU map initialization into core code.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Note that the low power CPU may not be the last in the set, so merely limiting the system to two CPUs is not the answer.
If I read the patches correctly, it's still strictly opt-in per platform.
Except where things are moved into the generic code, such as the setting of present CPUs.
Is there any harm in making the default be mark all cores present then let the platform code clear the present state if so desired? This was my intention.
Quoted 29 lines
Quoted 4 lines
When a platform wants to support the setup you mentioned or something even stranger, all it would have to do is provide its own versions of the SMP pen and scu init function, right?
No.
As I've already said in the past, I doubt that very many platforms actually need the SMP pen stuff. There are two situations where you need that:
1. If you have more than two CPUs, _and_ you have no way to control which of those CPUs are triggered to jump into the kernel.
2. If you have hotplug and you have no way to power down or reset the CPUs.There seems to be few platforms which fall into (1) - most SMP implementations are based around two CPUs today so if you only have one secondary CPU, there's no point triggering it via a soft irq to enter the kernel, then hold it in a pen, then release it from the pen, etc.
Those which seem to fall into (2) do so because they've cut'n'pasted the code from the Realview platforms, along with its bugs with the auxillary control register, which subseqently get tweaked.
My feeling is that most of the hotplug implementations are just basic "this seems to approximately work" kind of things rather than someone taking a look at what the hardware supports and doing something more useful (such as powering down the CPU, placing it in reset, etc.)
Quoted 8 lines
However, (2) is dependent on (1) as both share
pen_release. (2) needs to be sorted by platforms before the (1) can be eliminated from platform code.I'd much rather see the
pen_releasestuff being eliminated from platforms where it's not necessary, rather than being turned into a generic thing which everyone uses because its there. Not only should this simplify the code, but also reduce the size of the platform SMP support code.
Thanks for the explanation. I now see that for my case I won't need the pen code at all.
What about the scu_init_cpus patch? You posted something similar as Stephen pointed out that I had missed. Do you plan to merge that?
Rob