Skip to contentSkip to conversation

ARM: vexpress/realview: consolidate immitation CPU hotplug

PATCH In review Russell King 3 participants 3 messages Dec 13, 2018

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

PATCH 1/1 ARM: vexpress/realview: consolidate immitation CPU hotplug

The only difference between the hotplug implementation for Realview and Versatile Express are the bit in the auxiliary control register to disable coherency. Combine the two implentations accounting for that difference.

Rename the functions to try to discourage cargo-cult copying of this code.

---
Please note that this hasn't been compile tested yet.

 arch/arm/mach-realview/Makefile                    |   1 -
 arch/arm/mach-realview/hotplug.c                   | 111 ---------------------
 arch/arm/mach-realview/hotplug.h                   |   1 -
 arch/arm/mach-realview/platsmp-dt.c                |   7 ++
 arch/arm/mach-vexpress/Makefile                    |   1 -
 arch/arm/mach-vexpress/core.h                      |   2 -
 arch/arm/mach-vexpress/platsmp.c                   |   7 ++
 arch/arm/plat-versatile/Makefile                   |   1 +
 .../{mach-vexpress => plat-versatile}/hotplug.c    |  45 ++++-----
 arch/arm/plat-versatile/include/plat/platsmp.h     |   1 +
 10 files changed, 36 insertions(+), 141 deletions(-)
 delete mode 100644 arch/arm/mach-realview/hotplug.c
 delete mode 100644 arch/arm/mach-realview/hotplug.h
 rename arch/arm/{mach-vexpress => plat-versatile}/hotplug.c (58%)
arch/arm/mach-realview/Makefile +0 -1
index adf39ad71cc3..6ca6400fa51e 100644
@@ -5,4 +5,3 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/plat-versatile/inc
 
 obj-y					+= realview-dt.o
 obj-$(CONFIG_SMP)			+= platsmp-dt.o
-obj-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
arch/arm/mach-realview/hotplug.c deleted +0 -111

111 lines not on this page · raw message

