Skip to contentSkip to conversation

cpu_logical_map updates for newly merged platforms

PATCH Superseded Will Deacon 4 participants 11 messages Nov 8, 2011 – Nov 11, 2011

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover cpu_logical_map updates for newly merged platforms

It looks like mach-imx and highbank were recently merged and, as such, still refer to logical CPU numbers when interacting directly with hardware.

These two patches should address that, but I'm unable to take them for a spin (all highbank donations welcome :).

Will Deacon (2):
ARM: mach-imx: convert logical CPU numbers to physical numbers
ARM: highbank: convert logical CPU numbers to physical numbers

 arch/arm/mach-highbank/highbank.c |    2 ++
 arch/arm/mach-imx/src.c           |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 arch/arm/mach-imx/src.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-imx/src.c +3 -0
index 36cacbd..63ba593 100644
@@ -14,6 +14,7 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/smp.h>
 #include <asm/unified.h>
 
 #define SRC_SCR				0x000
@@ -27,6 +28,7 @@ void imx_enable_cpu(int cpu, bool enable)
 {
 	u32 mask, val;
 
+	cpu = cpu_logical_map(cpu);
 	mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1);
 	val = readl_relaxed(src_base + SRC_SCR);
 	val = enable ? val | mask : val & ~mask;
@@ -35,6 +37,7 @@ void imx_enable_cpu(int cpu, bool enable)
 
 void imx_set_cpu_jump(int cpu, void *jump_addr)
 {
+	cpu = cpu_logical_map(cpu);
 	writel_relaxed(BSYM(virt_to_phys(jump_addr)),
 		       src_base + SRC_GPR1 + cpu * 8);
 }
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 2/2 ARM: highbank: convert logical CPU numbers to physical numbers

In reply to Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

---
 arch/arm/mach-highbank/highbank.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-highbank/highbank.c +2 -0
index b82dcf0..a6cdc27 100644
@@ -22,6 +22,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
+#include <linux/smp.h>
 
 #include <asm/cacheflush.h>
 #include <asm/unified.h>
