All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP
@ 2018-03-08 15:00 ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

Hi,

This series is a bit of cleanup and improvement for the new
multi-cluster SMP code for Allwinner A80 and A83T (soon) SoCs.

The first patch is just a typo fix.

The second and third patch add the use of the "enable-method" cpu
property to enable SMP, instead of matching against the machine
compatible. However, due to how init calls are sequenced, we still
need to use a platform early_init call.

The last patch splits out parts of the SoC-specific init code, i.e.
the device node matching parts. This should help with Mylene's work
on adding support for the A83T.

Please have a look.

Regards
ChenYu

Chen-Yu Tsai (4):
  ARM: sunxi: mc-smp: Fix "lookback" typo
  ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
  ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
  ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/sun9i-a80.dtsi               |   8 ++
 arch/arm/mach-sunxi/mc_smp.c                   | 147 ++++++++++++++++++-------
 3 files changed, 115 insertions(+), 41 deletions(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP
@ 2018-03-08 15:00 ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This series is a bit of cleanup and improvement for the new
multi-cluster SMP code for Allwinner A80 and A83T (soon) SoCs.

The first patch is just a typo fix.

The second and third patch add the use of the "enable-method" cpu
property to enable SMP, instead of matching against the machine
compatible. However, due to how init calls are sequenced, we still
need to use a platform early_init call.

The last patch splits out parts of the SoC-specific init code, i.e.
the device node matching parts. This should help with Mylene's work
on adding support for the A83T.

Please have a look.

Regards
ChenYu

Chen-Yu Tsai (4):
  ARM: sunxi: mc-smp: Fix "lookback" typo
  ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
  ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
  ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/sun9i-a80.dtsi               |   8 ++
 arch/arm/mach-sunxi/mc_smp.c                   | 147 ++++++++++++++++++-------
 3 files changed, 115 insertions(+), 41 deletions(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ARM: sunxi: mc-smp: Fix "lookback" typo
  2018-03-08 15:00 ` Chen-Yu Tsai
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

The sunxi_mc_smp_lookback function is modeled after the mcpm_loopback
function in the MCPM framework. "lookback" was a typo introduced when
the new function was added.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/mach-sunxi/mc_smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 11e46c6efb90..9db6c4ed5861 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -659,7 +659,7 @@ static int __init nocache_trampoline(unsigned long __unused)
 	BUG();
 }
 
-static int __init sunxi_mc_smp_lookback(void)
+static int __init sunxi_mc_smp_loopback(void)
 {
 	int ret;
 
@@ -749,7 +749,7 @@ static int __init sunxi_mc_smp_init(void)
 	}
 
 	/* Configure CCI-400 for boot cluster */
-	ret = sunxi_mc_smp_lookback();
+	ret = sunxi_mc_smp_loopback();
 	if (ret) {
 		pr_err("%s: failed to configure boot cluster: %d\n",
 		       __func__, ret);
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ARM: sunxi: mc-smp: Fix "lookback" typo
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

The sunxi_mc_smp_lookback function is modeled after the mcpm_loopback
function in the MCPM framework. "lookback" was a typo introduced when
the new function was added.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/mach-sunxi/mc_smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 11e46c6efb90..9db6c4ed5861 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -659,7 +659,7 @@ static int __init nocache_trampoline(unsigned long __unused)
 	BUG();
 }
 
-static int __init sunxi_mc_smp_lookback(void)
+static int __init sunxi_mc_smp_loopback(void)
 {
 	int ret;
 
@@ -749,7 +749,7 @@ static int __init sunxi_mc_smp_init(void)
 	}
 
 	/* Configure CCI-400 for boot cluster */
-	ret = sunxi_mc_smp_lookback();
+	ret = sunxi_mc_smp_loopback();
 	if (ret) {
 		pr_err("%s: failed to configure boot cluster: %d\n",
 		       __func__, ret);
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
  2018-03-08 15:00 ` Chen-Yu Tsai
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

Instead of having an early init function check the machine compatible
and installing multi-cluster SMP support for the A80 if it matches,
use a new cpu enable-method string. This makes the platform support
future proof in case anyone manages to add PSCI support.

The original init code for the SMP support is changed into the
.prepare_cpus callback in the smp_operations structure. Instead of
panicing when resources are missing like on some platforms, our code
merely guards against engaging SMP or CPU hotplug and returns an error.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/mach-sunxi/mc_smp.c                   | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index f4a777039f03..76655d0d67c2 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -198,6 +198,7 @@ described below.
 			    "actions,s500-smp"
 			    "allwinner,sun6i-a31"
 			    "allwinner,sun8i-a23"
+			    "allwinner,sun9i-a80-smp"
 			    "amlogic,meson8-smp"
 			    "amlogic,meson8b-smp"
 			    "arm,realview-smp"
diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 9db6c4ed5861..86e90b038555 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -690,7 +690,26 @@ static int __init sunxi_mc_smp_init(void)
 	struct resource res;
 	int ret;
 
-	if (!of_machine_is_compatible("allwinner,sun9i-a80"))
+	/*
+	 * Don't bother checking the "cpus" node, as an enable-method
+	 * property in that node is undocumented.
+	 */
+	node = of_cpu_device_node_get(0);
+	if (!node)
+		return -ENODEV;
+
+	/*
+	 * We can't actually use the enable-method magic in the kernel.
+	 * Our loopback / trampoline code uses the CPU suspend framework,
+	 * which requires the identity mapping be available. It would not
+	 * yet be available if we used the .init_cpus or .prepare_cpus
+	 * callbacks in smp_operations, which we would use if we were to
+	 * use CPU_METHOD_OF_DECLARE
+	 */
+	ret = of_property_match_string(node, "enable-method",
+				       "allwinner,sun9i-a80-smp");
+	of_node_put(node);
+	if (ret)
 		return -ENODEV;
 
 	if (!sunxi_mc_smp_cpu_table_init())
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of having an early init function check the machine compatible
and installing multi-cluster SMP support for the A80 if it matches,
use a new cpu enable-method string. This makes the platform support
future proof in case anyone manages to add PSCI support.

The original init code for the SMP support is changed into the
.prepare_cpus callback in the smp_operations structure. Instead of
panicing when resources are missing like on some platforms, our code
merely guards against engaging SMP or CPU hotplug and returns an error.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/mach-sunxi/mc_smp.c                   | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index f4a777039f03..76655d0d67c2 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -198,6 +198,7 @@ described below.
 			    "actions,s500-smp"
 			    "allwinner,sun6i-a31"
 			    "allwinner,sun8i-a23"
+			    "allwinner,sun9i-a80-smp"
 			    "amlogic,meson8-smp"
 			    "amlogic,meson8b-smp"
 			    "arm,realview-smp"
diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 9db6c4ed5861..86e90b038555 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -690,7 +690,26 @@ static int __init sunxi_mc_smp_init(void)
 	struct resource res;
 	int ret;
 
-	if (!of_machine_is_compatible("allwinner,sun9i-a80"))
+	/*
+	 * Don't bother checking the "cpus" node, as an enable-method
+	 * property in that node is undocumented.
+	 */
+	node = of_cpu_device_node_get(0);
+	if (!node)
+		return -ENODEV;
+
+	/*
+	 * We can't actually use the enable-method magic in the kernel.
+	 * Our loopback / trampoline code uses the CPU suspend framework,
+	 * which requires the identity mapping be available. It would not
+	 * yet be available if we used the .init_cpus or .prepare_cpus
+	 * callbacks in smp_operations, which we would use if we were to
+	 * use CPU_METHOD_OF_DECLARE
+	 */
+	ret = of_property_match_string(node, "enable-method",
+				       "allwinner,sun9i-a80-smp");
+	of_node_put(node);
+	if (ret)
 		return -ENODEV;
 
 	if (!sunxi_mc_smp_cpu_table_init())
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
  2018-03-08 15:00 ` Chen-Yu Tsai
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

Using the enable-method property for SMP support would allow future PSCI
implementations to override any in-OS support. This is better than just
matching against the machine compatible, and then having to determine
whether other methods are available or not.

This adds enable-method properties to all CPU nodes.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
index b1c86b76ac3c..82a770a5ba46 100644
--- a/arch/arm/boot/dts/sun9i-a80.dtsi
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
@@ -65,6 +65,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x0>;
 		};
 
@@ -73,6 +74,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x1>;
 		};
 
@@ -81,6 +83,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x2>;
 		};
 
@@ -89,6 +92,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x3>;
 		};
 
@@ -97,6 +101,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x100>;
 		};
 
@@ -105,6 +110,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x101>;
 		};
 
@@ -113,6 +119,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x102>;
 		};
 
@@ -121,6 +128,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x103>;
 		};
 	};
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

Using the enable-method property for SMP support would allow future PSCI
implementations to override any in-OS support. This is better than just
matching against the machine compatible, and then having to determine
whether other methods are available or not.

This adds enable-method properties to all CPU nodes.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
index b1c86b76ac3c..82a770a5ba46 100644
--- a/arch/arm/boot/dts/sun9i-a80.dtsi
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
@@ -65,6 +65,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x0>;
 		};
 
@@ -73,6 +74,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x1>;
 		};
 
@@ -81,6 +83,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x2>;
 		};
 
@@ -89,6 +92,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control0>;
 			clock-frequency = <12000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x3>;
 		};
 
@@ -97,6 +101,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x100>;
 		};
 
@@ -105,6 +110,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x101>;
 		};
 
@@ -113,6 +119,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x102>;
 		};
 
@@ -121,6 +128,7 @@
 			device_type = "cpu";
 			cci-control-port = <&cci_control1>;
 			clock-frequency = <18000000>;
+			enable-method = "allwinner,sun9i-a80-smp";
 			reg = <0x103>;
 		};
 	};
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence
  2018-03-08 15:00 ` Chen-Yu Tsai
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

The multi-cluster SMP code maps the address spaces of several hardware
control blocks. The device nodes for them are SoC-specific. To help with
supporting other SoCs to re-use this code, these bits should be split
out to a separate function tied to the enable-method string.

This patch splits out and groups the device node lookup sequence, and
adds new data structures to have the newly created function tied to
the enable method string. This structure can also be used to encode
other differences between the SoCs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

Hi Mylene,

I suggest you use this patch as a start, and add the A83T specific bits
accordingly, such as handling the r_cpucfg node in the new *_nodes code,
and adding an "is_sun9i" field to sunxi_mc_smp_data. It should be better
than what you already have.

---
 arch/arm/mach-sunxi/mc_smp.c | 126 +++++++++++++++++++++++++++++--------------
 1 file changed, 86 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 86e90b038555..c0246ec54a0a 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -684,11 +684,69 @@ static int __init sunxi_mc_smp_loopback(void)
 	return ret;
 }
 
+/*
+ * This holds any device nodes that we requested resources for,
+ * so that we may easily release resources in the error path.
+ */
+struct sunxi_mc_smp_nodes {
+	struct device_node *prcm_node;
+	struct device_node *cpucfg_node;
+	struct device_node *sram_node;
+};
+
+/* This structure holds SoC-specific bits tied to an enable-method string. */
+struct sunxi_mc_smp_data {
+	const char *enable_method;
+	int (*get_smp_nodes)(struct sunxi_mc_smp_nodes *nodes);
+};
+
+static void __init sunxi_mc_smp_put_nodes(struct sunxi_mc_smp_nodes *nodes)
+{
+	of_node_put(nodes->prcm_node);
+	of_node_put(nodes->cpucfg_node);
+	of_node_put(nodes->sram_node);
+	memset(nodes, 0, sizeof(*nodes));
+}
+
+static int __init sun9i_a80_get_smp_nodes(struct sunxi_mc_smp_nodes *nodes)
+{
+	nodes->prcm_node = of_find_compatible_node(NULL, NULL,
+						   "allwinner,sun9i-a80-prcm");
+	if (!nodes->prcm_node) {
+		pr_err("%s: PRCM not available\n", __func__);
+		return -ENODEV;
+	}
+
+	nodes->cpucfg_node = of_find_compatible_node(NULL, NULL,
+						     "allwinner,sun9i-a80-cpucfg");
+	if (!nodes->cpucfg_node) {
+		pr_err("%s: CPUCFG not available\n", __func__);
+		return -ENODEV;
+	}
+
+	nodes->sram_node = of_find_compatible_node(NULL, NULL,
+						   "allwinner,sun9i-a80-smp-sram");
+	if (!nodes->sram_node) {
+		pr_err("%s: Secure SRAM not available\n", __func__);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static const struct sunxi_mc_smp_data sunxi_mc_smp_data[] __initconst = {
+	{
+		.enable_method	= "allwinner,sun9i-a80-smp",
+		.get_smp_nodes	= sun9i_a80_get_smp_nodes,
+	},
+};
+
 static int __init sunxi_mc_smp_init(void)
 {
-	struct device_node *cpucfg_node, *sram_node, *node;
+	struct sunxi_mc_smp_nodes nodes = { 0 };
+	struct device_node *node;
 	struct resource res;
-	int ret;
+	int i, ret;
 
 	/*
 	 * Don't bother checking the "cpus" node, as an enable-method
@@ -706,8 +764,13 @@ static int __init sunxi_mc_smp_init(void)
 	 * callbacks in smp_operations, which we would use if we were to
 	 * use CPU_METHOD_OF_DECLARE
 	 */
-	ret = of_property_match_string(node, "enable-method",
-				       "allwinner,sun9i-a80-smp");
+	for (i = 0; i < ARRAY_SIZE(sunxi_mc_smp_data); i++) {
+		ret = of_property_match_string(node, "enable-method",
+					       sunxi_mc_smp_data[i].enable_method);
+		if (!ret)
+			break;
+	}
+
 	of_node_put(node);
 	if (ret)
 		return -ENODEV;
@@ -720,51 +783,37 @@ static int __init sunxi_mc_smp_init(void)
 		return -ENODEV;
 	}
 
-	node = of_find_compatible_node(NULL, NULL, "allwinner,sun9i-a80-prcm");
-	if (!node) {
-		pr_err("%s: PRCM not available\n", __func__);
-		return -ENODEV;
-	}
+	/* Get needed device tree nodes */
+	ret = sunxi_mc_smp_data[i].get_smp_nodes(&nodes);
+	if (ret)
+		goto err_put_nodes;
 
 	/*
 	 * Unfortunately we can not request the I/O region for the PRCM.
 	 * It is shared with the PRCM clock.
 	 */
-	prcm_base = of_iomap(node, 0);
-	of_node_put(node);
+	prcm_base = of_iomap(nodes.prcm_node, 0);
 	if (!prcm_base) {
 		pr_err("%s: failed to map PRCM registers\n", __func__);
-		return -ENOMEM;
-	}
-
-	cpucfg_node = of_find_compatible_node(NULL, NULL,
-					      "allwinner,sun9i-a80-cpucfg");
-	if (!cpucfg_node) {
-		ret = -ENODEV;
-		pr_err("%s: CPUCFG not available\n", __func__);
-		goto err_unmap_prcm;
+		ret = -ENOMEM;
+		goto err_put_nodes;
 	}
 
-	cpucfg_base = of_io_request_and_map(cpucfg_node, 0, "sunxi-mc-smp");
+	cpucfg_base = of_io_request_and_map(nodes.cpucfg_node, 0,
+					    "sunxi-mc-smp");
 	if (IS_ERR(cpucfg_base)) {
 		ret = PTR_ERR(cpucfg_base);
 		pr_err("%s: failed to map CPUCFG registers: %d\n",
 		       __func__, ret);
-		goto err_put_cpucfg_node;
-	}
-
-	sram_node = of_find_compatible_node(NULL, NULL,
-					    "allwinner,sun9i-a80-smp-sram");
-	if (!sram_node) {
-		ret = -ENODEV;
-		goto err_unmap_release_cpucfg;
+		goto err_unmap_prcm;
 	}
 
-	sram_b_smp_base = of_io_request_and_map(sram_node, 0, "sunxi-mc-smp");
+	sram_b_smp_base = of_io_request_and_map(nodes.sram_node, 0,
+						"sunxi-mc-smp");
 	if (IS_ERR(sram_b_smp_base)) {
 		ret = PTR_ERR(sram_b_smp_base);
 		pr_err("%s: failed to map secure SRAM\n", __func__);
-		goto err_put_sram_node;
+		goto err_unmap_release_cpucfg;
 	}
 
 	/* Configure CCI-400 for boot cluster */
@@ -775,9 +824,8 @@ static int __init sunxi_mc_smp_init(void)
 		goto err_unmap_release_secure_sram;
 	}
 
-	/* We don't need the CPUCFG and SRAM device nodes anymore */
-	of_node_put(cpucfg_node);
-	of_node_put(sram_node);
+	/* We don't need the device nodes anymore */
+	sunxi_mc_smp_put_nodes(&nodes);
 
 	/* Set the hardware entry point address */
 	writel(__pa_symbol(sunxi_mc_smp_secondary_startup),
@@ -792,18 +840,16 @@ static int __init sunxi_mc_smp_init(void)
 
 err_unmap_release_secure_sram:
 	iounmap(sram_b_smp_base);
-	of_address_to_resource(sram_node, 0, &res);
+	of_address_to_resource(nodes.sram_node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
-err_put_sram_node:
-	of_node_put(sram_node);
 err_unmap_release_cpucfg:
 	iounmap(cpucfg_base);
-	of_address_to_resource(cpucfg_node, 0, &res);
+	of_address_to_resource(nodes.cpucfg_node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
-err_put_cpucfg_node:
-	of_node_put(cpucfg_node);
 err_unmap_prcm:
 	iounmap(prcm_base);
+err_put_nodes:
+	sunxi_mc_smp_put_nodes(&nodes);
 	return ret;
 }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence
@ 2018-03-08 15:00   ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-08 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

The multi-cluster SMP code maps the address spaces of several hardware
control blocks. The device nodes for them are SoC-specific. To help with
supporting other SoCs to re-use this code, these bits should be split
out to a separate function tied to the enable-method string.

This patch splits out and groups the device node lookup sequence, and
adds new data structures to have the newly created function tied to
the enable method string. This structure can also be used to encode
other differences between the SoCs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

Hi Mylene,

I suggest you use this patch as a start, and add the A83T specific bits
accordingly, such as handling the r_cpucfg node in the new *_nodes code,
and adding an "is_sun9i" field to sunxi_mc_smp_data. It should be better
than what you already have.

---
 arch/arm/mach-sunxi/mc_smp.c | 126 +++++++++++++++++++++++++++++--------------
 1 file changed, 86 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 86e90b038555..c0246ec54a0a 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -684,11 +684,69 @@ static int __init sunxi_mc_smp_loopback(void)
 	return ret;
 }
 
+/*
+ * This holds any device nodes that we requested resources for,
+ * so that we may easily release resources in the error path.
+ */
+struct sunxi_mc_smp_nodes {
+	struct device_node *prcm_node;
+	struct device_node *cpucfg_node;
+	struct device_node *sram_node;
+};
+
+/* This structure holds SoC-specific bits tied to an enable-method string. */
+struct sunxi_mc_smp_data {
+	const char *enable_method;
+	int (*get_smp_nodes)(struct sunxi_mc_smp_nodes *nodes);
+};
+
+static void __init sunxi_mc_smp_put_nodes(struct sunxi_mc_smp_nodes *nodes)
+{
+	of_node_put(nodes->prcm_node);
+	of_node_put(nodes->cpucfg_node);
+	of_node_put(nodes->sram_node);
+	memset(nodes, 0, sizeof(*nodes));
+}
+
+static int __init sun9i_a80_get_smp_nodes(struct sunxi_mc_smp_nodes *nodes)
+{
+	nodes->prcm_node = of_find_compatible_node(NULL, NULL,
+						   "allwinner,sun9i-a80-prcm");
+	if (!nodes->prcm_node) {
+		pr_err("%s: PRCM not available\n", __func__);
+		return -ENODEV;
+	}
+
+	nodes->cpucfg_node = of_find_compatible_node(NULL, NULL,
+						     "allwinner,sun9i-a80-cpucfg");
+	if (!nodes->cpucfg_node) {
+		pr_err("%s: CPUCFG not available\n", __func__);
+		return -ENODEV;
+	}
+
+	nodes->sram_node = of_find_compatible_node(NULL, NULL,
+						   "allwinner,sun9i-a80-smp-sram");
+	if (!nodes->sram_node) {
+		pr_err("%s: Secure SRAM not available\n", __func__);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static const struct sunxi_mc_smp_data sunxi_mc_smp_data[] __initconst = {
+	{
+		.enable_method	= "allwinner,sun9i-a80-smp",
+		.get_smp_nodes	= sun9i_a80_get_smp_nodes,
+	},
+};
+
 static int __init sunxi_mc_smp_init(void)
 {
-	struct device_node *cpucfg_node, *sram_node, *node;
+	struct sunxi_mc_smp_nodes nodes = { 0 };
+	struct device_node *node;
 	struct resource res;
-	int ret;
+	int i, ret;
 
 	/*
 	 * Don't bother checking the "cpus" node, as an enable-method
@@ -706,8 +764,13 @@ static int __init sunxi_mc_smp_init(void)
 	 * callbacks in smp_operations, which we would use if we were to
 	 * use CPU_METHOD_OF_DECLARE
 	 */
-	ret = of_property_match_string(node, "enable-method",
-				       "allwinner,sun9i-a80-smp");
+	for (i = 0; i < ARRAY_SIZE(sunxi_mc_smp_data); i++) {
+		ret = of_property_match_string(node, "enable-method",
+					       sunxi_mc_smp_data[i].enable_method);
+		if (!ret)
+			break;
+	}
+
 	of_node_put(node);
 	if (ret)
 		return -ENODEV;
@@ -720,51 +783,37 @@ static int __init sunxi_mc_smp_init(void)
 		return -ENODEV;
 	}
 
-	node = of_find_compatible_node(NULL, NULL, "allwinner,sun9i-a80-prcm");
-	if (!node) {
-		pr_err("%s: PRCM not available\n", __func__);
-		return -ENODEV;
-	}
+	/* Get needed device tree nodes */
+	ret = sunxi_mc_smp_data[i].get_smp_nodes(&nodes);
+	if (ret)
+		goto err_put_nodes;
 
 	/*
 	 * Unfortunately we can not request the I/O region for the PRCM.
 	 * It is shared with the PRCM clock.
 	 */
-	prcm_base = of_iomap(node, 0);
-	of_node_put(node);
+	prcm_base = of_iomap(nodes.prcm_node, 0);
 	if (!prcm_base) {
 		pr_err("%s: failed to map PRCM registers\n", __func__);
-		return -ENOMEM;
-	}
-
-	cpucfg_node = of_find_compatible_node(NULL, NULL,
-					      "allwinner,sun9i-a80-cpucfg");
-	if (!cpucfg_node) {
-		ret = -ENODEV;
-		pr_err("%s: CPUCFG not available\n", __func__);
-		goto err_unmap_prcm;
+		ret = -ENOMEM;
+		goto err_put_nodes;
 	}
 
-	cpucfg_base = of_io_request_and_map(cpucfg_node, 0, "sunxi-mc-smp");
+	cpucfg_base = of_io_request_and_map(nodes.cpucfg_node, 0,
+					    "sunxi-mc-smp");
 	if (IS_ERR(cpucfg_base)) {
 		ret = PTR_ERR(cpucfg_base);
 		pr_err("%s: failed to map CPUCFG registers: %d\n",
 		       __func__, ret);
-		goto err_put_cpucfg_node;
-	}
-
-	sram_node = of_find_compatible_node(NULL, NULL,
-					    "allwinner,sun9i-a80-smp-sram");
-	if (!sram_node) {
-		ret = -ENODEV;
-		goto err_unmap_release_cpucfg;
+		goto err_unmap_prcm;
 	}
 
-	sram_b_smp_base = of_io_request_and_map(sram_node, 0, "sunxi-mc-smp");
+	sram_b_smp_base = of_io_request_and_map(nodes.sram_node, 0,
+						"sunxi-mc-smp");
 	if (IS_ERR(sram_b_smp_base)) {
 		ret = PTR_ERR(sram_b_smp_base);
 		pr_err("%s: failed to map secure SRAM\n", __func__);
-		goto err_put_sram_node;
+		goto err_unmap_release_cpucfg;
 	}
 
 	/* Configure CCI-400 for boot cluster */
@@ -775,9 +824,8 @@ static int __init sunxi_mc_smp_init(void)
 		goto err_unmap_release_secure_sram;
 	}
 
-	/* We don't need the CPUCFG and SRAM device nodes anymore */
-	of_node_put(cpucfg_node);
-	of_node_put(sram_node);
+	/* We don't need the device nodes anymore */
+	sunxi_mc_smp_put_nodes(&nodes);
 
 	/* Set the hardware entry point address */
 	writel(__pa_symbol(sunxi_mc_smp_secondary_startup),
@@ -792,18 +840,16 @@ static int __init sunxi_mc_smp_init(void)
 
 err_unmap_release_secure_sram:
 	iounmap(sram_b_smp_base);
-	of_address_to_resource(sram_node, 0, &res);
+	of_address_to_resource(nodes.sram_node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
-err_put_sram_node:
-	of_node_put(sram_node);
 err_unmap_release_cpucfg:
 	iounmap(cpucfg_base);
-	of_address_to_resource(cpucfg_node, 0, &res);
+	of_address_to_resource(nodes.cpucfg_node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
-err_put_cpucfg_node:
-	of_node_put(cpucfg_node);
 err_unmap_prcm:
 	iounmap(prcm_base);
+err_put_nodes:
+	sunxi_mc_smp_put_nodes(&nodes);
 	return ret;
 }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ARM: sunxi: mc-smp: Fix "lookback" typo
  2018-03-08 15:00   ` Chen-Yu Tsai
@ 2018-03-08 15:08     ` Maxime Ripard
  -1 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:08 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Mark Rutland, Mylene Josserand, linux-arm-kernel,
	linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Thu, Mar 08, 2018 at 11:00:09PM +0800, Chen-Yu Tsai wrote:
> The sunxi_mc_smp_lookback function is modeled after the mcpm_loopback
> function in the MCPM framework. "lookback" was a typo introduced when
> the new function was added.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ARM: sunxi: mc-smp: Fix "lookback" typo
@ 2018-03-08 15:08     ` Maxime Ripard
  0 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:09PM +0800, Chen-Yu Tsai wrote:
> The sunxi_mc_smp_lookback function is modeled after the mcpm_loopback
> function in the MCPM framework. "lookback" was a typo introduced when
> the new function was added.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180308/cf7cb094/attachment.sig>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
  2018-03-08 15:00   ` Chen-Yu Tsai
@ 2018-03-08 15:09     ` Maxime Ripard
  -1 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:09 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Mark Rutland, Mylene Josserand, linux-arm-kernel,
	linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On Thu, Mar 08, 2018 at 11:00:10PM +0800, Chen-Yu Tsai wrote:
> Instead of having an early init function check the machine compatible
> and installing multi-cluster SMP support for the A80 if it matches,
> use a new cpu enable-method string. This makes the platform support
> future proof in case anyone manages to add PSCI support.
> 
> The original init code for the SMP support is changed into the
> .prepare_cpus callback in the smp_operations structure. Instead of
> panicing when resources are missing like on some platforms, our code
> merely guards against engaging SMP or CPU hotplug and returns an error.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
@ 2018-03-08 15:09     ` Maxime Ripard
  0 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:10PM +0800, Chen-Yu Tsai wrote:
> Instead of having an early init function check the machine compatible
> and installing multi-cluster SMP support for the A80 if it matches,
> use a new cpu enable-method string. This makes the platform support
> future proof in case anyone manages to add PSCI support.
> 
> The original init code for the SMP support is changed into the
> .prepare_cpus callback in the smp_operations structure. Instead of
> panicing when resources are missing like on some platforms, our code
> merely guards against engaging SMP or CPU hotplug and returns an error.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180308/3883f2fb/attachment.sig>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/4] ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
  2018-03-08 15:00   ` Chen-Yu Tsai
@ 2018-03-08 15:09     ` Maxime Ripard
  -1 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:09 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Mark Rutland, Mylene Josserand, linux-arm-kernel,
	linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

On Thu, Mar 08, 2018 at 11:00:11PM +0800, Chen-Yu Tsai wrote:
> Using the enable-method property for SMP support would allow future PSCI
> implementations to override any in-OS support. This is better than just
> matching against the machine compatible, and then having to determine
> whether other methods are available or not.
> 
> This adds enable-method properties to all CPU nodes.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
@ 2018-03-08 15:09     ` Maxime Ripard
  0 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:11PM +0800, Chen-Yu Tsai wrote:
> Using the enable-method property for SMP support would allow future PSCI
> implementations to override any in-OS support. This is better than just
> matching against the machine compatible, and then having to determine
> whether other methods are available or not.
> 
> This adds enable-method properties to all CPU nodes.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180308/10a5f26d/attachment.sig>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/4] ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence
  2018-03-08 15:00   ` Chen-Yu Tsai
@ 2018-03-08 15:13     ` Maxime Ripard
  -1 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:13 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Rob Herring, Mark Rutland, Mylene Josserand, linux-arm-kernel,
	linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

On Thu, Mar 08, 2018 at 11:00:12PM +0800, Chen-Yu Tsai wrote:
> The multi-cluster SMP code maps the address spaces of several hardware
> control blocks. The device nodes for them are SoC-specific. To help with
> supporting other SoCs to re-use this code, these bits should be split
> out to a separate function tied to the enable-method string.
> 
> This patch splits out and groups the device node lookup sequence, and
> adds new data structures to have the newly created function tied to
> the enable method string. This structure can also be used to encode
> other differences between the SoCs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence
@ 2018-03-08 15:13     ` Maxime Ripard
  0 siblings, 0 replies; 22+ messages in thread
From: Maxime Ripard @ 2018-03-08 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:12PM +0800, Chen-Yu Tsai wrote:
> The multi-cluster SMP code maps the address spaces of several hardware
> control blocks. The device nodes for them are SoC-specific. To help with
> supporting other SoCs to re-use this code, these bits should be split
> out to a separate function tied to the enable-method string.
> 
> This patch splits out and groups the device node lookup sequence, and
> adds new data structures to have the newly created function tied to
> the enable method string. This structure can also be used to encode
> other differences between the SoCs.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180308/09c92a40/attachment.sig>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
  2018-03-08 15:00   ` Chen-Yu Tsai
@ 2018-03-09 23:50     ` Rob Herring
  -1 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2018-03-09 23:50 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Mark Rutland, devicetree, Mylene Josserand,
	linux-kernel, linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:10PM +0800, Chen-Yu Tsai wrote:
> Instead of having an early init function check the machine compatible
> and installing multi-cluster SMP support for the A80 if it matches,
> use a new cpu enable-method string. This makes the platform support
> future proof in case anyone manages to add PSCI support.
> 
> The original init code for the SMP support is changed into the
> .prepare_cpus callback in the smp_operations structure. Instead of
> panicing when resources are missing like on some platforms, our code
> merely guards against engaging SMP or CPU hotplug and returns an error.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  Documentation/devicetree/bindings/arm/cpus.txt |  1 +

Reviewed-by: Rob Herring <robh@kernel.org>

>  arch/arm/mach-sunxi/mc_smp.c                   | 21 ++++++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
@ 2018-03-09 23:50     ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2018-03-09 23:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 08, 2018 at 11:00:10PM +0800, Chen-Yu Tsai wrote:
> Instead of having an early init function check the machine compatible
> and installing multi-cluster SMP support for the A80 if it matches,
> use a new cpu enable-method string. This makes the platform support
> future proof in case anyone manages to add PSCI support.
> 
> The original init code for the SMP support is changed into the
> .prepare_cpus callback in the smp_operations structure. Instead of
> panicing when resources are missing like on some platforms, our code
> merely guards against engaging SMP or CPU hotplug and returns an error.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  Documentation/devicetree/bindings/arm/cpus.txt |  1 +

Reviewed-by: Rob Herring <robh@kernel.org>

>  arch/arm/mach-sunxi/mc_smp.c                   | 21 ++++++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP
  2018-03-08 15:00 ` Chen-Yu Tsai
@ 2018-03-10  8:16   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-10  8:16 UTC (permalink / raw)
  To: Maxime Ripard, Rob Herring, Mark Rutland
  Cc: Chen-Yu Tsai, Mylene Josserand, linux-arm-kernel, linux-kernel,
	devicetree

On Thu, Mar 8, 2018 at 11:00 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> Hi,
>
> This series is a bit of cleanup and improvement for the new
> multi-cluster SMP code for Allwinner A80 and A83T (soon) SoCs.
>
> The first patch is just a typo fix.
>
> The second and third patch add the use of the "enable-method" cpu
> property to enable SMP, instead of matching against the machine
> compatible. However, due to how init calls are sequenced, we still
> need to use a platform early_init call.
>
> The last patch splits out parts of the SoC-specific init code, i.e.
> the device node matching parts. This should help with Mylene's work
> on adding support for the A83T.
>
> Please have a look.
>
> Regards
> ChenYu
>
> Chen-Yu Tsai (4):
>   ARM: sunxi: mc-smp: Fix "lookback" typo
>   ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
>   ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
>   ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence

Merged all 4 patches.

ChenYu

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP
@ 2018-03-10  8:16   ` Chen-Yu Tsai
  0 siblings, 0 replies; 22+ messages in thread
From: Chen-Yu Tsai @ 2018-03-10  8:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 8, 2018 at 11:00 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> Hi,
>
> This series is a bit of cleanup and improvement for the new
> multi-cluster SMP code for Allwinner A80 and A83T (soon) SoCs.
>
> The first patch is just a typo fix.
>
> The second and third patch add the use of the "enable-method" cpu
> property to enable SMP, instead of matching against the machine
> compatible. However, due to how init calls are sequenced, we still
> need to use a platform early_init call.
>
> The last patch splits out parts of the SoC-specific init code, i.e.
> the device node matching parts. This should help with Mylene's work
> on adding support for the A83T.
>
> Please have a look.
>
> Regards
> ChenYu
>
> Chen-Yu Tsai (4):
>   ARM: sunxi: mc-smp: Fix "lookback" typo
>   ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP
>   ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC
>   ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence

Merged all 4 patches.

ChenYu

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-03-10  8:16 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 15:00 [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP Chen-Yu Tsai
2018-03-08 15:00 ` Chen-Yu Tsai
2018-03-08 15:00 ` [PATCH 1/4] ARM: sunxi: mc-smp: Fix "lookback" typo Chen-Yu Tsai
2018-03-08 15:00   ` Chen-Yu Tsai
2018-03-08 15:08   ` Maxime Ripard
2018-03-08 15:08     ` Maxime Ripard
2018-03-08 15:00 ` [PATCH 2/4] ARM: sunxi: mc-smp: Use DT enable-method for sun9i A80 SMP Chen-Yu Tsai
2018-03-08 15:00   ` Chen-Yu Tsai
2018-03-08 15:09   ` Maxime Ripard
2018-03-08 15:09     ` Maxime Ripard
2018-03-09 23:50   ` Rob Herring
2018-03-09 23:50     ` Rob Herring
2018-03-08 15:00 ` [PATCH 3/4] ARM: dts: sun9i: Add enable-method for SMP support for the A80 SoC Chen-Yu Tsai
2018-03-08 15:00   ` Chen-Yu Tsai
2018-03-08 15:09   ` Maxime Ripard
2018-03-08 15:09     ` Maxime Ripard
2018-03-08 15:00 ` [PATCH 4/4] ARM: sunxi: mc-smp: Split out SoC-specific device node lookup sequence Chen-Yu Tsai
2018-03-08 15:00   ` Chen-Yu Tsai
2018-03-08 15:13   ` Maxime Ripard
2018-03-08 15:13     ` Maxime Ripard
2018-03-10  8:16 ` [PATCH 0/4] ARM: sunxi: Clean and improvements for multi-cluster SMP Chen-Yu Tsai
2018-03-10  8:16   ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.