SMP support for msm
Subsystems (3)
v5 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.
This version changes the hotplug and smp code to be more similar to the realview implementation.
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 | 40 ++++ arch/arm/mach-msm/hotplug.c | 91 +++++++ arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 6 +- arch/arm/mach-msm/io.c | 1 + arch/arm/mach-msm/platsmp.c | 166 +++++++++++++ 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 +++++++++-- 12 files changed, 831 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 v5 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 v5 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 v5 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 v5 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 | 91 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 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 +91 -0
91 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 4/5] msm: hotplug: support cpu hotplug on msm
Quoted 2 lines · Jeff Ohlstein
arch/arm/mach-msm/hotplug.c new file +0
-0
[...]
arch/arm/mach-msm/hotplug.c
Quoted 11 lines
arch/arm/mach-msm/hotplug.c new file +11
-0+static inline void platform_do_lowpower (unsigned int cpu) +{ + ? ? ? /* Just enter wfi for now. TODO: Properly shut off the cpu. */ + ? ? ? for (;;) { + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* here's the WFI + ? ? ? ? ? ? ? ?*/ + ? ? ? ? ? ? ? asm(".word ? ? ?0xe320f003\n" + ? ? ? ? ? ? ? ? ? : + ? ? ? ? ? ? ? ? ? : + ? ? ? ? ? ? ? ? ? : "memory", "cc");
Is this for an ARMv7 platform? If yes, you could just use the WFI instruction directly (and it would also work if compiling the kernel to Thumb-2 mode).
Signature · 1 line
Catalin
Re: [PATCH v5 4/5] msm: hotplug: support cpu hotplug on msm
Quoted 4 lines · Catalin Marinas
Quoted 2 lines · Jeff Ohlstein
arch/arm/mach-msm/hotplug.c new file +0
-0[...]
Quoted 16 lines
arch/arm/mach-msm/hotplug.c line 38
Quoted 11 lines
arch/arm/mach-msm/hotplug.c new file +11
-0+static inline void platform_do_lowpower (unsigned int cpu) +{ +/* Just enter wfi for now. TODO: Properly shut off the cpu. */ +for (;;) { +/* +* here's the WFI +*/ + asm(".word 0xe320f003\n" + : + : + :"memory" ,"cc" );Is this for an ARMv7 platform? If yes, you could just use the WFI instruction directly (and it would also work if compiling the kernel to Thumb-2 mode).
I was trying to make the code as similar to the realview code as I reasonably could. There are several instances of that, we could fix all of them in one go.
-Jeff
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 | 40 ++++++++++ arch/arm/mach-msm/platsmp.c | 166 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 208 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 +40 -0
@@ -0,0 +1,40 @@ +/* + * 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> + + __INIT + +/* + * 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 new file +166 -0
166 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
arch/arm/mach-msm/platsmp.c line 46
Quoted 4 lines · Jeff Ohlstein
arch/arm/mach-msm/platsmp.c new file +4
-0+void __cpuinit platform_secondary_init (unsigned int cpu) +{ +/* Configure edge-triggered PPIs */ +writel (GIC_PPI_EDGE_MASK ,MSM_QGIC_DIST_BASE +GIC_DIST_CONFIG +4 );
At some point we should really clean this up so we don't have code writing directly to the GIC registers like this.
arch/arm/mach-msm/platsmp.c line 72
Quoted 5 lines
arch/arm/mach-msm/platsmp.c new file +5
-0+static __init void prepare_cold_cpu (unsigned int cpu) +{ +int ret; + ret = scm_set_boot_addr((void *) + virt_to_phys(msm_secondary_startup),
It seems wrong to cast a physical address to a pointer - physical addresses should not be pointer-like. Can it stay as an integer?