@@ -72,6 +73,7 @@ static void __init highbank_map_io(void)
 
 void highbank_set_cpu_jump(int cpu, void *jump_addr)
 {
+	cpu = cpu_logical_map(cpu);
 	writel(BSYM(virt_to_phys(jump_addr)), HB_JUMP_TABLE_VIRT(cpu));
 	__cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
 	outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH 2/2 ARM: highbank: convert logical CPU numbers to physical numbers

Quoted 23 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

---
 arch/arm/mach-highbank/highbank.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-highbank/highbank.c +1 -0
index b82dcf0..a6cdc27 100644
@@ -22,6 +22,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
+#include <linux/smp.h>
 
 #include <asm/cacheflush.h>
 #include <asm/unified.h>

arch/arm/mach-highbank/highbank.c static void __init highbank_map_io(void) · line 76

Quoted 4 lines
arch/arm/mach-highbank/highbank.c +1 -0
@@ -72,6 +73,7 @@ static void __init highbank_map_io(void)
 
 void highbank_set_cpu_jump(int cpu, void *jump_addr)
 {
+	cpu = cpu_logical_map(cpu);

This doesn't build for !CONFIG_SMP. It's possible to want to do this for core 0 in the cpuidle case.

Rob

Quoted 3 lines
arch/arm/mach-highbank/highbank.c +0 -0
 	writel(BSYM(virt_to_phys(jump_addr)), HB_JUMP_TABLE_VIRT(cpu));
 	__cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
 	outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
#10 lore raw

PATCH 2/2 ARM: highbank: convert logical CPU numbers to physical numbers

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 24 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

---
 arch/arm/mach-highbank/highbank.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-highbank/highbank.c +1 -0
index b82dcf0..a6cdc27 100644
@@ -22,6 +22,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
+#include <linux/smp.h>
 
 #include <asm/cacheflush.h>
 #include <asm/unified.h>
@@ -72,6 +73,7 @@ static void __init highbank_map_io(void)
 
Quoted 6 lines

arch/arm/mach-highbank/highbank.c static void __init highbank_map_io(void) · line 76

Quoted 3 lines
arch/arm/mach-highbank/highbank.c +1 -0
 void highbank_set_cpu_jump(int cpu, void *jump_addr)
 {
+	cpu = cpu_logical_map(cpu);

This doesn't build for !CONFIG_SMP. It's possible to want to do this for core 0 in the cpuidle case.

Damn, I suspect I have the same problem with the imx code. Although it would be nice to fix this inside of cpu_logical_map, I can't see a way to do that without moving it into a different header file (which?), so I think the best option is to ifdef at the point of use.

I'll throw a v2 your way this week.

Will

maintainer
#2 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

In reply to Will Deacon
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Shawn, is this one ok?

Sascha

Quoted 40 lines
Cc Sascha Hauer <[email protected]>
Cc Shawn Guo <[email protected]>
---
 arch/arm/mach-imx/src.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-imx/src.c +3 -0
index 36cacbd..63ba593 100644
@@ -14,6 +14,7 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/smp.h>
 #include <asm/unified.h>
 
 #define SRC_SCR				0x000
@@ -27,6 +28,7 @@ void imx_enable_cpu(int cpu, bool enable)
 {
 	u32 mask, val;
 
+	cpu = cpu_logical_map(cpu);
 	mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1);
 	val = readl_relaxed(src_base + SRC_SCR);
 	val = enable ? val | mask : val & ~mask;
@@ -35,6 +37,7 @@ void imx_enable_cpu(int cpu, bool enable)
 
 void imx_set_cpu_jump(int cpu, void *jump_addr)
 {
+	cpu = cpu_logical_map(cpu);
 	writel_relaxed(BSYM(virt_to_phys(jump_addr)),
 		       src_base + SRC_GPR1 + cpu * 8);
 }
Signature · 1 line
1.7.4.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

Quoted 6 lines · Sascha Hauer
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Shawn, is this one ok?

I reckon I need to post a v2 because this probably breaks when !SMP.

Will

#4 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

Quoted 9 lines · Will Deacon
Quoted 6 lines · Sascha Hauer
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Shawn, is this one ok?

I reckon I need to post a v2 because this probably breaks when !SMP.

Actually, I take that back. Looks like the function is only used by hotplug.c and platsmp.c, both of which depend on CONFIG_SMP.

So yes, comments from Shawn would be great.

Will

#5 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

Quoted 7 lines · Will Deacon
Quoted 6 lines · Will Deacon
Quoted 5 lines · Sascha Hauer
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Shawn, is this one ok?

I reckon I need to post a v2 because this probably breaks when !SMP.

Actually, I take that back. Looks like the function is only used by hotplug.c and platsmp.c, both of which depend on CONFIG_SMP.

But the build of src.c does not depend on CONFIG_SMP. So when building with no CONFIG_SMP, we get:

CC arch/arm/mach-imx/src.o
arch/arm/mach-imx/src.c: In function ?imx_enable_cpu?:
arch/arm/mach-imx/src.c:31:2: error: implicit declaration of function ?cpu_logical_map? make[2]: *** [arch/arm/mach-imx/src.o] Error 1
make[1]: *** [arch/arm/mach-imx] Error 2

Signature · 2 lines
Regards,
Shawn
#6 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

Quoted 15 lines · Shawn Guo
Quoted 7 lines · Will Deacon
Quoted 6 lines · Will Deacon
Quoted 5 lines · Sascha Hauer
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Shawn, is this one ok?

I reckon I need to post a v2 because this probably breaks when !SMP.

Actually, I take that back. Looks like the function is only used by hotplug.c and platsmp.c, both of which depend on CONFIG_SMP.

Quoted 8 lines

But the build of src.c does not depend on CONFIG_SMP. So when building with no CONFIG_SMP, we get:

CC arch/arm/mach-imx/src.o
arch/arm/mach-imx/src.c: In function ?imx_enable_cpu?:
arch/arm/mach-imx/src.c:31:2: error: implicit declaration of function ?cpu_logical_map? make[2]: *** [arch/arm/mach-imx/src.o] Error 1
make[1]: *** [arch/arm/mach-imx] Error 2

Ok, then maybe we should #ifdef CONFIG_SMP that function entirely. If that sounds ok, I can post a v2.

Will

#7 lore raw

PATCH 1/2 ARM: mach-imx: convert logical CPU numbers to physical numbers

Quoted 19 lines · Will Deacon
Quoted 18 lines · Shawn Guo
Quoted 7 lines · Will Deacon
Quoted 6 lines · Will Deacon
Quoted 5 lines · Sascha Hauer
Quoted 3 lines · Will Deacon

This patch uses the new cpu_logical_map() macro for converting logical CPU numbers into physical numbers when releasing CPUs during the SMP boot and CPU hotplug paths.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Shawn, is this one ok?

I reckon I need to post a v2 because this probably breaks when !SMP.

Actually, I take that back. Looks like the function is only used by hotplug.c and platsmp.c, both of which depend on CONFIG_SMP.

But the build of src.c does not depend on CONFIG_SMP. So when building with no CONFIG_SMP, we get:

Quoted 9 lines
Quoted 5 lines

CC arch/arm/mach-imx/src.o
arch/arm/mach-imx/src.c: In function ?imx_enable_cpu?:
arch/arm/mach-imx/src.c:31:2: error: implicit declaration of function ?cpu_logical_map? make[2]: *** [arch/arm/mach-imx/src.o] Error 1
make[1]: *** [arch/arm/mach-imx] Error 2

Ok, then maybe we should #ifdef CONFIG_SMP that function entirely. If that sounds ok, I can post a v2.

Yes for imx_enable_cpu(), and no for imx_set_cpu_jump() as it's being called by pm-imx6q.c as well. And I would suggest just wrap #ifdef cpu_logical_map, as these two functions are exported in arch/arm/plat-mxc/include/mach/common.h for !SMP users too.

Signature · 2 lines
Regards,
Shawn