Skip to contentSkip to conversation

Add SMP support for MSM8660, MSM8960 and MSM8974

PATCH Superseded Rohit Vaswani 2 participants 8 messages Jun 28, 2013 – Jul 30, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add SMP support for MSM8660, MSM8960 and MSM8974

This series re-organizes the platsmp.c and adds SMP support for MSM8660, MSM8960 and MSM8974.
We convert to using the cpus property in device tree and add a "enable-method" property for arm32.
This helps select the appropriate release sequence for the secondary cores based on the cpu.

Rohit Vaswani (4):
ARM: msm: Remove pen_release usage
ARM: msm: Re-organize platsmp to make it extensible
ARM: msm: Add SMP support for 8960
ARM: msm: Add support for 8974 SMP

 Documentation/devicetree/bindings/arm/cpus.txt     |   9 +
 Documentation/devicetree/bindings/arm/msm/kpss.txt |  16 ++
 Documentation/devicetree/bindings/arm/msm/scss.txt |  15 ++
 arch/arm/boot/dts/msm8660-surf.dts                 |  23 +-
 arch/arm/boot/dts/msm8960-cdp.dts                  |  22 ++
 arch/arm/boot/dts/msm8974.dts                      |  23 ++
 arch/arm/mach-msm/board-dt-8974.c                  |   3 +
 arch/arm/mach-msm/headsmp.S                        |  41 ----
 arch/arm/mach-msm/hotplug.c                        |  31 +--
 arch/arm/mach-msm/platsmp.c                        | 265 ++++++++++++++++-----
 arch/arm/mach-msm/scm-boot.h                       |   8 +-
 11 files changed, 330 insertions(+), 126 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/kpss.txt
 create mode 100644 Documentation/devicetree/bindings/arm/msm/scss.txt
 delete mode 100644 arch/arm/mach-msm/headsmp.S
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH 1/4 ARM: msm: Remove pen_release usage

pen_release is no longer required as the synchronization is now managed by generic arm code.
This is done as suggested in https://lkml.org/lkml/2013/6/4/184

---
 arch/arm/mach-msm/headsmp.S | 41 -----------------------------------------
 arch/arm/mach-msm/hotplug.c | 31 ++++---------------------------
 arch/arm/mach-msm/platsmp.c | 35 +++--------------------------------
 3 files changed, 7 insertions(+), 100 deletions(-)
 delete mode 100644 arch/arm/mach-msm/headsmp.S
arch/arm/mach-msm/headsmp.S deleted +0 -41
deleted file mode 100644
index bcd5af2..0000000
@@ -1,41 +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
-ENDPROC(msm_secondary_startup)
-
-	.align
-1:	.long	.
-	.long	pen_release
arch/arm/mach-msm/hotplug.c +4 -27
index 326a872..cea80fc 100644
@@ -24,33 +24,10 @@ static inline void cpu_leave_lowpower(void)
 
 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("wfi"
-		    :
-		    :
-		    : "memory", "cc");
-
-		if (pen_release == cpu_logical_map(cpu)) {
-			/*
-			 * OK, proper wakeup, we're done
-			 */
-			break;
-		}
-
-		/*
-		 * getting here, means that we have come out of WFI without
-		 * having been woken up - this shouldn't happen
-		 *
-		 * The trouble is, letting people know about this is not really
-		 * possible, since we are currently running incoherently, and
-		 * therefore cannot safely call printk() or anything else
-		 */
-		pr_debug("CPU%u: spurious wakeup call\n", cpu);
-	}
+	asm("wfi"
+	    :
+	    :
+	    : "memory", "cc");
 }
 
 /*
arch/arm/mach-msm/platsmp.c +3 -32
index 00cdb0a..7d48759 100644
@@ -28,7 +28,7 @@
 #define SCSS_CPU1CORE_RESET 0xD80
 #define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64
 
-extern void msm_secondary_startup(void);
+extern void secondary_startup(void);
 
 static DEFINE_SPINLOCK(boot_lock);
 
@@ -41,13 +41,6 @@ static inline int get_core_count(void)
 static void __cpuinit msm_secondary_init(unsigned int cpu)
 {
 	/*
-	 * let the primary processor know we're out of the
-	 * pen, then head off into the C entry point
-	 */
-	pen_release = -1;
-	smp_wmb();
-
-	/*
 	 * Synchronise with the boot thread.
 	 */
 	spin_lock(&boot_lock);
