Skip to contentSkip to conversation

Add SMP support for MSM8660 and MSM8960

PATCH In review Rohit Vaswani 2 participants 6 messages Jun 4, 2013

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

cover Add SMP support for MSM8660 and MSM8960

This series re-organizes the platsmp.c and adds SMP support for MSM8660 and MSM8960. We convert to using the cpus property in device tree and add a "enable-method" property for arm32.

Rohit Vaswani (3):
msm: platsmp: Consolidate write to pen_release
ARM: msm: Re-organize platsmp to make it extensible
ARM: msm: Add SMP support for 8960

 Documentation/devicetree/bindings/arm/cpus.txt     |    8 +
 Documentation/devicetree/bindings/arm/msm/kpss.txt |   16 ++
 Documentation/devicetree/bindings/arm/msm/scss.txt |   15 ++
 arch/arm/boot/dts/msm8660-surf.dts                 |   21 +++
 arch/arm/boot/dts/msm8960-cdp.dts                  |   22 +++
 arch/arm/mach-msm/platsmp.c                        |  165 ++++++++++++++++---
 arch/arm/mach-msm/scm-boot.h                       |    8 +-
 7 files changed, 226 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/kpss.txt
 create mode 100644 Documentation/devicetree/bindings/arm/msm/scss.txt
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/3 msm: platsmp: Consolidate write to pen_release

Change the pen variable in one place.

---
 arch/arm/mach-msm/platsmp.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
arch/arm/mach-msm/platsmp.c +10 -5
index 00cdb0a..2028f3f 100644
@@ -32,6 +32,14 @@ extern void msm_secondary_startup(void);
 
 static DEFINE_SPINLOCK(boot_lock);
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	smp_wmb();
+	__cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
+	outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+}
+
 static inline int get_core_count(void)
 {
 	/* 1 + the PART[1:0] field of MIDR */
@@ -44,8 +52,7 @@ 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();
+	write_pen_release(-1);
 
 	/*
 	 * Synchronise with the boot thread.
@@ -98,9 +105,7 @@ static int __cpuinit msm_boot_secondary(unsigned int cpu, struct task_struct *id
 	 * 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));
+	write_pen_release(cpu_logical_map(cpu));
 
 	/*
 	 * Send the secondary CPU a soft interrupt, thereby causing
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#2 lore raw

PATCH 2/3 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. This patch adds 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                 |   21 +++++
 arch/arm/mach-msm/platsmp.c                        |   93 +++++++++++++++-----
 4 files changed, 114 insertions(+), 21 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 +21 -0
index 9bf49b3..0ede522 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;
@@ -26,6 +42,11 @@
 		cpu-offset = <0x40000>;
 	};
 
+	scss@902000 {
+		compatible = "qcom,scss";
+		reg = <0x00902000 0x2000>;
+	};
+
 	serial@19c400000 {
 		compatible = "qcom,msm-hsuart", "qcom,msm-uart";
 		reg = <0x19c40000 0x1000>,
arch/arm/mach-msm/platsmp.c +72 -21

121 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
#3 lore raw

Re: [PATCH 2/3] ARM: msm: Re-organize platsmp to make it extensible

arch/arm/mach-msm/platsmp.c static void __cpuinit msm_secondary_init(unsigned int cpu) · line 83

Quoted 7 lines · Rohit Vaswani
arch/arm/mach-msm/platsmp.c +7 -0
+	sc1_base_ptr = of_iomap(dn, 0);
+	if (sc1_base_ptr) {
+		writel_relaxed(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
+		writel_relaxed(0, sc1_base_ptr + SCSS_CPU1CORE_RESET);
+		writel_relaxed(3, sc1_base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP);
+		mb();
+		iounmap(sc1_base_ptr);

If you need to fiddle with power rails and resets for your secondary core, you don't need any of the pen_release stuff, and you really should get rid of it. The pen_release stuff is only there for platforms where there's no proper way of controlling the secondary CPUs except by using a software method.

#4 lore raw

Re: [PATCH 2/3] ARM: msm: Re-organize platsmp to make it extensible

Quoted 13 lines · Russell King - ARM Linux

arch/arm/mach-msm/platsmp.c static void __cpuinit msm_secondary_init(unsigned int cpu) · line 83

Quoted 7 lines · Rohit Vaswani
arch/arm/mach-msm/platsmp.c +7 -0
+	sc1_base_ptr = of_iomap(dn, 0);
+	if (sc1_base_ptr) {
+		writel_relaxed(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
+		writel_relaxed(0, sc1_base_ptr + SCSS_CPU1CORE_RESET);
+		writel_relaxed(3, sc1_base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP);
+		mb();
+		iounmap(sc1_base_ptr);

If you need to fiddle with power rails and resets for your secondary core, you don't need any of the pen_release stuff, and you really should get rid of it. The pen_release stuff is only there for platforms where there's no proper way of controlling the secondary CPUs except by using a software method.

We currently don't have hotplug support as that also needs pen_release. We still need to do this.
We could change that behavior, but we would need more time for that. Please could we let this go through and cleanup the pen_release once we have hotplug working.

Thanks,
Rohit Vaswani

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

PATCH 3/3 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 2e4d87a..fd2f3ec 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;
@@ -26,6 +42,12 @@
 		cpu-offset = <0x80000>;
 	};
 
+	kpss@2088000 {
+		compatible = "qcom,kpss";
+		reg = <0x02088000 0x1000
+			0x02098000 0x2000>;
+	};
+
 	serial@19c400000 {
 		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