arch/arm/mach-realview/hotplug.h deleted +0 -1
deleted file mode 100644
index eacd7a4dad2f..000000000000
@@ -1 +0,0 @@
-void realview_cpu_die(unsigned int cpu);
arch/arm/mach-realview/platsmp-dt.c +7 -0
index c242423bf8db..3e672e12eadf 100644
@@ -79,6 +79,13 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
 		     __pa_symbol(versatile_secondary_startup));
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void realview_cpu_die(unsigned int cpu)
+{
+	return versatile_immitation_cpu_die(cpu, 0x20);
+}
+#endif
+
 static const struct smp_operations realview_dt_smp_ops __initconst = {
 	.smp_prepare_cpus	= realview_smp_prepare_cpus,
 	.smp_secondary_init	= versatile_secondary_init,
arch/arm/mach-vexpress/Makefile +0 -1
index 51c35e2b737a..3651a1ed0f2b 100644
@@ -15,6 +15,5 @@ obj-$(CONFIG_ARCH_VEXPRESS_TC2_PM)	+= tc2_pm.o
 CFLAGS_tc2_pm.o				+= -march=armv7-a
 CFLAGS_REMOVE_tc2_pm.o			= -pg
 obj-$(CONFIG_SMP)			+= platsmp.o
-obj-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
 
 obj-$(CONFIG_ARCH_MPS2)			+= v2m-mps2.o
arch/arm/mach-vexpress/core.h +0 -2
index a162ab46ee02..f4a7519084f1 100644
@@ -1,5 +1,3 @@
 bool vexpress_smp_init_ops(void);
 
 extern const struct smp_operations vexpress_smp_dt_ops;
-
-extern void vexpress_cpu_die(unsigned int cpu);
arch/arm/mach-vexpress/platsmp.c +7 -0
index 742499bac6d0..63c9784f063f 100644
@@ -82,6 +82,13 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
 	vexpress_flags_set(__pa_symbol(versatile_secondary_startup));
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void vexpress_cpu_die(unsigned int cpu)
+{
+	versatile_cpu_die(cpu, 0x40);
+}
+#endif
+
 const struct smp_operations vexpress_smp_dt_ops __initconst = {
 	.smp_prepare_cpus	= vexpress_smp_dt_prepare_cpus,
 	.smp_secondary_init	= versatile_secondary_init,
arch/arm/plat-versatile/Makefile +1 -0
index bff3ba889882..b2f0ddfdc4cc 100644
@@ -2,3 +2,4 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
 
 obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
 obj-$(CONFIG_SMP) += headsmp.o platsmp.o
+obj-$(CONFIG_HOTPLUG_CPU)		+= hotplug.o
arch/arm/plat-versatile/hotplug.c renamed from arch/arm/mach-vexpress/hotplug.c +20 -25

93 lines not on this page · raw message

arch/arm/plat-versatile/include/plat/platsmp.h +1 -0
index 50fb830192e0..9fff1f241c9e 100644
@@ -12,3 +12,4 @@
 extern void versatile_secondary_startup(void);
 extern void versatile_secondary_init(unsigned int cpu);
 extern int  versatile_boot_secondary(unsigned int cpu, struct task_struct *idle);
+void versatile_immitation_cpu_die(unsigned int cpu, unsigned int actrl_mask);
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Russell King

The only difference between the hotplug implementation for Realview and Versatile Express are the bit in the auxiliary control register to disable coherency. Combine the two implentations accounting for that difference.

Quoted 7 lines

Rename the functions to try to discourage cargo-cult copying of this code.

---
Please note that this hasn't been compile tested yet.

Yes, I had a fix a missed callee site that needs to use unified versatile_immitation_cpu_die to compile it.

[...]

arch/arm/mach-vexpress/platsmp.c static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus) · line 88

Quoted 12 lines
arch/arm/mach-vexpress/platsmp.c +4 -0
index 742499bac6d0..63c9784f063f 100644
@@ -82,6 +82,13 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
 	vexpress_flags_set(__pa_symbol(versatile_secondary_startup));
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static void vexpress_cpu_die(unsigned int cpu)
+{
+	versatile_cpu_die(cpu, 0x40);

This should be versatile_immitation_cpu_die(cpu, 0x40)

With that, it looks fine and passed a hotplug tests for a quick/short period on my TC2. So for mach-vexpress part,

Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
Quoted 9 lines · Sudeep Holla
Quoted 8 lines · Russell King

The only difference between the hotplug implementation for Realview and Versatile Express are the bit in the auxiliary control register to disable coherency. Combine the two implentations accounting for that difference.

Rename the functions to try to discourage cargo-cult copying of this code.

Quoted 6 lines
Quoted 4 lines

---
Please note that this hasn't been compile tested yet.

Yes, I had a fix a missed callee site that needs to use unified versatile_immitation_cpu_die to compile it.

Yep, there's also a missing #include that I found while building Realview.

Quoted 8 lines
Quoted 8 lines
arch/arm/mach-vexpress/platsmp.c +0 -0
index 742499bac6d0..63c9784f063f 100644
@@ -82,6 +82,13 @@ static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
 	vexpress_flags_set(__pa_symbol(versatile_secondary_startup));
 }
 
Quoted 6 lines

arch/arm/mach-vexpress/platsmp.c static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus) · line 88

Quoted 4 lines
arch/arm/mach-vexpress/platsmp.c +4 -0
+#ifdef CONFIG_HOTPLUG_CPU
+static void vexpress_cpu_die(unsigned int cpu)
+{
+	versatile_cpu_die(cpu, 0x40);

This should be versatile_immitation_cpu_die(cpu, 0x40)

Yep, thanks.

Quoted 5 lines

With that, it looks fine and passed a hotplug tests for a quick/short period on my TC2. So for mach-vexpress part,

Thanks.

Signature · 8 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel