Skip to contentSkip to conversation

ARM: Meson6: enable SMP

PATCH RESEND Superseded Carlo Caione 2 participants 8 messages Nov 14, 2014 – Nov 24, 2014

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

cover ARM: Meson6: enable SMP

Amlogic Meson6 is a dual-core Cortex-A9. This patchset adds all the necessary pieces to boot the secondary CPU.

---

This is a resend of a patchset already submitted a while ago
http://www.spinics.net/lists/arm-kernel/msg366787.html

Carlo Caione (3):
ARM: Meson6: docs: document bindings
ARM: Meson6: Add SMP support for Amlogic Meson6
ARM: Meson6: enable SMP in DTS/DTSI

 .../bindings/arm/meson/amlogic,meson6-cpuconfig    | 16 +++++
 .../bindings/arm/meson/amlogic,meson6-smp          | 26 +++++++
 arch/arm/boot/dts/meson.dtsi                       |  5 ++
 arch/arm/boot/dts/meson6.dtsi                      |  6 ++
 arch/arm/mach-meson/Kconfig                        |  1 +
 arch/arm/mach-meson/Makefile                       |  1 +
 arch/arm/mach-meson/headsmp.S                      |  7 ++
 arch/arm/mach-meson/platsmp.c                      | 80 ++++++++++++++++++++++
 8 files changed, 142 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-cpuconfig
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-smp
 create mode 100644 arch/arm/mach-meson/headsmp.S
 create mode 100644 arch/arm/mach-meson/platsmp.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH RESEND 1/3 ARM: Meson6: docs: document bindings

Documentation for the devicetree bindings introduced with the SMP support

---
 .../bindings/arm/meson/amlogic,meson6-cpuconfig    | 16 +++++++++++++
 .../bindings/arm/meson/amlogic,meson6-smp          | 26 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-cpuconfig
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-smp
Documentation/devicetree/bindings/arm/meson/amlogic,meson6-cpuconfig new file +16 -0
new file mode 100644
index 0000000..2db4cbb
@@ -0,0 +1,16 @@
+Secondary CPU management unit:
+-------------------------------
+
+This document describes the "amlogic,meson6-cpuconfig" node for enabling the
+secondary CPU.
+
+Required node properties:
+- compatible value : = "amlogic,meson6-cpuconfig";
+- reg : physical base address and the size of the registers window
+
+Example:
+
+	cpuconfig at d901ff80 {
+		compatible = "amlogic,meson6-cpuconfig";
+		reg = <0xd901ff80 0x8>;
+	};
Documentation/devicetree/bindings/arm/meson/amlogic,meson6-smp new file +26 -0
new file mode 100644
index 0000000..4130381
@@ -0,0 +1,26 @@
+Secondary CPU enable-method "amlogic,meson6-smp" binding:
+----------------------------------------------------------
+
+This document describes the "amlogic,meson6-smp" method for enabling secondary
+CPUs. To apply to all CPUs, a single "amlogic,meson6-smp" enable method should
+be defined in the "cpus" node.
+
+Example:
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "amlogic,meson6-smp";
+
+		cpu at 200 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0x200>;
+		};
+
+		cpu at 201 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0x201>;
+		};
+	};
Signature · 1 line
1.9.1
#2 lore raw

PATCH RESEND 2/3 ARM: Meson6: Add SMP support for Amlogic Meson6

In reply to Carlo Caione

Amlogic Meson6 is a dual core Cortex-A9. This patch adds the logic to boot up the second CPU.

---
 arch/arm/mach-meson/Kconfig   |  1 +
 arch/arm/mach-meson/Makefile  |  1 +
 arch/arm/mach-meson/headsmp.S |  7 ++++
 arch/arm/mach-meson/platsmp.c | 80 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)
 create mode 100644 arch/arm/mach-meson/headsmp.S
 create mode 100644 arch/arm/mach-meson/platsmp.c
arch/arm/mach-meson/Kconfig +1 -0
index 2c1154e..4e96de4 100644
@@ -2,6 +2,7 @@ menuconfig ARCH_MESON
 	bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
 	select GENERIC_IRQ_CHIP
 	select ARM_GIC
+	select HAVE_ARM_SCU if SMP
 
 if ARCH_MESON
 
arch/arm/mach-meson/Makefile +1 -0
index 9d7380e..4691966 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_ARCH_MESON) += meson.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o
arch/arm/mach-meson/headsmp.S new file +7 -0
new file mode 100644
index 0000000..3347d88
@@ -0,0 +1,7 @@
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+ENTRY(meson_secondary_startup)
+        bl	v7_invalidate_l1
+        b       secondary_startup
+ENDPROC(meson_secondary_startup)
arch/arm/mach-meson/platsmp.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
1.9.1
#3 lore raw

PATCH RESEND 2/3 ARM: Meson6: Add SMP support for Amlogic Meson6

arch/arm/mach-meson/platsmp.c line 17

Quoted 2 lines · Carlo Caione
arch/arm/mach-meson/platsmp.c new file +2 -0
+static void __iomem *cpucfg_membase;
+static void __iomem *scu_membase;

I don't think you need a global scu_membase variable, you use it only in one function.

arch/arm/mach-meson/platsmp.c line 21

Quoted 3 lines
arch/arm/mach-meson/platsmp.c new file +3 -0
+static DEFINE_SPINLOCK(cpu_lock);
+
+extern void meson_secondary_startup(void);

Better put the extern declaration into a header file.

Quoted 11 lines
arch/arm/mach-meson/platsmp.c new file +11 -0
+static void __init meson6_smp_prepare_cpus(unsigned int max_cpus)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
+	if (!node) {
+		pr_err("Missing Meson6 SCU node\n");
+		return;
+	}
+
+	scu_membase = of_iomap(node, 0);

