SMP support for msm
Subsystems (3)
v4 cover SMP support for msm
This series adds support for SMP on msm targets, and specifically adds support for SMP on the msm8x60. This version is rebased on top of Russell's SMP and gic patches, and has fixes for hotplug and smp.
Jeff Ohlstein (3):
msm: timer: SMP timer support for msm
msm: hotplug: support cpu hotplug on msm
msm: add SMP support for msm
Stepan Moskovchenko (1):
msm: scm-boot: Support for setting cold/warm boot addresses
Stephen Boyd (1):
msm: Secure Channel Manager (SCM) support
arch/arm/mach-msm/Kconfig | 5 + arch/arm/mach-msm/Makefile | 4 + arch/arm/mach-msm/headsmp.S | 43 ++++ arch/arm/mach-msm/hotplug.c | 88 +++++++ arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 6 +- arch/arm/mach-msm/include/mach/smp.h | 2 + arch/arm/mach-msm/io.c | 1 + arch/arm/mach-msm/platsmp.c | 121 ++++++++++ arch/arm/mach-msm/scm-boot.c | 39 +++ arch/arm/mach-msm/scm-boot.h | 38 +++ arch/arm/mach-msm/scm.c | 287 +++++++++++++++++++++++ arch/arm/mach-msm/scm.h | 41 ++++ arch/arm/mach-msm/timer.c | 137 +++++++++-- 13 files changed, 788 insertions(+), 24 deletions(-) create mode 100644 arch/arm/mach-msm/headsmp.S create mode 100644 arch/arm/mach-msm/hotplug.c create mode 100644 arch/arm/mach-msm/platsmp.c create mode 100644 arch/arm/mach-msm/scm-boot.c create mode 100644 arch/arm/mach-msm/scm-boot.h create mode 100644 arch/arm/mach-msm/scm.c create mode 100644 arch/arm/mach-msm/scm.h
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.
PATCH v4 1/5 msm: Secure Channel Manager (SCM) support
From: Stephen Boyd <[email protected]>
SCM is the protocol used to communicate between the secure and non-secure code executing on the applications processor. The non-secure side uses a physically contiguous buffer to pass information to the secure side; where the buffer conforms to a format that is agreed upon by both sides. The use of a buffer allows multiple pending requests to be in flight on the secure side. It also benefits use cases where the command or response buffer contains large chunks of data.
--- arch/arm/mach-msm/Kconfig | 4 + arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/scm.c | 287 ++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/scm.h | 41 +++++++ 4 files changed, 333 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/scm.c create mode 100644 arch/arm/mach-msm/scm.h
arch/arm/mach-msm/Kconfig +4 -0
@@ -44,6 +44,7 @@ config ARCH_MSM8X60 select CPU_V7 select MSM_V2_TLMM select MSM_GPIOMUX + select MSM_SCM if SMP endchoice
@@ -164,4 +165,7 @@ config MSM_GPIOMUX config MSM_V2_TLMM bool + +config MSM_SCM + bool endif
arch/arm/mach-msm/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_MSM_PROC_COMM) += clock.o obj-$(CONFIG_ARCH_QSD8X50) += sirc.o obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o obj-$(CONFIG_MSM_SMD) += last_radio_log.o +obj-$(CONFIG_MSM_SCM) += scm.o obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
arch/arm/mach-msm/scm.c new file +287 -0
287 lines not on this page · raw message
arch/arm/mach-msm/scm.h new file +41 -0
41 lines not on this page · raw message
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.
PATCH v4 2/5 msm: scm-boot: Support for setting cold/warm boot addresses
In reply to Jeff OhlsteinFrom: Stepan Moskovchenko <[email protected]>
Add support for setting the cold boot address of core 1 and the warm boot addresses of cores 0 and 1 using a secure domain call.
--- arch/arm/mach-msm/Makefile | 2 +- arch/arm/mach-msm/scm-boot.c | 39 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/scm-boot.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-msm/scm-boot.c create mode 100644 arch/arm/mach-msm/scm-boot.h
arch/arm/mach-msm/Makefile +1 -1
@@ -18,7 +18,7 @@ obj-$(CONFIG_MSM_PROC_COMM) += clock.o obj-$(CONFIG_ARCH_QSD8X50) += sirc.o obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o obj-$(CONFIG_MSM_SMD) += last_radio_log.o -obj-$(CONFIG_MSM_SCM) += scm.o +obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
arch/arm/mach-msm/scm-boot.c new file +39 -0
@@ -0,0 +1,39 @@ +/* Copyright (c) 2010, Code Aurora Forum. 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 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +* 02110-1301, USA. +*/ + +#include <linux/module.h> +#include <linux/slab.h> + +#include "scm.h" +#include "scm-boot.h" + +/* +* Set the cold/warm boot address for one of the CPU cores. +*/ +int scm_set_boot_addr (void *addr,int flags) +{ +struct { +unsigned int flags; +void *addr; + } cmd; + + cmd.addr = addr; + cmd.flags = flags; +return scm_call (SCM_SVC_BOOT ,SCM_BOOT_ADDR , + &cmd,sizeof (cmd),NULL ,0 ); +} +EXPORT_SYMBOL (scm_set_boot_addr);
arch/arm/mach-msm/scm-boot.h new file +38 -0
@@ -0,0 +1,38 @@ +/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following +* disclaimer in the documentation and/or other materials provided +* with the distribution. +* * Neither the name of Code Aurora Forum, Inc. nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef __MACH_SCM_BOOT_H +#define __MACH_SCM_BOOT_H + +#define SCM_BOOT_ADDR 0x1 +#define SCM_FLAG_COLDBOOT_CPU1 0x1 +#define SCM_FLAG_WARMBOOT_CPU1 0x2 +#define SCM_FLAG_WARMBOOT_CPU0 0x4 + +int scm_set_boot_addr (void *addr,int flags); + +#endif
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.
PATCH v4 3/5 msm: timer: SMP timer support for msm
In reply to Jeff OhlsteinThe msm provides timer hardware that is private to each core. Each timer has separate counter and match registers, so we create separate clock_event_devices for each core. For the global clocksource, use cpu 0's counter.
--- arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 6 +- arch/arm/mach-msm/io.c | 1 + arch/arm/mach-msm/timer.c | 137 +++++++++++++++++++---- 3 files changed, 120 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +5 -1
@@ -60,7 +60,11 @@#define MSM_TMR_BASE IOMEM(0xF0200000)#define MSM_TMR_PHYS 0x02000000 -#define MSM_TMR_SIZE (SZ_1M) +#define MSM_TMR_SIZE SZ_4K + +#define MSM_TMR0_BASE IOMEM(0xF0201000) +#define MSM_TMR0_PHYS 0x02040000 +#define MSM_TMR0_SIZE SZ_4K#define MSM_GPT_BASE (MSM_TMR_BASE + 0x4)#define MSM_DGT_BASE (MSM_TMR_BASE + 0x24)
arch/arm/mach-msm/io.c +1 -0
@@ -105,6 +105,7 @@ static struct map_desc msm8x60_io_desc[] __initdata = {MSM_DEVICE (QGIC_DIST ),MSM_DEVICE (QGIC_CPU ),MSM_DEVICE (TMR ), +MSM_DEVICE (TMR0 ),MSM_DEVICE (ACC ), MSM_DEVICE(GCC), };
arch/arm/mach-msm/timer.c +114 -23
219 lines not on this page · raw message
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.
PATCH v4 4/5 msm: hotplug: support cpu hotplug on msm
In reply to Jeff Ohlstein--- arch/arm/mach-msm/Makefile | 2 + arch/arm/mach-msm/hotplug.c | 88 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/hotplug.c
arch/arm/mach-msm/Makefile +2 -0
@@ -20,6 +20,8 @@ obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 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_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
arch/arm/mach-msm/hotplug.c new file +88 -0
88 lines not on this page · raw message
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.
Re: [PATCH v4 4/5] msm: hotplug: support cpu hotplug on msm
arch/arm/mach-msm/hotplug.c line 42
Quoted 12 lines · Jeff Ohlstein
arch/arm/mach-msm/hotplug.c new file +12
-0+static inline void platform_do_lowpower (unsigned int cpu) +{ +/* Just enter wfe for now. */ +for (;;) { + asm("wfe" : : :"memory" ); +if (pen_release == cpu) { +/* +* OK, proper wakeup, we're done +*/ +break ; + } +smp_rmb ();
I can't work out what this read memory barrier is doing here. Could you suggest what purpose it's serving please?
Re: [PATCH v4 4/5] msm: hotplug: support cpu hotplug on msm
--- arch/arm/mach-msm/Makefile | 2 + arch/arm/mach-msm/hotplug.c | 87 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/hotplug.c
arch/arm/mach-msm/Makefile +2 -0
@@ -20,6 +20,8 @@ obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 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_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
arch/arm/mach-msm/hotplug.c new file +87 -0
87 lines not on this page · raw message
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.
PATCH v5 5/5 msm: add SMP support for msm
In reply to Jeff Ohlstein--- arch/arm/mach-msm/Kconfig | 1 + arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/headsmp.S | 43 ++++++++++++ arch/arm/mach-msm/include/mach/smp.h | 2 + arch/arm/mach-msm/platsmp.c | 121 ++++++++++++++++++++++++++++++++++ 5 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/headsmp.S create mode 100644 arch/arm/mach-msm/platsmp.c
arch/arm/mach-msm/Kconfig +1 -0
@@ -40,6 +40,7 @@ config ARCH_MSM8X60 bool "MSM8X60" select MACH_MSM8X60_SURF if (!MACH_MSM8X60_RUMI3 && !MACH_MSM8X60_SIM \ && !MACH_MSM8X60_FFA) + select ARCH_MSM_SCORPIONMP select ARM_GIC select CPU_V7 select MSM_V2_TLMM
arch/arm/mach-msm/Makefile +1 -0
@@ -21,6 +21,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_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
arch/arm/mach-msm/headsmp.S new file +43 -0
43 lines not on this page · raw message
arch/arm/mach-msm/include/mach/smp.h +2 -0
@@ -36,4 +36,6 @@ static inline void smp_cross_call(const struct cpumask *mask, int ipi) gic_raise_softirq(mask, ipi); } +extern int pen_release; +extern void msm_secondary_startup (void );#endif
arch/arm/mach-msm/platsmp.c new file +121 -0
121 lines not on this page · raw message
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.
Re: [PATCH v5 5/5] msm: add SMP support for msm
Quoted 2 lines · Jeff Ohlstein
arch/arm/mach-msm/headsmp.S new file +0
-0
[...]
arch/arm/mach-msm/headsmp.S
Quoted 11 lines
arch/arm/mach-msm/headsmp.S new file +11
-0+ENTRY(msm_secondary_startup) + ? ? ? mrc ? ? p15, 0, r0, c0, c0, 5 ? @ MPIDR + ? ? ? and ? ? r0, r0, #15 ? ? ? ? ? ? @ What CPU am I + ? ? ? adr ? ? r4, 1f ? ? ? ? ? ? ? ? ?@ address of + ? ? ? ldmia ? r4, {r5, r6} ? ? ? ? ? ?@ load curr addr and pen_rel addr + ? ? ? sub ? ? r4, r4, r5 ? ? ? ? ? ? ?@ determine virtual/phys offsets + ? ? ? add ? ? r6, r6, r4 ? ? ? ? ? ? ?@ apply +pen: + ? ? ? wfe + ? ? ? dsb ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ ensure subsequent access is + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ after event
As I wrote in a different e-mail, this DSB isn't actually needed as the processor shouldn't speculate beyond the WFE. But it's harmless anyway.
Quoted 2 lines
arch/arm/mach-msm/platsmp.c new file +0
-0
[...]
Quoted 6 lines
arch/arm/mach-msm/platsmp.c new file +6
-0+int boot_secondary (unsigned int cpu,struct task_struct *idle) +{ + ? ? ? static int cold_boot_done; + ? ? ? unsigned long timeout; + ? ? ? printk(KERN_DEBUG "Starting secondary CPU %d\n", cpu); +
arch/arm/mach-msm/platsmp.c
Quoted 10 lines
arch/arm/mach-msm/platsmp.c new file +10
-0+ ? ? ? if (cold_boot_done == false) { + ? ? ? ? ? ? ? prepare_cold_cpu(cpu); + ? ? ? ? ? ? ? cold_boot_done = true; + ? ? ? } + + ? ? ? pen_release = cpu; + ? ? ? __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); + ? ? ? outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); + ? ? ? __asm__("sev"); + ? ? ? dsb();
What's the need for the dsb() here (one before SEV maybe)?
Also, do we need to add a "memory" clobber to the SEV asm, not sure whether the compiler would try to reorder the code.
Signature · 1 line
Catalin
Re: [PATCH v5 5/5] msm: add SMP support for msm
Quoted 9 lines · Catalin Marinas
Quoted 3 lines · Jeff Ohlstein
+ ? ? ?
outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+ ? ? ?__asm__("sev");
+ ? ? ?dsb();What's the need for the
dsb()here (one before SEV maybe)?Also, do we need to add a "memory" clobber to the SEV asm, not sure whether the compiler would try to reorder the code.
It doesn't seem to, but it seems to me that it would be allowed to, so, I would think the "memory" clobber should be there.
David
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.
Re: [PATCH v5 5/5] msm: add SMP support for msm
Quoted 6 lines · David Brown
Quoted 5 lines · Catalin Marinas
Quoted 3 lines · Jeff Ohlstein
+ ? ? ?
outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+ ? ? ?__asm__("sev");
+ ? ? ?dsb();
Quoted 7 lines
Quoted 4 lines
What's the need for the
dsb()here (one before SEV maybe)?Also, do we need to add a "memory" clobber to the SEV asm, not sure whether the compiler would try to reorder the code.
It doesn't seem to, but it seems to me that it would be allowed to, so, I would think the "memory" clobber should be there.
For each difference in the SMP and hotplug code from Realview (if it's mostly identical to Realview), I'd personally like to see explainations why it's necessary, either as comments in the code or at the very least in the commit log.
As far as hotplug code goes, I wish folk would see what their hardware can actually do with the secondary CPUs - can they take the CPU fully offline and into a proper dormant state, and when they reawaken it, can they wake it in the same manner as the CPU is brought online during boot.
Realview doesn't do this because it can't reset the secondary CPUs independent of the boot CPU, so the pattern it gives you should not be followed unless your hardware is similarly restricted.
Re: [PATCH v5 5/5] msm: add SMP support for msm
Hi Russell,
Quoted 5 lines · Russell King - ARM Linux
As far as hotplug code goes, I wish folk would see what their hardware can actually do with the secondary CPUs - can they take the CPU fully offline and into a proper dormant state, and when they reawaken it, can they wake it in the same manner as the CPU is brought online during boot.
This is possible with MSM8660 and we have this working internally, but it relies on a fair amount of power management code that is not ready to be sent out yet. This hotplug support is just meant as a starting point while getting the core MSM8660 support in.
thanks,
Steve
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 3 lines · Jeff Ohlstein
This series adds support for SMP on msm targets, and specifically adds support for SMP on the msm8x60. This version is rebased on top of Russell's SMP and gic patches, and has fixes for hotplug and smp.
Russell, do you want to pick up these patches as well, since they depend on the other SMP patches in your tree?
Thanks,
David
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.