diff options
author | Will Deacon <will.deacon@arm.com> | 2012-01-20 06:01:12 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-23 05:20:05 -0500 |
commit | eb50439b92b6298bf209a982f295ba9c0f7cb30b (patch) | |
tree | 8678f4221e4a40907d9781753a8b95c96bbfded6 | |
parent | a092f2b15399bb4d1aa4e83cffe775f0c946f323 (diff) |
ARM: 7293/1: logical_cpu_map: decouple CPU mapping from SMP
It turns out that the logical CPU mapping is useful even when !CONFIG_SMP
for manipulation of devices like interrupt and power controllers when
running a UP kernel on a CPU other than 0. This can happen when kexecing
a UP image from an SMP kernel.
In the future, multi-cluster systems running AMP configurations will
require something similar for mapping cluster IDs, so it makes sense to
decouple this logic in preparation for this support.
Acked-by: Yang Bai <hamo.by@gmail.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reported-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/common/gic.c | 7 | ||||
-rw-r--r-- | arch/arm/include/asm/smp.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/smp_plat.h | 6 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 14 | ||||
-rw-r--r-- | arch/arm/kernel/smp.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-exynos/hotplug.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-exynos/platsmp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-highbank/highbank.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/src.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-msm/hotplug.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-msm/platsmp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-realview/hotplug.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/smp-r8a7779.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/smp-sh73a0.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-ux500/hotplug.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-ux500/platsmp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/hotplug.c | 1 | ||||
-rw-r--r-- | arch/arm/plat-versatile/platsmp.c | 1 |
18 files changed, 35 insertions, 31 deletions
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index b2dc2dd7f1df..c47d6199b784 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include <asm/irq.h> | 42 | #include <asm/irq.h> |
43 | #include <asm/exception.h> | 43 | #include <asm/exception.h> |
44 | #include <asm/smp_plat.h> | ||
44 | #include <asm/mach/irq.h> | 45 | #include <asm/mach/irq.h> |
45 | #include <asm/hardware/gic.h> | 46 | #include <asm/hardware/gic.h> |
46 | 47 | ||
@@ -352,11 +353,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic) | |||
352 | unsigned int gic_irqs = gic->gic_irqs; | 353 | unsigned int gic_irqs = gic->gic_irqs; |
353 | struct irq_domain *domain = &gic->domain; | 354 | struct irq_domain *domain = &gic->domain; |
354 | void __iomem *base = gic_data_dist_base(gic); | 355 | void __iomem *base = gic_data_dist_base(gic); |
355 | u32 cpu = 0; | 356 | u32 cpu = cpu_logical_map(smp_processor_id()); |
356 | |||
357 | #ifdef CONFIG_SMP | ||
358 | cpu = cpu_logical_map(smp_processor_id()); | ||
359 | #endif | ||
360 | 357 | ||
361 | cpumask = 1 << cpu; | 358 | cpumask = 1 << cpu; |
362 | cpumask |= cpumask << 8; | 359 | cpumask |= cpumask << 8; |
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h index 1e5717afc4ac..ae29293270a3 100644 --- a/arch/arm/include/asm/smp.h +++ b/arch/arm/include/asm/smp.h | |||
@@ -71,12 +71,6 @@ extern void platform_secondary_init(unsigned int cpu); | |||
71 | extern void platform_smp_prepare_cpus(unsigned int); | 71 | extern void platform_smp_prepare_cpus(unsigned int); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Logical CPU mapping. | ||
75 | */ | ||
76 | extern int __cpu_logical_map[NR_CPUS]; | ||
77 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | ||
78 | |||
79 | /* | ||
80 | * Initial data for bringing up a secondary CPU. | 74 | * Initial data for bringing up a secondary CPU. |
81 | */ | 75 | */ |
82 | struct secondary_data { | 76 | struct secondary_data { |
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h index f24c1b9e211d..558d6c80aca9 100644 --- a/arch/arm/include/asm/smp_plat.h +++ b/arch/arm/include/asm/smp_plat.h | |||
@@ -43,4 +43,10 @@ static inline int cache_ops_need_broadcast(void) | |||
43 | } | 43 | } |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /* | ||
47 | * Logical CPU mapping. | ||
48 | */ | ||
49 | extern int __cpu_logical_map[]; | ||
50 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | ||
51 | |||
46 | #endif | 52 | #endif |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index ab70c9124538..a255c39612ca 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -426,6 +426,20 @@ void cpu_init(void) | |||
426 | : "r14"); | 426 | : "r14"); |
427 | } | 427 | } |
428 | 428 | ||
429 | int __cpu_logical_map[NR_CPUS]; | ||
430 | |||
431 | void __init smp_setup_processor_id(void) | ||
432 | { | ||
433 | int i; | ||
434 | u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0; | ||
435 | |||
436 | cpu_logical_map(0) = cpu; | ||
437 | for (i = 1; i < NR_CPUS; ++i) | ||
438 | cpu_logical_map(i) = i == cpu ? 0 : i; | ||
439 | |||
440 | printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu); | ||
441 | } | ||
442 | |||
429 | static void __init setup_processor(void) | 443 | static void __init setup_processor(void) |
430 | { | 444 | { |
431 | struct proc_info_list *list; | 445 | struct proc_info_list *list; |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 26cdc494ee9b..cdeb727527d3 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -233,20 +233,6 @@ void __ref cpu_die(void) | |||
233 | } | 233 | } |
234 | #endif /* CONFIG_HOTPLUG_CPU */ | 234 | #endif /* CONFIG_HOTPLUG_CPU */ |
235 | 235 | ||
236 | int __cpu_logical_map[NR_CPUS]; | ||
237 | |||
238 | void __init smp_setup_processor_id(void) | ||
239 | { | ||
240 | int i; | ||
241 | u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0; | ||
242 | |||
243 | cpu_logical_map(0) = cpu; | ||
244 | for (i = 1; i < NR_CPUS; ++i) | ||
245 | cpu_logical_map(i) = i == cpu ? 0 : i; | ||
246 | |||
247 | printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu); | ||
248 | } | ||
249 | |||
250 | /* | 236 | /* |
251 | * Called by both boot and secondaries to move global data into | 237 | * Called by both boot and secondaries to move global data into |
252 | * per-processor storage. | 238 | * per-processor storage. |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index da70e7e39937..dd1ad55524c9 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/smp_plat.h> | ||
19 | 20 | ||
20 | #include <mach/regs-pmu.h> | 21 | #include <mach/regs-pmu.h> |
21 | 22 | ||
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 683aec786b78..0f2035a1eb6e 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
25 | #include <asm/hardware/gic.h> | 25 | #include <asm/hardware/gic.h> |
26 | #include <asm/smp_plat.h> | ||
26 | #include <asm/smp_scu.h> | 27 | #include <asm/smp_scu.h> |
27 | 28 | ||
28 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 7afbe1e55beb..8394d512a402 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/smp.h> | 25 | #include <linux/smp.h> |
26 | 26 | ||
27 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
28 | #include <asm/smp_plat.h> | ||
28 | #include <asm/smp_scu.h> | 29 | #include <asm/smp_scu.h> |
29 | #include <asm/hardware/arm_timer.h> | 30 | #include <asm/hardware/arm_timer.h> |
30 | #include <asm/hardware/timer-sp.h> | 31 | #include <asm/hardware/timer-sp.h> |
@@ -72,9 +73,7 @@ static void __init highbank_map_io(void) | |||
72 | 73 | ||
73 | void highbank_set_cpu_jump(int cpu, void *jump_addr) | 74 | void highbank_set_cpu_jump(int cpu, void *jump_addr) |
74 | { | 75 | { |
75 | #ifdef CONFIG_SMP | ||
76 | cpu = cpu_logical_map(cpu); | 76 | cpu = cpu_logical_map(cpu); |
77 | #endif | ||
78 | writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu)); | 77 | writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu)); |
79 | __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16); | 78 | __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16); |
80 | outer_clean_range(HB_JUMP_TABLE_PHYS(cpu), | 79 | outer_clean_range(HB_JUMP_TABLE_PHYS(cpu), |
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c index 29bd1243781e..e15f1555c59b 100644 --- a/arch/arm/mach-imx/src.c +++ b/arch/arm/mach-imx/src.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_address.h> | 16 | #include <linux/of_address.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <asm/smp_plat.h> | ||
18 | 19 | ||
19 | #define SRC_SCR 0x000 | 20 | #define SRC_SCR 0x000 |
20 | #define SRC_GPR1 0x020 | 21 | #define SRC_GPR1 0x020 |
@@ -24,10 +25,6 @@ | |||
24 | 25 | ||
25 | static void __iomem *src_base; | 26 | static void __iomem *src_base; |
26 | 27 | ||
27 | #ifndef CONFIG_SMP | ||
28 | #define cpu_logical_map(cpu) 0 | ||
29 | #endif | ||
30 | |||
31 | void imx_enable_cpu(int cpu, bool enable) | 28 | void imx_enable_cpu(int cpu, bool enable) |
32 | { | 29 | { |
33 | u32 mask, val; | 30 | u32 mask, val; |
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c index 41c252de0215..a446fc14221f 100644 --- a/arch/arm/mach-msm/hotplug.c +++ b/arch/arm/mach-msm/hotplug.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | 12 | ||
13 | #include <asm/cacheflush.h> | 13 | #include <asm/cacheflush.h> |
14 | #include <asm/smp_plat.h> | ||
14 | 15 | ||
15 | extern volatile int pen_release; | 16 | extern volatile int pen_release; |
16 | 17 | ||
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c index 0b3e357c4c8c..db0117ec55f4 100644 --- a/arch/arm/mach-msm/platsmp.c +++ b/arch/arm/mach-msm/platsmp.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
21 | #include <asm/cputype.h> | 21 | #include <asm/cputype.h> |
22 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
23 | #include <asm/smp_plat.h> | ||
23 | 24 | ||
24 | #include <mach/msm_iomap.h> | 25 | #include <mach/msm_iomap.h> |
25 | 26 | ||
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index ac1aed2a8da4..eb55f05bef3a 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | 14 | ||
15 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
16 | #include <asm/smp_plat.h> | ||
16 | 17 | ||
17 | extern volatile int pen_release; | 18 | extern volatile int pen_release; |
18 | 19 | ||
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c index cc97ef892d1b..4fe2e9eaf501 100644 --- a/arch/arm/mach-shmobile/smp-r8a7779.c +++ b/arch/arm/mach-shmobile/smp-r8a7779.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <mach/common.h> | 26 | #include <mach/common.h> |
27 | #include <mach/r8a7779.h> | 27 | #include <mach/r8a7779.h> |
28 | #include <asm/smp_plat.h> | ||
28 | #include <asm/smp_scu.h> | 29 | #include <asm/smp_scu.h> |
29 | #include <asm/smp_twd.h> | 30 | #include <asm/smp_twd.h> |
30 | #include <asm/hardware/gic.h> | 31 | #include <asm/hardware/gic.h> |
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c index be1ade76ccc8..0d159d64a345 100644 --- a/arch/arm/mach-shmobile/smp-sh73a0.c +++ b/arch/arm/mach-shmobile/smp-sh73a0.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <mach/common.h> | 25 | #include <mach/common.h> |
26 | #include <asm/smp_plat.h> | ||
26 | #include <asm/smp_scu.h> | 27 | #include <asm/smp_scu.h> |
27 | #include <asm/smp_twd.h> | 28 | #include <asm/smp_twd.h> |
28 | #include <asm/hardware/gic.h> | 29 | #include <asm/hardware/gic.h> |
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c index 572015e57cd9..c76f0f456f04 100644 --- a/arch/arm/mach-ux500/hotplug.c +++ b/arch/arm/mach-ux500/hotplug.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | 14 | ||
15 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
16 | #include <asm/smp_plat.h> | ||
16 | 17 | ||
17 | extern volatile int pen_release; | 18 | extern volatile int pen_release; |
18 | 19 | ||
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index a19e398dade3..d2058ef8345f 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
21 | #include <asm/hardware/gic.h> | 21 | #include <asm/hardware/gic.h> |
22 | #include <asm/smp_plat.h> | ||
22 | #include <asm/smp_scu.h> | 23 | #include <asm/smp_scu.h> |
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
24 | #include <mach/setup.h> | 25 | #include <mach/setup.h> |
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index 813ee08f96e6..3034a4dab4a1 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | 14 | ||
15 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
16 | #include <asm/smp_plat.h> | ||
16 | #include <asm/system.h> | 17 | #include <asm/system.h> |
17 | 18 | ||
18 | extern volatile int pen_release; | 19 | extern volatile int pen_release; |
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c index 92f18d372b69..49c7db48c7f1 100644 --- a/arch/arm/plat-versatile/platsmp.c +++ b/arch/arm/plat-versatile/platsmp.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/smp.h> | 16 | #include <linux/smp.h> |
17 | 17 | ||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/smp_plat.h> | ||
19 | #include <asm/hardware/gic.h> | 20 | #include <asm/hardware/gic.h> |
20 | 21 | ||
21 | /* | 22 | /* |