arch/arm/mach-meson/platsmp.c line 43

Quoted 10 lines
arch/arm/mach-meson/platsmp.c new file +10 -0
+	if (!scu_membase) {
+		pr_err("Couln't map Meson6 SCU registers\n");
+		return;
+	}
+
+	node = of_find_compatible_node(NULL, NULL, "amlogic,meson6-cpuconfig");
+	if (!node) {
+		pr_err("Missing Meson6 CPU config node\n");
+		return;
+	}

I'm not sure about the "amlogic,meson6-cpuconfig" device node. Since this is just an 8-byte register range, I suspect it's actually part of a larger device, so you should better represent that instead. We can now have early "syscon" devices (in linux-next I think), so you could instead make this a device that is compatible with "syscon" and have the smp code look that up and apply an appropriate offset. Do you have an idea of which device this is part of?

Arnd

#4 lore raw

PATCH RESEND 3/3 ARM: Meson6: enable SMP in DTS/DTSI

In reply to Carlo Caione
---
 arch/arm/boot/dts/meson.dtsi  | 5 +++++
 arch/arm/boot/dts/meson6.dtsi | 6 ++++++
 2 files changed, 11 insertions(+)
arch/arm/boot/dts/meson.dtsi +5 -0
index e6539ea..6178756 100644
@@ -64,6 +64,11 @@
 		interrupts = <0 10 1>;
 	};
 
+	scu at c4300000 {
+		compatible = "arm,cortex-a9-scu";
+		reg = <0xc4300000 0x1000>;
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
arch/arm/boot/dts/meson6.dtsi +6 -0
index 4ba4912..6e7230f 100644
@@ -56,6 +56,7 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "amlogic,meson6-smp";
 
 		cpu at 200 {
 			device_type = "cpu";
@@ -70,6 +71,11 @@
 		};
 	};
 
+	cpuconfig at d901ff80 {
+		compatible = "amlogic,meson6-cpuconfig";
+		reg = <0xd901ff80 0x8>;
+	};
+
 	clk81: clk at 0 {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
Signature · 1 line
1.9.1
#5 lore raw

cover ARM: Meson6: enable SMP

In reply to Carlo Caione
Quoted 13 lines · Carlo Caione

Amlogic Meson6 is a dual-core Cortex-A9. This patchset adds all the necessary pieces to boot the secondary CPU.

---

This is a resend of a patchset already submitted a while ago
http://www.spinics.net/lists/arm-kernel/msg366787.html

Carlo Caione (3):
ARM: Meson6: docs: document bindings
ARM: Meson6: Add SMP support for Amlogic Meson6
ARM: Meson6: enable SMP in DTS/DTSI

Quoted 13 lines
 .../bindings/arm/meson/amlogic,meson6-cpuconfig    | 16 +++++
 .../bindings/arm/meson/amlogic,meson6-smp          | 26 +++++++
 arch/arm/boot/dts/meson.dtsi                       |  5 ++
 arch/arm/boot/dts/meson6.dtsi                      |  6 ++
 arch/arm/mach-meson/Kconfig                        |  1 +
 arch/arm/mach-meson/Makefile                       |  1 +
 arch/arm/mach-meson/headsmp.S                      |  7 ++
 arch/arm/mach-meson/platsmp.c                      | 80 ++++++++++++++++++++++
 8 files changed, 142 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-cpuconfig
 create mode 100644 Documentation/devicetree/bindings/arm/meson/amlogic,meson6-smp
 create mode 100644 arch/arm/mach-meson/headsmp.S
 create mode 100644 arch/arm/mach-meson/platsmp.c

Ping

Signature · 1 line
Carlo Caione
#6 lore raw

cover ARM: Meson6: enable SMP

Quoted 11 lines · On Sunday 23 November 2014 12:48:31 Carlo Caione wrote:
Quoted 8 lines · Carlo Caione

Amlogic Meson6 is a dual-core Cortex-A9. This patchset adds all the necessary pieces to boot the secondary CPU.

---

This is a resend of a patchset already submitted a while ago
http://www.spinics.net/lists/arm-kernel/msg366787.html

Ping

Hi Carlo,

Is this for arm-soc? I guess from the contents that it is, but you had 10 people in 'To', and you don't say in the introductory mail what you would like to happen with these patches.

When you send something for inclusion in arm-soc, please always send it 'To: arm at kernel.org' with everyone else on Cc instead of To, and be explicit with whether you think the contents are ready to be merged or whether you would like to see more review.

Arnd

#7 lore raw

cover ARM: Meson6: enable SMP

Quoted 15 lines · Arnd Bergmann
Quoted 11 lines · On Sunday 23 November 2014 12:48:31 Carlo Caione wrote:
Quoted 8 lines · Carlo Caione

Amlogic Meson6 is a dual-core Cortex-A9. This patchset adds all the necessary pieces to boot the secondary CPU.

---

This is a resend of a patchset already submitted a while ago
http://www.spinics.net/lists/arm-kernel/msg366787.html

Ping

Hi Carlo,

Quoted 8 lines

Is this for arm-soc? I guess from the contents that it is, but you had 10 people in 'To', and you don't say in the introductory mail what you would like to happen with these patches.

When you send something for inclusion in arm-soc, please always send it 'To: arm at kernel.org' with everyone else on Cc instead of To, and be explicit with whether you think the contents are ready to be merged or whether you would like to see more review.

Hi Arnd,
my ping was because I haven't received any feedback on the patchset. Taking the silence as an ACK I'll take the patches in my repo to pull to arm-soc within the next pull request.

Thanks,

Signature · 1 line
Carlo Caione