All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-19 16:52 ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:52 UTC (permalink / raw)
  To: arnd, olof, linux; +Cc: thomas.petazzoni, linux-arm-kernel, linux-kernel

With the next patches, the init cpus function will be changed to be factored
out.

The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
after the DT has been parsed. Even if this code is valid, it does not give a
real benefit as the DT should be correctly filled.

Remove this callback.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/mach-mvebu/platsmp.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 58cc8c1..3e93422 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -30,8 +30,6 @@
 #include "pmsu.h"
 #include "coherency.h"
 
-#define ARMADA_XP_MAX_CPUS 4
-
 #define AXP_BOOTROM_BASE 0xfff00000
 #define AXP_BOOTROM_SIZE 0x100000
 
@@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
 	mvebu_v7_pmsu_idle_exit();
 }
 
-static void __init armada_xp_smp_init_cpus(void)
-{
-	unsigned int ncores = num_possible_cpus();
-
-	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
-		panic("Invalid number of CPUs in DT\n");
-}
-
 static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
 {
 	struct device_node *node;
@@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
 #endif
 
 struct smp_operations armada_xp_smp_ops __initdata = {
-	.smp_init_cpus		= armada_xp_smp_init_cpus,
 	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
 	.smp_boot_secondary	= armada_xp_boot_secondary,
 	.smp_secondary_init     = armada_xp_secondary_init,
-- 
1.9.1


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

* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-19 16:52 ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:52 UTC (permalink / raw)
  To: linux-arm-kernel

With the next patches, the init cpus function will be changed to be factored
out.

The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
after the DT has been parsed. Even if this code is valid, it does not give a
real benefit as the DT should be correctly filled.

Remove this callback.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/mach-mvebu/platsmp.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 58cc8c1..3e93422 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -30,8 +30,6 @@
 #include "pmsu.h"
 #include "coherency.h"
 
-#define ARMADA_XP_MAX_CPUS 4
-
 #define AXP_BOOTROM_BASE 0xfff00000
 #define AXP_BOOTROM_SIZE 0x100000
 
@@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
 	mvebu_v7_pmsu_idle_exit();
 }
 
-static void __init armada_xp_smp_init_cpus(void)
-{
-	unsigned int ncores = num_possible_cpus();
-
-	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
-		panic("Invalid number of CPUs in DT\n");
-}
-
 static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
 {
 	struct device_node *node;
@@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
 #endif
 
 struct smp_operations armada_xp_smp_ops __initdata = {
-	.smp_init_cpus		= armada_xp_smp_init_cpus,
 	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
 	.smp_boot_secondary	= armada_xp_boot_secondary,
 	.smp_secondary_init     = armada_xp_secondary_init,
-- 
1.9.1

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

* [PATCH 2/3] ARM: Make smp_init_cpus to return the number of cores
  2015-01-19 16:52 ` Daniel Lezcano
@ 2015-01-19 16:53   ` Daniel Lezcano
  -1 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:53 UTC (permalink / raw)
  To: arnd, olof, linux; +Cc: thomas.petazzoni, linux-arm-kernel, linux-kernel

Return the number of cores the platform has.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/include/asm/smp.h       | 2 +-
 arch/arm/mach-exynos/platsmp.c   | 6 ++++--
 arch/arm/mach-imx/platsmp.c      | 4 +++-
 arch/arm/mach-omap2/omap-smp.c   | 4 +++-
 arch/arm/mach-realview/platsmp.c | 4 +++-
 arch/arm/mach-socfpga/platsmp.c  | 4 +++-
 arch/arm/mach-spear/platsmp.c    | 4 +++-
 arch/arm/mach-ux500/platsmp.c    | 4 +++-
 arch/arm/mach-zynq/platsmp.c     | 4 +++-
 9 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 18f5a55..5ce30ee 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -86,7 +86,7 @@ struct smp_operations {
 	/*
 	 * Setup the set of possible CPUs (via set_cpu_possible)
 	 */
-	void (*smp_init_cpus)(void);
+	int (*smp_init_cpus)(void);
 	/*
 	 * Initialize cpu_possible map, and enable coherency
 	 */
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 7a1ebfe..686f42a 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -373,7 +373,7 @@ fail:
  * which may be present or become present in the system.
  */
 
-static void __init exynos_smp_init_cpus(void)
+static int __init exynos_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -385,7 +385,7 @@ static void __init exynos_smp_init_cpus(void)
 		 * CPU Nodes are passed thru DT and set_cpu_possible
 		 * is set by "arm_dt_init_cpu_maps".
 		 */
-		return;
+		return 0;
 
 	/* sanity check */
 	if (ncores > nr_cpu_ids) {
@@ -396,6 +396,8 @@ static void __init exynos_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 7f27001..70f0928 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -57,7 +57,7 @@ static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init imx_smp_init_cpus(void)
+static int __init imx_smp_init_cpus(void)
 {
 	int i, ncores;
 
@@ -65,6 +65,8 @@ static void __init imx_smp_init_cpus(void)
 
 	for (i = ncores; i < NR_CPUS; i++)
 		set_cpu_possible(i, false);
+
+	return ncores;
 }
 
 void imx_smp_prepare(void)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 5305ec7..4d31fea 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -175,7 +175,7 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init omap4_smp_init_cpus(void)
+static int __init omap4_smp_init_cpus(void)
 {
 	unsigned int i = 0, ncores = 1, cpu_id;
 
@@ -202,6 +202,8 @@ static void __init omap4_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 98e3052..0612f2d 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -42,7 +42,7 @@ static void __iomem *scu_base_addr(void)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init realview_smp_init_cpus(void)
+static int __init realview_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -58,6 +58,8 @@ static void __init realview_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index c64d89b..45d4d87 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -58,7 +58,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init socfpga_smp_init_cpus(void)
+static int __init socfpga_smp_init_cpus(void)
 {
 	unsigned int i, ncores;
 
@@ -76,6 +76,8 @@ static void __init socfpga_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index fd42977..a6ef1ad 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -93,7 +93,7 @@ static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init spear13xx_smp_init_cpus(void)
+static int __init spear13xx_smp_init_cpus(void)
 {
 	unsigned int i, ncores = scu_get_core_count(scu_base);
 
@@ -105,6 +105,8 @@ static void __init spear13xx_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index a44967f..c8d8d4c 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -133,7 +133,7 @@ static void __init wakeup_secondary(void)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init ux500_smp_init_cpus(void)
+static int __init ux500_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -149,6 +149,8 @@ static void __init ux500_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 52d768f..1ab85e7 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -97,7 +97,7 @@ static int zynq_boot_secondary(unsigned int cpu,
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init zynq_smp_init_cpus(void)
+static int __init zynq_smp_init_cpus(void)
 {
 	int i;
 
@@ -105,6 +105,8 @@ static void __init zynq_smp_init_cpus(void)
 
 	for (i = 0; i < ncores && i < CONFIG_NR_CPUS; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
-- 
1.9.1


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

* [PATCH 2/3] ARM: Make smp_init_cpus to return the number of cores
@ 2015-01-19 16:53   ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

Return the number of cores the platform has.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/include/asm/smp.h       | 2 +-
 arch/arm/mach-exynos/platsmp.c   | 6 ++++--
 arch/arm/mach-imx/platsmp.c      | 4 +++-
 arch/arm/mach-omap2/omap-smp.c   | 4 +++-
 arch/arm/mach-realview/platsmp.c | 4 +++-
 arch/arm/mach-socfpga/platsmp.c  | 4 +++-
 arch/arm/mach-spear/platsmp.c    | 4 +++-
 arch/arm/mach-ux500/platsmp.c    | 4 +++-
 arch/arm/mach-zynq/platsmp.c     | 4 +++-
 9 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 18f5a55..5ce30ee 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -86,7 +86,7 @@ struct smp_operations {
 	/*
 	 * Setup the set of possible CPUs (via set_cpu_possible)
 	 */
-	void (*smp_init_cpus)(void);
+	int (*smp_init_cpus)(void);
 	/*
 	 * Initialize cpu_possible map, and enable coherency
 	 */
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 7a1ebfe..686f42a 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -373,7 +373,7 @@ fail:
  * which may be present or become present in the system.
  */
 
-static void __init exynos_smp_init_cpus(void)
+static int __init exynos_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -385,7 +385,7 @@ static void __init exynos_smp_init_cpus(void)
 		 * CPU Nodes are passed thru DT and set_cpu_possible
 		 * is set by "arm_dt_init_cpu_maps".
 		 */
-		return;
+		return 0;
 
 	/* sanity check */
 	if (ncores > nr_cpu_ids) {
@@ -396,6 +396,8 @@ static void __init exynos_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 7f27001..70f0928 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -57,7 +57,7 @@ static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init imx_smp_init_cpus(void)
+static int __init imx_smp_init_cpus(void)
 {
 	int i, ncores;
 
@@ -65,6 +65,8 @@ static void __init imx_smp_init_cpus(void)
 
 	for (i = ncores; i < NR_CPUS; i++)
 		set_cpu_possible(i, false);
+
+	return ncores;
 }
 
 void imx_smp_prepare(void)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 5305ec7..4d31fea 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -175,7 +175,7 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init omap4_smp_init_cpus(void)
+static int __init omap4_smp_init_cpus(void)
 {
 	unsigned int i = 0, ncores = 1, cpu_id;
 
@@ -202,6 +202,8 @@ static void __init omap4_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 98e3052..0612f2d 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -42,7 +42,7 @@ static void __iomem *scu_base_addr(void)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init realview_smp_init_cpus(void)
+static int __init realview_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -58,6 +58,8 @@ static void __init realview_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index c64d89b..45d4d87 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -58,7 +58,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init socfpga_smp_init_cpus(void)
+static int __init socfpga_smp_init_cpus(void)
 {
 	unsigned int i, ncores;
 
@@ -76,6 +76,8 @@ static void __init socfpga_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index fd42977..a6ef1ad 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -93,7 +93,7 @@ static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init spear13xx_smp_init_cpus(void)
+static int __init spear13xx_smp_init_cpus(void)
 {
 	unsigned int i, ncores = scu_get_core_count(scu_base);
 
@@ -105,6 +105,8 @@ static void __init spear13xx_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index a44967f..c8d8d4c 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -133,7 +133,7 @@ static void __init wakeup_secondary(void)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init ux500_smp_init_cpus(void)
+static int __init ux500_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -149,6 +149,8 @@ static void __init ux500_smp_init_cpus(void)
 
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 52d768f..1ab85e7 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -97,7 +97,7 @@ static int zynq_boot_secondary(unsigned int cpu,
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-static void __init zynq_smp_init_cpus(void)
+static int __init zynq_smp_init_cpus(void)
 {
 	int i;
 
@@ -105,6 +105,8 @@ static void __init zynq_smp_init_cpus(void)
 
 	for (i = 0; i < ncores && i < CONFIG_NR_CPUS; i++)
 		set_cpu_possible(i, true);
+
+	return ncores;
 }
 
 static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
-- 
1.9.1

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

* [PATCH 3/3] ARM: Factor out the smp_init_cpus function
  2015-01-19 16:52 ` Daniel Lezcano
@ 2015-01-19 16:53   ` Daniel Lezcano
  -1 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:53 UTC (permalink / raw)
  To: arnd, olof, linux; +Cc: thomas.petazzoni, linux-arm-kernel, linux-kernel

The set_cpu_possible loop and the ncores clipping is duplicated again and
again across the different platforms.

As the smp_init_cpus is returning the number of cores, use this information
to do the same thing than what does the duplicate code in the different
platforms.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/kernel/smp.c            | 16 ++++++++++++++--
 arch/arm/mach-exynos/platsmp.c   | 15 +--------------
 arch/arm/mach-omap2/omap-smp.c   | 10 ----------
 arch/arm/mach-realview/platsmp.c | 15 +--------------
 arch/arm/mach-socfpga/platsmp.c  | 19 +------------------
 arch/arm/mach-spear/platsmp.c    | 13 +------------
 arch/arm/mach-ux500/platsmp.c    | 15 +--------------
 arch/arm/mach-zynq/platsmp.c     |  9 +--------
 8 files changed, 20 insertions(+), 92 deletions(-)

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 86ef244..ecf2993 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -141,8 +141,20 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 /* platform specific SMP operations */
 void __init smp_init_cpus(void)
 {
-	if (smp_ops.smp_init_cpus)
-		smp_ops.smp_init_cpus();
+	int i, ncores;
+
+	if (!smp_ops.smp_init_cpus)
+		return;
+
+	ncores = smp_ops.smp_init_cpus();
+	if (ncores > nr_cpu_ids) {
+		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
+			ncores, nr_cpu_ids);
+		ncores = nr_cpu_ids;
+	}
+
+	for (i = 0; i < ncores; i++)
+		set_cpu_possible(i, true);
 }
 
 int platform_can_cpu_hotplug(void)
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 686f42a..406cc8b 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -376,28 +376,15 @@ fail:
 static int __init exynos_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
-		ncores = scu_base ? scu_get_core_count(scu_base) : 1;
+		return scu_base ? scu_get_core_count(scu_base) : 1;
 	else
 		/*
 		 * CPU Nodes are passed thru DT and set_cpu_possible
 		 * is set by "arm_dt_init_cpu_maps".
 		 */
 		return 0;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
 }
 
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4d31fea..2fa48bd 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -193,16 +193,6 @@ static int __init omap4_smp_init_cpus(void)
 		ncores = OMAP5_CORE_COUNT;
 	}
 
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
 	return ncores;
 }
 
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 0612f2d..eb9885f 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -45,21 +45,8 @@ static void __iomem *scu_base_addr(void)
 static int __init realview_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
-	ncores = scu_base ? scu_get_core_count(scu_base) : 1;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_base ? scu_get_core_count(scu_base) : 1;
 }
 
 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 45d4d87..de14efc 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -60,24 +60,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
  */
 static int __init socfpga_smp_init_cpus(void)
 {
-	unsigned int i, ncores;
-
-	ncores = scu_get_core_count(socfpga_scu_base_addr);
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	/* sanity check */
-	if (ncores > num_possible_cpus()) {
-		pr_warn("socfpga: no. of cores (%d) greater than configured"
-			"maximum of %d - clipping\n", ncores, num_possible_cpus());
-		ncores = num_possible_cpus();
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(socfpga_scu_base_addr);
 }
 
 static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index a6ef1ad..da4b4ac 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -95,18 +95,7 @@ static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  */
 static int __init spear13xx_smp_init_cpus(void)
 {
-	unsigned int i, ncores = scu_get_core_count(scu_base);
-
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(scu_base);
 }
 
 static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index c8d8d4c..74485bc 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -136,21 +136,8 @@ static void __init wakeup_secondary(void)
 static int __init ux500_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
-	ncores = scu_base ? scu_get_core_count(scu_base) : 1;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_base ? scu_get_core_count(scu_base) : 1;
 }
 
 static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 1ab85e7..6b9e101 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -99,14 +99,7 @@ static int zynq_boot_secondary(unsigned int cpu,
  */
 static int __init zynq_smp_init_cpus(void)
 {
-	int i;
-
-	ncores = scu_get_core_count(zynq_scu_base);
-
-	for (i = 0; i < ncores && i < CONFIG_NR_CPUS; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(zynq_scu_base);
 }
 
 static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
-- 
1.9.1


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

* [PATCH 3/3] ARM: Factor out the smp_init_cpus function
@ 2015-01-19 16:53   ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

The set_cpu_possible loop and the ncores clipping is duplicated again and
again across the different platforms.

As the smp_init_cpus is returning the number of cores, use this information
to do the same thing than what does the duplicate code in the different
platforms.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 arch/arm/kernel/smp.c            | 16 ++++++++++++++--
 arch/arm/mach-exynos/platsmp.c   | 15 +--------------
 arch/arm/mach-omap2/omap-smp.c   | 10 ----------
 arch/arm/mach-realview/platsmp.c | 15 +--------------
 arch/arm/mach-socfpga/platsmp.c  | 19 +------------------
 arch/arm/mach-spear/platsmp.c    | 13 +------------
 arch/arm/mach-ux500/platsmp.c    | 15 +--------------
 arch/arm/mach-zynq/platsmp.c     |  9 +--------
 8 files changed, 20 insertions(+), 92 deletions(-)

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 86ef244..ecf2993 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -141,8 +141,20 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 /* platform specific SMP operations */
 void __init smp_init_cpus(void)
 {
-	if (smp_ops.smp_init_cpus)
-		smp_ops.smp_init_cpus();
+	int i, ncores;
+
+	if (!smp_ops.smp_init_cpus)
+		return;
+
+	ncores = smp_ops.smp_init_cpus();
+	if (ncores > nr_cpu_ids) {
+		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
+			ncores, nr_cpu_ids);
+		ncores = nr_cpu_ids;
+	}
+
+	for (i = 0; i < ncores; i++)
+		set_cpu_possible(i, true);
 }
 
 int platform_can_cpu_hotplug(void)
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 686f42a..406cc8b 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -376,28 +376,15 @@ fail:
 static int __init exynos_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
-		ncores = scu_base ? scu_get_core_count(scu_base) : 1;
+		return scu_base ? scu_get_core_count(scu_base) : 1;
 	else
 		/*
 		 * CPU Nodes are passed thru DT and set_cpu_possible
 		 * is set by "arm_dt_init_cpu_maps".
 		 */
 		return 0;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
 }
 
 static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4d31fea..2fa48bd 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -193,16 +193,6 @@ static int __init omap4_smp_init_cpus(void)
 		ncores = OMAP5_CORE_COUNT;
 	}
 
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
 	return ncores;
 }
 
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 0612f2d..eb9885f 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -45,21 +45,8 @@ static void __iomem *scu_base_addr(void)
 static int __init realview_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
-	ncores = scu_base ? scu_get_core_count(scu_base) : 1;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_base ? scu_get_core_count(scu_base) : 1;
 }
 
 static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 45d4d87..de14efc 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -60,24 +60,7 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
  */
 static int __init socfpga_smp_init_cpus(void)
 {
-	unsigned int i, ncores;
-
-	ncores = scu_get_core_count(socfpga_scu_base_addr);
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	/* sanity check */
-	if (ncores > num_possible_cpus()) {
-		pr_warn("socfpga: no. of cores (%d) greater than configured"
-			"maximum of %d - clipping\n", ncores, num_possible_cpus());
-		ncores = num_possible_cpus();
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(socfpga_scu_base_addr);
 }
 
 static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index a6ef1ad..da4b4ac 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -95,18 +95,7 @@ static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
  */
 static int __init spear13xx_smp_init_cpus(void)
 {
-	unsigned int i, ncores = scu_get_core_count(scu_base);
-
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(scu_base);
 }
 
 static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index c8d8d4c..74485bc 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -136,21 +136,8 @@ static void __init wakeup_secondary(void)
 static int __init ux500_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
-	unsigned int i, ncores;
 
-	ncores = scu_base ? scu_get_core_count(scu_base) : 1;
-
-	/* sanity check */
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	for (i = 0; i < ncores; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_base ? scu_get_core_count(scu_base) : 1;
 }
 
 static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 1ab85e7..6b9e101 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -99,14 +99,7 @@ static int zynq_boot_secondary(unsigned int cpu,
  */
 static int __init zynq_smp_init_cpus(void)
 {
-	int i;
-
-	ncores = scu_get_core_count(zynq_scu_base);
-
-	for (i = 0; i < ncores && i < CONFIG_NR_CPUS; i++)
-		set_cpu_possible(i, true);
-
-	return ncores;
+	return scu_get_core_count(zynq_scu_base);
 }
 
 static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
-- 
1.9.1

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

* Re: [PATCH 1/3] ARM: Marvell: Remove init cpus function
  2015-01-19 16:52 ` Daniel Lezcano
@ 2015-01-19 17:53   ` Gregory CLEMENT
  -1 siblings, 0 replies; 14+ messages in thread
From: Gregory CLEMENT @ 2015-01-19 17:53 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: arnd, olof, linux, thomas.petazzoni, linux-kernel, linux-arm-kernel

Hi Daniel,

On 19/01/2015 17:52, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
> 
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
> 
> Remove this callback.

In the course of the factorization of the smp functions, this function
has been more and more reduced. As stated, the remaining part is not so
useful now, it makes sens to remove it now.

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Thanks,

Gregory


> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>  #include "pmsu.h"
>  #include "coherency.h"
>  
> -#define ARMADA_XP_MAX_CPUS 4
> -
>  #define AXP_BOOTROM_BASE 0xfff00000
>  #define AXP_BOOTROM_SIZE 0x100000
>  
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>  	mvebu_v7_pmsu_idle_exit();
>  }
>  
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>  static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>  {
>  	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>  #endif
>  
>  struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>  	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>  	.smp_boot_secondary	= armada_xp_boot_secondary,
>  	.smp_secondary_init     = armada_xp_secondary_init,
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-19 17:53   ` Gregory CLEMENT
  0 siblings, 0 replies; 14+ messages in thread
From: Gregory CLEMENT @ 2015-01-19 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Daniel,

On 19/01/2015 17:52, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
> 
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
> 
> Remove this callback.

In the course of the factorization of the smp functions, this function
has been more and more reduced. As stated, the remaining part is not so
useful now, it makes sens to remove it now.

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Thanks,

Gregory


> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>  #include "pmsu.h"
>  #include "coherency.h"
>  
> -#define ARMADA_XP_MAX_CPUS 4
> -
>  #define AXP_BOOTROM_BASE 0xfff00000
>  #define AXP_BOOTROM_SIZE 0x100000
>  
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>  	mvebu_v7_pmsu_idle_exit();
>  }
>  
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>  static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>  {
>  	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>  #endif
>  
>  struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>  	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>  	.smp_boot_secondary	= armada_xp_boot_secondary,
>  	.smp_secondary_init     = armada_xp_secondary_init,
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH 1/3] ARM: Marvell: Remove init cpus function
  2015-01-19 16:52 ` Daniel Lezcano
@ 2015-01-19 21:30   ` Andrew Lunn
  -1 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2015-01-19 21:30 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: arnd, olof, linux, thomas.petazzoni, linux-kernel, linux-arm-kernel

On Mon, Jan 19, 2015 at 05:52:59PM +0100, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
> 
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
> 
> Remove this callback.

Hi Daniel

What is your plan for getting these merged? Do you want me to take the
mvebu patch? Or are you thinking of sending the complete series to the
arm-soc maintainers?

Thanks
	Andrew

> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>  #include "pmsu.h"
>  #include "coherency.h"
>  
> -#define ARMADA_XP_MAX_CPUS 4
> -
>  #define AXP_BOOTROM_BASE 0xfff00000
>  #define AXP_BOOTROM_SIZE 0x100000
>  
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>  	mvebu_v7_pmsu_idle_exit();
>  }
>  
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>  static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>  {
>  	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>  #endif
>  
>  struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>  	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>  	.smp_boot_secondary	= armada_xp_boot_secondary,
>  	.smp_secondary_init     = armada_xp_secondary_init,
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-19 21:30   ` Andrew Lunn
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2015-01-19 21:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 19, 2015 at 05:52:59PM +0100, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
> 
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
> 
> Remove this callback.

Hi Daniel

What is your plan for getting these merged? Do you want me to take the
mvebu patch? Or are you thinking of sending the complete series to the
arm-soc maintainers?

Thanks
	Andrew

> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  arch/arm/mach-mvebu/platsmp.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>  #include "pmsu.h"
>  #include "coherency.h"
>  
> -#define ARMADA_XP_MAX_CPUS 4
> -
>  #define AXP_BOOTROM_BASE 0xfff00000
>  #define AXP_BOOTROM_SIZE 0x100000
>  
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>  	mvebu_v7_pmsu_idle_exit();
>  }
>  
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>  static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>  {
>  	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>  #endif
>  
>  struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>  	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>  	.smp_boot_secondary	= armada_xp_boot_secondary,
>  	.smp_secondary_init     = armada_xp_secondary_init,
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/3] ARM: Marvell: Remove init cpus function
  2015-01-19 21:30   ` Andrew Lunn
@ 2015-01-19 22:02     ` Daniel Lezcano
  -1 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 22:02 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: arnd, olof, linux, thomas.petazzoni, linux-kernel, linux-arm-kernel

On 01/19/2015 10:30 PM, Andrew Lunn wrote:
> On Mon, Jan 19, 2015 at 05:52:59PM +0100, Daniel Lezcano wrote:
>> With the next patches, the init cpus function will be changed to be factored
>> out.
>>
>> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
>> after the DT has been parsed. Even if this code is valid, it does not give a
>> real benefit as the DT should be correctly filled.
>>
>> Remove this callback.
>
> Hi Daniel
>
> What is your plan for getting these merged? Do you want me to take the
> mvebu patch? Or are you thinking of sending the complete series to the
> arm-soc maintainers?

Hi Andrew,

If possible it would be preferable to have those 3 patches going through 
arm-soc.

>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   arch/arm/mach-mvebu/platsmp.c | 11 -----------
>>   1 file changed, 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
>> index 58cc8c1..3e93422 100644
>> --- a/arch/arm/mach-mvebu/platsmp.c
>> +++ b/arch/arm/mach-mvebu/platsmp.c
>> @@ -30,8 +30,6 @@
>>   #include "pmsu.h"
>>   #include "coherency.h"
>>
>> -#define ARMADA_XP_MAX_CPUS 4
>> -
>>   #define AXP_BOOTROM_BASE 0xfff00000
>>   #define AXP_BOOTROM_SIZE 0x100000
>>
>> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>>   	mvebu_v7_pmsu_idle_exit();
>>   }
>>
>> -static void __init armada_xp_smp_init_cpus(void)
>> -{
>> -	unsigned int ncores = num_possible_cpus();
>> -
>> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
>> -		panic("Invalid number of CPUs in DT\n");
>> -}
>> -
>>   static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>>   {
>>   	struct device_node *node;
>> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>>   #endif
>>
>>   struct smp_operations armada_xp_smp_ops __initdata = {
>> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>>   	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>>   	.smp_boot_secondary	= armada_xp_boot_secondary,
>>   	.smp_secondary_init     = armada_xp_secondary_init,
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-19 22:02     ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-19 22:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/19/2015 10:30 PM, Andrew Lunn wrote:
> On Mon, Jan 19, 2015 at 05:52:59PM +0100, Daniel Lezcano wrote:
>> With the next patches, the init cpus function will be changed to be factored
>> out.
>>
>> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
>> after the DT has been parsed. Even if this code is valid, it does not give a
>> real benefit as the DT should be correctly filled.
>>
>> Remove this callback.
>
> Hi Daniel
>
> What is your plan for getting these merged? Do you want me to take the
> mvebu patch? Or are you thinking of sending the complete series to the
> arm-soc maintainers?

Hi Andrew,

If possible it would be preferable to have those 3 patches going through 
arm-soc.

>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   arch/arm/mach-mvebu/platsmp.c | 11 -----------
>>   1 file changed, 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
>> index 58cc8c1..3e93422 100644
>> --- a/arch/arm/mach-mvebu/platsmp.c
>> +++ b/arch/arm/mach-mvebu/platsmp.c
>> @@ -30,8 +30,6 @@
>>   #include "pmsu.h"
>>   #include "coherency.h"
>>
>> -#define ARMADA_XP_MAX_CPUS 4
>> -
>>   #define AXP_BOOTROM_BASE 0xfff00000
>>   #define AXP_BOOTROM_SIZE 0x100000
>>
>> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>>   	mvebu_v7_pmsu_idle_exit();
>>   }
>>
>> -static void __init armada_xp_smp_init_cpus(void)
>> -{
>> -	unsigned int ncores = num_possible_cpus();
>> -
>> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
>> -		panic("Invalid number of CPUs in DT\n");
>> -}
>> -
>>   static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>>   {
>>   	struct device_node *node;
>> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>>   #endif
>>
>>   struct smp_operations armada_xp_smp_ops __initdata = {
>> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>>   	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>>   	.smp_boot_secondary	= armada_xp_boot_secondary,
>>   	.smp_secondary_init     = armada_xp_secondary_init,
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH 1/3] ARM: Marvell: Remove init cpus function
  2015-01-19 16:52 ` Daniel Lezcano
@ 2015-01-23 13:15   ` Daniel Lezcano
  -1 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-23 13:15 UTC (permalink / raw)
  To: arnd, olof, linux; +Cc: thomas.petazzoni, linux-arm-kernel, linux-kernel

On 01/19/2015 05:52 PM, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
>
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
>
> Remove this callback.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Arnd, Olof,

any comments on this patchset ?

Thanks
   -- Daniel

> ---
>   arch/arm/mach-mvebu/platsmp.c | 11 -----------
>   1 file changed, 11 deletions(-)
>
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>   #include "pmsu.h"
>   #include "coherency.h"
>
> -#define ARMADA_XP_MAX_CPUS 4
> -
>   #define AXP_BOOTROM_BASE 0xfff00000
>   #define AXP_BOOTROM_SIZE 0x100000
>
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>   	mvebu_v7_pmsu_idle_exit();
>   }
>
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>   static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>   {
>   	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>   #endif
>
>   struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>   	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>   	.smp_boot_secondary	= armada_xp_boot_secondary,
>   	.smp_secondary_init     = armada_xp_secondary_init,
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* [PATCH 1/3] ARM: Marvell: Remove init cpus function
@ 2015-01-23 13:15   ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2015-01-23 13:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/19/2015 05:52 PM, Daniel Lezcano wrote:
> With the next patches, the init cpus function will be changed to be factored
> out.
>
> The function 'armada_xp_smp_init_cpus' does nothing more than a sanity check
> after the DT has been parsed. Even if this code is valid, it does not give a
> real benefit as the DT should be correctly filled.
>
> Remove this callback.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Hi Arnd, Olof,

any comments on this patchset ?

Thanks
   -- Daniel

> ---
>   arch/arm/mach-mvebu/platsmp.c | 11 -----------
>   1 file changed, 11 deletions(-)
>
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index 58cc8c1..3e93422 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -30,8 +30,6 @@
>   #include "pmsu.h"
>   #include "coherency.h"
>
> -#define ARMADA_XP_MAX_CPUS 4
> -
>   #define AXP_BOOTROM_BASE 0xfff00000
>   #define AXP_BOOTROM_SIZE 0x100000
>
> @@ -114,14 +112,6 @@ static void armada_xp_secondary_init(unsigned int cpu)
>   	mvebu_v7_pmsu_idle_exit();
>   }
>
> -static void __init armada_xp_smp_init_cpus(void)
> -{
> -	unsigned int ncores = num_possible_cpus();
> -
> -	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> -		panic("Invalid number of CPUs in DT\n");
> -}
> -
>   static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
>   {
>   	struct device_node *node;
> @@ -171,7 +161,6 @@ static int armada_xp_cpu_kill(unsigned int cpu)
>   #endif
>
>   struct smp_operations armada_xp_smp_ops __initdata = {
> -	.smp_init_cpus		= armada_xp_smp_init_cpus,
>   	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
>   	.smp_boot_secondary	= armada_xp_boot_secondary,
>   	.smp_secondary_init     = armada_xp_secondary_init,
>


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2015-01-23 13:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 16:52 [PATCH 1/3] ARM: Marvell: Remove init cpus function Daniel Lezcano
2015-01-19 16:52 ` Daniel Lezcano
2015-01-19 16:53 ` [PATCH 2/3] ARM: Make smp_init_cpus to return the number of cores Daniel Lezcano
2015-01-19 16:53   ` Daniel Lezcano
2015-01-19 16:53 ` [PATCH 3/3] ARM: Factor out the smp_init_cpus function Daniel Lezcano
2015-01-19 16:53   ` Daniel Lezcano
2015-01-19 17:53 ` [PATCH 1/3] ARM: Marvell: Remove init cpus function Gregory CLEMENT
2015-01-19 17:53   ` Gregory CLEMENT
2015-01-19 21:30 ` Andrew Lunn
2015-01-19 21:30   ` Andrew Lunn
2015-01-19 22:02   ` Daniel Lezcano
2015-01-19 22:02     ` Daniel Lezcano
2015-01-23 13:15 ` Daniel Lezcano
2015-01-23 13:15   ` Daniel Lezcano

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.