@@ -57,7 +50,7 @@ static void __cpuinit msm_secondary_init(unsigned int cpu)
 static __cpuinit void prepare_cold_cpu(unsigned int cpu)
 {
 	int ret;
-	ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup),
+	ret = scm_set_boot_addr(virt_to_phys(secondary_startup),
 				SCM_FLAG_COLDBOOT_CPU1);
 	if (ret == 0) {
 		void __iomem *sc1_base_ptr;
@@ -75,7 +68,6 @@ static __cpuinit void prepare_cold_cpu(unsigned int cpu)
 
 static int __cpuinit msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
-	unsigned long timeout;
 	static int cold_boot_done;
 
 	/* Only need to bring cpu out of reset this way once */
@@ -91,40 +83,19 @@ static int __cpuinit msm_boot_secondary(unsigned int cpu, struct task_struct *id
 	spin_lock(&boot_lock);
 
 	/*
-	 * The secondary processor is waiting to be released from
-	 * the holding pen - release it, then wait for it to flag
-	 * that it has been released by resetting pen_release.
-	 *
-	 * Note that "pen_release" is the hardware CPU ID, whereas
-	 * "cpu" is Linux's internal ID.
-	 */
-	pen_release = cpu_logical_map(cpu);
-	__cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-	outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
-
-	/*
 	 * Send the secondary CPU a soft interrupt, thereby causing
 	 * the boot monitor to read the system wide flags register,
 	 * and branch to the address found there.
 	 */
 	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
 
-	timeout = jiffies + (1 * HZ);
-	while (time_before(jiffies, timeout)) {
-		smp_rmb();
-		if (pen_release == -1)
-			break;
-
-		udelay(10);
-	}
-
 	/*
 	 * now the secondary core is starting up let it run its
 	 * calibrations, then wait for it to finish
 	 */
 	spin_unlock(&boot_lock);
 
-	return pen_release != -1 ? -ENOSYS : 0;
+	return 0;
 }
 
 /*
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#4 lore raw

PATCH 2/4 ARM: msm: Re-organize platsmp to make it extensible

In reply to Rohit Vaswani

This makes it easy to add SMP support for new targets by adding cpus property and the release sequence. We add the enable-method property for the cpus property to specify which release sequence to use.
While at it, add the 8660 cpus bindings to make SMP work.

---
 Documentation/devicetree/bindings/arm/cpus.txt     |  6 ++
 Documentation/devicetree/bindings/arm/msm/scss.txt | 15 ++++
 arch/arm/boot/dts/msm8660-surf.dts                 | 23 +++++-
 arch/arm/mach-msm/platsmp.c                        | 96 ++++++++++++++++------
 4 files changed, 116 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/scss.txt
Documentation/devicetree/bindings/arm/cpus.txt +6 -0
index f32494d..327aad2 100644
@@ -44,6 +44,12 @@ For the ARM architecture every CPU node must contain the following properties:
 		"marvell,mohawk"
 		"marvell,xsc3"
 		"marvell,xscale"
+		"qcom,scorpion"
+- enable-method: Specifies the method used to enable or take the secondary cores
+		 out of reset. This allows different reset sequence for
+		 different types of cpus.
+		 This should be one of:
+		 "qcom,scss"
 
 Example:
 
Documentation/devicetree/bindings/arm/msm/scss.txt new file +15 -0
new file mode 100644
index 0000000..21c3e26
@@ -0,0 +1,15 @@
+* SCSS - Scorpion Sub-system
+
+Properties
+
+- compatible : Should contain "qcom,scss".
+
+- reg: Specifies the base address for the SCSS registers used for
+       booting up secondary cores.
+
+Example:
+
+	scss@902000 {
+		compatible = "qcom,scss";
+		reg = <0x00902000 0x2000>;
+	};
arch/arm/boot/dts/msm8660-surf.dts +22 -1
index cdc010e..203e51a 100644
@@ -7,6 +7,22 @@
 	compatible = "qcom,msm8660-surf", "qcom,msm8660";
 	interrupt-parent = <&intc>;
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "qcom,scorpion";
+		device_type = "cpu";
+		enable-method = "qcom,scss";
+
+		cpu@0 {
+			reg = <0>;
+		};
+
+		cpu@1 {
+			reg = <1>;
+		};
+	};
+
 	intc: interrupt-controller@2080000 {
 		compatible = "qcom,msm-8660-qgic";
 		interrupt-controller;
@@ -37,7 +53,12 @@
 		#interrupt-cells = <2>;
 	};
 
-	serial@19c40000 {
+	scss@902000 {
+		compatible = "qcom,scss";
+		reg = <0x00902000 0x2000>;
+	};
+
+	serial@19c400000 {
 		compatible = "qcom,msm-hsuart", "qcom,msm-uart";
 		reg = <0x19c40000 0x1000>,
 		      <0x19c00000 0x1000>;
arch/arm/mach-msm/platsmp.c +73 -23

129 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#5 lore raw

PATCH 3/4 ARM: msm: Add SMP support for 8960

In reply to Rohit Vaswani

Add the cpus bindings and the Krait release sequence to make SMP work for MSM8960

---
 Documentation/devicetree/bindings/arm/cpus.txt     |  2 +
 Documentation/devicetree/bindings/arm/msm/kpss.txt | 16 ++++++
 arch/arm/boot/dts/msm8960-cdp.dts                  | 22 +++++++++
 arch/arm/mach-msm/platsmp.c                        | 57 ++++++++++++++++++++++
 arch/arm/mach-msm/scm-boot.h                       |  8 +--
 5 files changed, 102 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/kpss.txt
Documentation/devicetree/bindings/arm/cpus.txt +2 -0
index 327aad2..1132eac 100644
@@ -45,11 +45,13 @@ For the ARM architecture every CPU node must contain the following properties:
 		"marvell,xsc3"
 		"marvell,xscale"
 		"qcom,scorpion"
+		"qcom,krait"
 - enable-method: Specifies the method used to enable or take the secondary cores
 		 out of reset. This allows different reset sequence for
 		 different types of cpus.
 		 This should be one of:
 		 "qcom,scss"
+		 "qcom,kpssv1"
 
 Example:
 
Documentation/devicetree/bindings/arm/msm/kpss.txt new file +16 -0
new file mode 100644
index 0000000..7272340
@@ -0,0 +1,16 @@
+* KPSS - Krait Processor Sub-system
+
+Properties
+
+- compatible : Should contain "qcom,kpss".
+
+- reg: Specifies the base address for the KPSS registers used for
+       booting up secondary cores.
+
+Example:
+
+	kpss@2088000 {
+		compatible = "qcom,kpss";
+		reg = <0x02088000 0x1000
+			0x02098000 0x2000>;
+	};
arch/arm/boot/dts/msm8960-cdp.dts +22 -0
index db2060c..8c82d5e 100644
@@ -7,6 +7,22 @@
 	compatible = "qcom,msm8960-cdp", "qcom,msm8960";
 	interrupt-parent = <&intc>;
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "qcom,krait";
+		device_type = "cpu";
+		enable-method = "qcom,kpssv1";
+
+		cpu@0 {
+			reg = <0>;
+		};
+
+		cpu@1 {
+			reg = <1>;
+		};
+	};
+
 	intc: interrupt-controller@2000000 {
 		compatible = "qcom,msm-qgic2";
 		interrupt-controller;
@@ -37,6 +53,12 @@
 		reg = <0xfd510000 0x4000>;
 	};
 
+	kpss@2088000 {
+		compatible = "qcom,kpss";
+		reg = <0x02088000 0x1000
+			0x02098000 0x2000>;
+	};
+
 	serial@16440000 {
 		compatible = "qcom,msm-hsuart", "qcom,msm-uart";
 		reg = <0x16440000 0x1000>,
arch/arm/mach-msm/platsmp.c +57 -0

75 lines not on this page · raw message

arch/arm/mach-msm/scm-boot.h +5 -3
index 7be32ff..6aabb24 100644
@@ -13,9 +13,11 @@
 #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
+#define SCM_FLAG_COLDBOOT_CPU1		0x01
+#define SCM_FLAG_COLDBOOT_CPU2		0x08
+#define SCM_FLAG_COLDBOOT_CPU3		0x20
+#define SCM_FLAG_WARMBOOT_CPU0		0x04
+#define SCM_FLAG_WARMBOOT_CPU1		0x02
 
 int scm_set_boot_addr(phys_addr_t addr, int flags);
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#6 lore raw

PATCH 4/4 ARM: msm: Add support for 8974 SMP

In reply to Rohit Vaswani

Add the cpus bindings and the Kraitv2 release sequence to make SMP work for 2 cores on MSM8974.

---
 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/boot/dts/msm8974.dts                  | 23 ++++++++
 arch/arm/mach-msm/board-dt-8974.c              |  3 +
 arch/arm/mach-msm/platsmp.c                    | 79 ++++++++++++++++++++++++++
 4 files changed, 106 insertions(+)
Documentation/devicetree/bindings/arm/cpus.txt +1 -0
index 1132eac..7c3c677 100644
@@ -52,6 +52,7 @@ For the ARM architecture every CPU node must contain the following properties:
 		 This should be one of:
 		 "qcom,scss"
 		 "qcom,kpssv1"
+		 "qcom,kpssv2"
 
 Example:
 
arch/arm/boot/dts/msm8974.dts +23 -0
index c31c097..ef35a9b 100644
@@ -7,6 +7,22 @@
 	compatible = "qcom,msm8974";
 	interrupt-parent = <&intc>;
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "qcom,krait";
+		device_type = "cpu";
+		enable-method = "qcom,kpssv2";
+
+		cpu@0 {
+			reg = <0>;
+		};
+
+		cpu@1 {
+			reg = <1>;
+		};
+	};
+
 	intc: interrupt-controller@f9000000 {
 		compatible = "qcom,msm-qgic2";
 		interrupt-controller;
@@ -23,4 +39,11 @@
 			     <1 1 0xf08>;
 		clock-frequency = <19200000>;
 	};
+
+	kpss@f9012000 {
+		compatible = "qcom,kpss";
+		reg = <0xf9012000 0x1000>,
+		      <0xf9088000 0x1000>,
+		      <0xf9098000 0x1000>;
+	};
 };
arch/arm/mach-msm/board-dt-8974.c +3 -0
index d7f84f2..06119f9 100644
@@ -13,11 +13,14 @@
 #include <linux/of_platform.h>
 #include <asm/mach/arch.h>
 
+#include "common.h"
+
 static const char * const msm8974_dt_match[] __initconst = {
 	"qcom,msm8974",
 	NULL
 };
 
 DT_MACHINE_START(MSM8974_DT, "Qualcomm MSM (Flattened Device Tree)")
+	.smp = smp_ops(msm_smp_ops),
 	.dt_compat = msm8974_dt_match,
 MACHINE_END
arch/arm/mach-msm/platsmp.c +79 -0

91 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#7 lore raw
In reply to Rohit Vaswani

ping ?

Quoted 25 lines · Rohit Vaswani

This series re-organizes the platsmp.c and adds SMP support for MSM8660, MSM8960 and MSM8974.
We convert to using the cpus property in device tree and add a "enable-method" property for arm32.
This helps select the appropriate release sequence for the secondary cores based on the cpu.

Rohit Vaswani (4):
ARM: msm: Remove pen_release usage
ARM: msm: Re-organize platsmp to make it extensible
ARM: msm: Add SMP support for 8960
ARM: msm: Add support for 8974 SMP

  Documentation/devicetree/bindings/arm/cpus.txt     |   9 +
  Documentation/devicetree/bindings/arm/msm/kpss.txt |  16 ++
  Documentation/devicetree/bindings/arm/msm/scss.txt |  15 ++
  arch/arm/boot/dts/msm8660-surf.dts                 |  23 +-
  arch/arm/boot/dts/msm8960-cdp.dts                  |  22 ++
  arch/arm/boot/dts/msm8974.dts                      |  23 ++
  arch/arm/mach-msm/board-dt-8974.c                  |   3 +
  arch/arm/mach-msm/headsmp.S                        |  41 ----
  arch/arm/mach-msm/hotplug.c                        |  31 +--
  arch/arm/mach-msm/platsmp.c                        | 265 ++++++++++++++++-----
  arch/arm/mach-msm/scm-boot.h                       |   8 +-
  11 files changed, 330 insertions(+), 126 deletions(-)
Quoted 4 lines

create mode 100644 Documentation/devicetree/bindings/arm/msm/kpss.txt create mode 100644 Documentation/devicetree/bindings/arm/msm/scss.txt delete mode 100644 arch/arm/mach-msm/headsmp.S

Thanks,
Rohit Vaswani

Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw

Re: [PATCH 1/4] ARM: msm: Remove pen_release usage

In reply to Rohit Vaswani
Quoted 11 lines · Rohit Vaswani

pen_release is no longer required as the synchronization is now managed by generic arm code.
This is done as suggested in https://lkml.org/lkml/2013/6/4/184

---

arch/arm/mach-msm/headsmp.S | 41 -----------------------------------------
arch/arm/mach-msm/hotplug.c | 31 ++++---------------------------
arch/arm/mach-msm/platsmp.c | 35 +++--------------------------------
3 files changed, 7 insertions(+), 100 deletions(-)

delete mode 100644 arch/arm/mach-msm/headsmp.S

Don't you need to update arch/arm/mach-msm/Makefile to remove headsmp.o from:

obj-$(CONFIG_SMP) += headsmp.o platsmp.o

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

#3 lore raw

Re: [PATCH 1/4] ARM: msm: Remove pen_release usage

Quoted 13 lines · Kumar Gala
Quoted 11 lines · Rohit Vaswani

pen_release is no longer required as the synchronization is now managed by generic arm code.
This is done as suggested in https://lkml.org/lkml/2013/6/4/184

---

arch/arm/mach-msm/headsmp.S | 41 -----------------------------------------
arch/arm/mach-msm/hotplug.c | 31 ++++---------------------------
arch/arm/mach-msm/platsmp.c | 35 +++--------------------------------
3 files changed, 7 insertions(+), 100 deletions(-)

delete mode 100644 arch/arm/mach-msm/headsmp.S

Quoted 3 lines

Don't you need to update arch/arm/mach-msm/Makefile to remove headsmp.o from:

obj-$(CONFIG_SMP) += headsmp.o platsmp.o

Will do

Quoted 10 lines

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Thanks,
Rohit Vaswani

Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation