arm: Define cpu_logical_map when CONFIG_SMP is not set
Subsystems (8)
RFC PATCH 1/1 arm: Define cpu_logical_map when CONFIG_SMP is not set
From: Yang Bai <[email protected]>
If CONFIG_SMP is not set, define cpu_logical_map(cpu) as (cpu), this fixes the problem described in this mail:
https://lkml.org/lkml/2012/1/2/142
--- arch/arm/include/asm/smp.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/include/asm/smp.h +8 -4
@@ -10,14 +10,12 @@#ifndef __ASM_ARM_SMP_H#define __ASM_ARM_SMP_H +#ifdef CONFIG_SMP +#include <linux/threads.h> #include <linux/cpumask.h> #include <linux/thread_info.h> -#ifndef CONFIG_SMP -# error "<asm/smp.h> included in non-SMP build" -#endif -#define raw_smp_processor_id () (current_thread_info()->cpu)struct seq_file ;
@@ -99,4 +97,10 @@ extern void platform_cpu_enable(unsigned int cpu);extern void arch_send_call_function_single_ipi (int cpu);extern void arch_send_call_function_ipi_mask (const struct cpumask *mask); +#else + +#define cpu_logical_map (cpu) (cpu) + +#endif /* CONFIG_SMP */ +#endif /* ifndef __ASM_ARM_SMP_H */
Signature · 1 line
1.7.8.2
Quoted 5 lines · hamo.by at gmail.com
From: Yang Bai <[email protected]>
If
CONFIG_SMPis not set, definecpu_logical_map(cpu)as (cpu), this fixes the problem described in this mail:
https://lkml.org/lkml/2012/1/2/142
This doesn't solve the reported problem. asm/smp.h should not be included by any .c file, and won't be included by linux/smp.h if CONFIG_SMP is not set.
Quoted 10 lines · Russell King - ARM Linux
Quoted 5 lines · hamo.by at gmail.com
From: Yang Bai <[email protected]>
If
CONFIG_SMPis not set, definecpu_logical_map(cpu)as (cpu), this fixes the problem described in this mail:
https://lkml.org/lkml/2012/1/2/142This doesn't solve the reported problem.
asm/smp.hshould not be included by any .c file, and won't be included bylinux/smp.hifCONFIG_SMPis not set.
Exactly, which is why I think the proper solution to this is to move the mapping stuff out of smp.{ch} altogether. I tried moving the mapping macro into smp_plat.h and got something like below (compile-tested for vexpress only).
Note that I didn't bother to return constant 0 when !CONFIG_SMP, since we may want to do something more advanced with multi-cluster setups and the kexec stuff mentioned in the previous thread.
What do you reckon? The only remaining bit to fix is patch 7167/1 in the patch system, but that becomes much simpler with this change.
Will
arch/arm/common/gic.c +2 -5
@@ -40,6 +40,7 @@#include <linux/slab.h> #include <asm/irq.h> +#include <asm/smp_plat.h> #include <asm/mach/irq.h> #include <asm/hardware/gic.h>
@@ -271,11 +272,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)unsigned int gic_irqs = gic->gic_irqs;struct irq_domain *domain = &gic->domain;void __iomem *base = gic->dist_base; -u32 cpu =0 ; - -#ifdef CONFIG_SMP - cpu =cpu_logical_map (smp_processor_id ()); -#endif +u32 cpu =cpu_logical_map (smp_processor_id ()); cpumask =1 << cpu; cpumask |= cpumask <<8 ;
arch/arm/include/asm/smp.h +0 -6
@@ -71,12 +71,6 @@ extern void platform_secondary_init(unsigned int cpu);extern void platform_smp_prepare_cpus (unsigned int );/* -* Logical CPU mapping. -*/ -extern int __cpu_logical_map[NR_CPUS ]; -#define cpu_logical_map (cpu) __cpu_logical_map[cpu] - -/* * Initial data for bringing up a secondary CPU. */ struct secondary_data {
arch/arm/include/asm/smp_plat.h +6 -0
@@ -43,4 +43,10 @@ static inline int cache_ops_need_broadcast(void) }#endif +/* +* Logical CPU mapping. +*/ +extern int __cpu_logical_map[NR_CPUS ]; +#define cpu_logical_map (cpu) __cpu_logical_map[cpu] +#endif
arch/arm/kernel/setup.c +14 -0
@@ -425,6 +425,20 @@ void cpu_init(void) : "r14"); } +int __cpu_logical_map[NR_CPUS ]; + +void __init smp_setup_processor_id (void ) +{ +int i; +u32 cpu =is_smp () ?read_cpuid_mpidr () &0xff :0 ; + +cpu_logical_map (0 ) = cpu; +for (i =1 ; i <NR_CPUS ; ++i) +cpu_logical_map (i) = i == cpu ?0 : i; + +printk (KERN_INFO "Booting Linux on physical CPU %d\n" , cpu); +} +static void __init setup_processor (void ) {struct proc_info_list *list;
arch/arm/kernel/smp.c +0 -14
@@ -261,20 +261,6 @@ void __ref cpu_die(void) }#endif /* CONFIG_HOTPLUG_CPU */ -int __cpu_logical_map[NR_CPUS ]; - -void __init smp_setup_processor_id (void ) -{ -int i; -u32 cpu =is_smp () ?read_cpuid_mpidr () &0xff :0 ; - -cpu_logical_map (0 ) = cpu; -for (i =1 ; i <NR_CPUS ; ++i) -cpu_logical_map (i) = i == cpu ?0 : i; - -printk (KERN_INFO "Booting Linux on physical CPU %d\n" , cpu); -} -/* * Called by both boot and secondaries to move global data into * per-processor storage.
arch/arm/mach-exynos/hotplug.c +1 -0
@@ -16,6 +16,7 @@#include <linux/io.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> #include <mach/regs-pmu.h>
arch/arm/mach-exynos/platsmp.c +1 -0
@@ -23,6 +23,7 @@#include <asm/cacheflush.h> #include <asm/hardware/gic.h> +#include <asm/smp_plat.h> #include <asm/smp_scu.h> #include <asm/unified.h>
arch/arm/mach-highbank/highbank.c +1 -2
@@ -26,6 +26,7 @@#include <asm/cacheflush.h> #include <asm/unified.h> +#include <asm/smp_plat.h> #include <asm/smp_scu.h> #include <asm/hardware/arm_timer.h> #include <asm/hardware/timer-sp.h>
@@ -73,9 +74,7 @@ static void __init highbank_map_io(void)void highbank_set_cpu_jump (int cpu,void *jump_addr) { -#ifdef CONFIG_SMP cpu =cpu_logical_map (cpu); -#endif 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),
arch/arm/mach-imx/src.c +1 -4
@@ -15,6 +15,7 @@#include <linux/of.h> #include <linux/of_address.h> #include <linux/smp.h> +#include <asm/smp_plat.h> #include <asm/unified.h> #define SRC_SCR 0x000
@@ -24,10 +25,6 @@static void __iomem *src_base; -#ifndef CONFIG_SMP -#define cpu_logical_map (cpu) 0 -#endif -void imx_enable_cpu (int cpu,bool enable) {u32 mask, val;
arch/arm/mach-msm/hotplug.c +1 -0
@@ -11,6 +11,7 @@#include <linux/smp.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> extern volatile int pen_release;
arch/arm/mach-msm/platsmp.c +1 -0
@@ -20,6 +20,7 @@#include <asm/cacheflush.h> #include <asm/cputype.h> #include <asm/mach-types.h> +#include <asm/smp_plat.h> #include <mach/msm_iomap.h>
arch/arm/mach-realview/hotplug.c +1 -0
@@ -13,6 +13,7 @@#include <linux/smp.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> extern volatile int pen_release;
arch/arm/mach-shmobile/smp-sh73a0.c +1 -0
@@ -23,6 +23,7 @@#include <linux/spinlock.h> #include <linux/io.h> #include <mach/common.h> +#include <asm/smp_plat.h> #include <asm/smp_scu.h> #include <asm/smp_twd.h> #include <asm/hardware/gic.h>
arch/arm/mach-ux500/hotplug.c +1 -0
@@ -13,6 +13,7 @@#include <linux/smp.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> extern volatile int pen_release;
arch/arm/mach-ux500/platsmp.c +1 -0
@@ -19,6 +19,7 @@#include <asm/cacheflush.h> #include <asm/hardware/gic.h> +#include <asm/smp_plat.h> #include <asm/smp_scu.h> #include <mach/hardware.h> #include <mach/setup.h>
arch/arm/mach-vexpress/hotplug.c +1 -0
@@ -13,6 +13,7 @@#include <linux/smp.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> #include <asm/system.h> extern volatile int pen_release;
arch/arm/plat-versatile/platsmp.c +1 -0
@@ -16,6 +16,7 @@#include <linux/smp.h> #include <asm/cacheflush.h> +#include <asm/smp_plat.h> #include <asm/hardware/gic.h> /*