* [PATCH 0/2] Add code to release secondary cores from holding pen. @ 2015-06-08 16:16 Peter Griffin [not found] ` <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Peter Griffin @ 2015-06-08 16:16 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o, srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w Cc: peter.griffin-QSEj5FYQhm4dnm+yROfE0A, lee.jones-QSEj5FYQhm4dnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA Hi Maxime, This patchset adds in the necessary code to manage the holding pen for STi platforms. Due to all the STi upstream devs using JTAG to boot the STi boards, there is currently a SMP bug when booting upstream kernels via u-boot where only the primary core is brought up. This hasn't been noticed until now because when booting via JTAG the stlinux_arm_boot script sets the PC of the secondary cores directly. I can't test this on a STiH418 platform, as I don't have one, but a similar DT change will be required there as well. I'm not sure if u-boot uses the same SBC DMEM offset by default or not. With these patches applied booting via u-boot now works correctly. [ 0.045456] CPU: Testing write buffer coherency: ok [ 0.045597] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.045734] Setting up static identity map for 0x40209000 - 0x40209098 [ 0.065047] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.065081] Brought up 2 CPUs [ 0.065089] SMP: Total of 2 processors activated (5983.43 BogoMIPS). [ 0.065092] CPU: All CPU(s) started in SVC mode. IMHO these should be considered for the next -rc. regards, Peter. Peter Griffin (2): ARM: STi: Add code to release secondary cores from holding pen. ARM: STi: DT: STiH407: Add cpu-release-addr dt property. arch/arm/boot/dts/stih407-family.dtsi | 4 +++ arch/arm/mach-sti/headsmp.S | 1 + arch/arm/mach-sti/platsmp.c | 56 +++++++++++++++++++++++++++++++++-- arch/arm/mach-sti/smp.h | 2 ++ 4 files changed, 60 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* [PATCH 1/2] ARM: STi: Add code to release secondary cores from holding pen. [not found] ` <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2015-06-08 16:16 ` Peter Griffin 2015-06-09 9:17 ` Maxime Coquelin 0 siblings, 1 reply; 6+ messages in thread From: Peter Griffin @ 2015-06-08 16:16 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o, srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w Cc: peter.griffin-QSEj5FYQhm4dnm+yROfE0A, lee.jones-QSEj5FYQhm4dnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA Most upstream devs boot STi platform via JTAG which abuses the boot process by setting the PC of secondary cores directly. As a consquence, booting STi platforms via u-boot results in only the primary core being brought up as the code to manage the holding pen is not upstream. This patch adds the necessary code to bring the secondary cores out of the holding pen. It uses the cpu-release-addr DT property to get the address of the holding pen from the bootloader. With this patch booting upstream kernels via u-boot works correctly: [ 0.045456] CPU: Testing write buffer coherency: ok [ 0.045597] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.045734] Setting up static identity map for 0x40209000 - 0x40209098 [ 0.065047] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.065081] Brought up 2 CPUs [ 0.065089] SMP: Total of 2 processors activated (5983.43 BogoMIPS). [ 0.065092] CPU: All CPU(s) started in SVC mode. Signed-off-by: Peter Griffin <peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- arch/arm/mach-sti/headsmp.S | 1 + arch/arm/mach-sti/platsmp.c | 56 ++++++++++++++++++++++++++++++++++++++++++--- arch/arm/mach-sti/smp.h | 2 ++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S index 4c09bae..e0ad4517 100644 --- a/arch/arm/mach-sti/headsmp.S +++ b/arch/arm/mach-sti/headsmp.S @@ -37,6 +37,7 @@ pen: ldr r7, [r6] * should now contain the SVC stack for this core */ b secondary_startup +ENDPROC(sti_secondary_startup) 1: .long . .long pen_release diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c index d4b624f..6597ed8 100644 --- a/arch/arm/mach-sti/platsmp.c +++ b/arch/arm/mach-sti/platsmp.c @@ -20,6 +20,7 @@ #include <linux/io.h> #include <linux/of.h> #include <linux/of_address.h> +#include <linux/memblock.h> #include <asm/cacheflush.h> #include <asm/smp_plat.h> @@ -99,14 +100,62 @@ static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle) static void __init sti_smp_prepare_cpus(unsigned int max_cpus) { - void __iomem *scu_base = NULL; - struct device_node *np = of_find_compatible_node( - NULL, NULL, "arm,cortex-a9-scu"); + struct device_node *np; + void __iomem *scu_base; + u32 __iomem *cpu_strt_ptr; + u32 release_phys; + int cpu; + unsigned long entry_pa = virt_to_phys(sti_secondary_startup); + + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); + if (np) { scu_base = of_iomap(np, 0); scu_enable(scu_base); of_node_put(np); } + + if (max_cpus <= 1) + return; + + for_each_possible_cpu(cpu) { + + np = of_get_cpu_node(cpu, NULL); + + if (!np) + continue; + + if (of_property_read_u32(np, "cpu-release-addr", + &release_phys)) { + pr_err("CPU %d: missing or invalid cpu-release-addr " + "property\n", cpu); + continue; + } + + /* + * holding pen is usually configured in SBC DMEM but can also be + * in RAM. + */ + + if (!memblock_is_memory(release_phys)) + cpu_strt_ptr = + ioremap(release_phys, sizeof(release_phys)); + else + cpu_strt_ptr = + (u32 __iomem *)phys_to_virt(release_phys); + + __raw_writel(entry_pa, cpu_strt_ptr); + + /* + * wmb so that data is actually written + * before cache flush is done + */ + smp_wmb(); + sync_cache_w(cpu_strt_ptr); + + if (!memblock_is_memory(release_phys)) + iounmap(cpu_strt_ptr); + } } struct smp_operations __initdata sti_smp_ops = { @@ -114,3 +163,4 @@ struct smp_operations __initdata sti_smp_ops = { .smp_secondary_init = sti_secondary_init, .smp_boot_secondary = sti_boot_secondary, }; + diff --git a/arch/arm/mach-sti/smp.h b/arch/arm/mach-sti/smp.h index 1871b72..ae22707 100644 --- a/arch/arm/mach-sti/smp.h +++ b/arch/arm/mach-sti/smp.h @@ -14,4 +14,6 @@ extern struct smp_operations sti_smp_ops; +void sti_secondary_startup(void); + #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] ARM: STi: Add code to release secondary cores from holding pen. 2015-06-08 16:16 ` [PATCH 1/2] ARM: STi: " Peter Griffin @ 2015-06-09 9:17 ` Maxime Coquelin 0 siblings, 0 replies; 6+ messages in thread From: Maxime Coquelin @ 2015-06-09 9:17 UTC (permalink / raw) To: Peter Griffin, linux-arm-kernel, linux-kernel, patrice.chotard, srinivas.kandagatla Cc: lee.jones, devicetree Hi Peter, On 06/08/2015 06:16 PM, Peter Griffin wrote: > Most upstream devs boot STi platform via JTAG which abuses the > boot process by setting the PC of secondary cores directly. As > a consquence, booting STi platforms via u-boot results in only > the primary core being brought up as the code to manage the > holding pen is not upstream. > > This patch adds the necessary code to bring the secondary cores > out of the holding pen. It uses the cpu-release-addr DT property > to get the address of the holding pen from the bootloader. > > With this patch booting upstream kernels via u-boot works > correctly: > > [ 0.045456] CPU: Testing write buffer coherency: ok > [ 0.045597] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 > [ 0.045734] Setting up static identity map for 0x40209000 - 0x40209098 > [ 0.065047] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 > [ 0.065081] Brought up 2 CPUs > [ 0.065089] SMP: Total of 2 processors activated (5983.43 BogoMIPS). > [ 0.065092] CPU: All CPU(s) started in SVC mode. > > Signed-off-by: Peter Griffin <peter.griffin@linaro.org> > --- > arch/arm/mach-sti/headsmp.S | 1 + > arch/arm/mach-sti/platsmp.c | 56 ++++++++++++++++++++++++++++++++++++++++++--- > arch/arm/mach-sti/smp.h | 2 ++ > 3 files changed, 56 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c > index d4b624f..6597ed8 100644 > --- a/arch/arm/mach-sti/platsmp.c > +++ b/arch/arm/mach-sti/platsmp.c > > struct smp_operations __initdata sti_smp_ops = { > @@ -114,3 +163,4 @@ struct smp_operations __initdata sti_smp_ops = { > .smp_secondary_init = sti_secondary_init, > .smp_boot_secondary = sti_boot_secondary, > }; > + Please remove trailing line. Once fixed, you can add: Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Thanks! Maxime ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] ARM: STi: DT: STiH407: Add cpu-release-addr dt property. 2015-06-08 16:16 [PATCH 0/2] Add code to release secondary cores from holding pen Peter Griffin [not found] ` <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2015-06-08 16:16 ` Peter Griffin [not found] ` <1433780219-1245-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2015-06-09 9:21 ` [PATCH 0/2] Add code to release secondary cores from holding pen Maxime Coquelin 2 siblings, 1 reply; 6+ messages in thread From: Peter Griffin @ 2015-06-08 16:16 UTC (permalink / raw) To: linux-arm-kernel, linux-kernel, maxime.coquelin, patrice.chotard, srinivas.kandagatla Cc: peter.griffin, lee.jones, devicetree To enable SMP when booting via u-boot we need to specify the newly implemented cpu-release-addr DT property. Signed-off-by: Peter Griffin <peter.griffin@linaro.org> --- arch/arm/boot/dts/stih407-family.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi index c06a546..3c90227 100644 --- a/arch/arm/boot/dts/stih407-family.dtsi +++ b/arch/arm/boot/dts/stih407-family.dtsi @@ -19,11 +19,15 @@ device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; + /* u-boot puts hpen in SBC dmem at 0xa4 offset */ + cpu-release-addr = <0x94100A4>; }; cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <1>; + /* u-boot puts hpen in SBC dmem at 0xa4 offset */ + cpu-release-addr = <0x94100A4>; }; }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1433780219-1245-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 2/2] ARM: STi: DT: STiH407: Add cpu-release-addr dt property. [not found] ` <1433780219-1245-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2015-06-09 9:19 ` Maxime Coquelin 0 siblings, 0 replies; 6+ messages in thread From: Maxime Coquelin @ 2015-06-09 9:19 UTC (permalink / raw) To: Peter Griffin, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA, patrice.chotard-qxv4g6HH51o, srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA On 06/08/2015 06:16 PM, Peter Griffin wrote: > To enable SMP when booting via u-boot we need to specify the > newly implemented cpu-release-addr DT property. > > Signed-off-by: Peter Griffin <peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > --- > arch/arm/boot/dts/stih407-family.dtsi | 4 ++++ > 1 file changed, 4 insertions(+) > Acked-by: Maxime Coquelin <maxime.coquelin-qxv4g6HH51o@public.gmane.org> Thanks! Maxime -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Add code to release secondary cores from holding pen. 2015-06-08 16:16 [PATCH 0/2] Add code to release secondary cores from holding pen Peter Griffin [not found] ` <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2015-06-08 16:16 ` [PATCH 2/2] ARM: STi: DT: STiH407: Add cpu-release-addr dt property Peter Griffin @ 2015-06-09 9:21 ` Maxime Coquelin 2 siblings, 0 replies; 6+ messages in thread From: Maxime Coquelin @ 2015-06-09 9:21 UTC (permalink / raw) To: Peter Griffin, linux-arm-kernel, linux-kernel, patrice.chotard, srinivas.kandagatla Cc: lee.jones, devicetree Hi Peter, On 06/08/2015 06:16 PM, Peter Griffin wrote: > I can't test this on a STiH418 platform, as I don't have one, but a similar > DT change will be required there as well. I'm not sure if u-boot uses > the same SBC DMEM offset by default or not. It should have changed. Could you also patch STiH418 DT to add cpu-release-addr in CPU 2 & 3 nodes? Thanks, Maxime ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-09 9:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-08 16:16 [PATCH 0/2] Add code to release secondary cores from holding pen Peter Griffin [not found] ` <1433780219-1245-1-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2015-06-08 16:16 ` [PATCH 1/2] ARM: STi: " Peter Griffin 2015-06-09 9:17 ` Maxime Coquelin 2015-06-08 16:16 ` [PATCH 2/2] ARM: STi: DT: STiH407: Add cpu-release-addr dt property Peter Griffin [not found] ` <1433780219-1245-3-git-send-email-peter.griffin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2015-06-09 9:19 ` Maxime Coquelin 2015-06-09 9:21 ` [PATCH 0/2] Add code to release secondary cores from holding pen Maxime Coquelin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).