diff options
author | Mark Rutland <mark.rutland@arm.com> | 2015-03-13 12:14:34 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2015-03-17 12:58:24 -0400 |
commit | 137650aad96c9594683445e41afa8ac5a2097520 (patch) | |
tree | 3faff891a324ef948471492d3cda2e8ca7ecbcca /arch/arm64 | |
parent | 1baa82f48030f38d1895301f1ec93acbcb3d15db (diff) |
arm64: apply alternatives for !SMP kernels
Currently we only perform alternative patching for kernels built with
CONFIG_SMP, as we call apply_alternatives_all() in smp.c, which is only
built for CONFIG_SMP. Thus !SMP kernels may not have necessary
alternatives patched in.
This patch ensures that we call apply_alternatives_all() once all CPUs
are booted, even for !SMP kernels, by having the smp_init_cpus() stub
call this for !SMP kernels via up_late_init. A new wrapper,
do_post_cpus_up_work, is added so we can hook other calls here later
(e.g. boot mode logging).
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Fixes: e039ee4ee3fcf174 ("arm64: add alternative runtime patching")
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm64/include/asm/smp_plat.h | 2 | ||||
-rw-r--r-- | arch/arm64/kernel/setup.c | 12 | ||||
-rw-r--r-- | arch/arm64/kernel/smp.c | 2 |
4 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1b8e97331ffb..0d46debbc9a7 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -470,6 +470,10 @@ config HOTPLUG_CPU | |||
470 | 470 | ||
471 | source kernel/Kconfig.preempt | 471 | source kernel/Kconfig.preempt |
472 | 472 | ||
473 | config UP_LATE_INIT | ||
474 | def_bool y | ||
475 | depends on !SMP | ||
476 | |||
473 | config HZ | 477 | config HZ |
474 | int | 478 | int |
475 | default 100 | 479 | default 100 |
diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h index 59e282311b58..8dcd61e32176 100644 --- a/arch/arm64/include/asm/smp_plat.h +++ b/arch/arm64/include/asm/smp_plat.h | |||
@@ -40,4 +40,6 @@ static inline u32 mpidr_hash_size(void) | |||
40 | extern u64 __cpu_logical_map[NR_CPUS]; | 40 | extern u64 __cpu_logical_map[NR_CPUS]; |
41 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | 41 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] |
42 | 42 | ||
43 | void __init do_post_cpus_up_work(void); | ||
44 | |||
43 | #endif /* __ASM_SMP_PLAT_H */ | 45 | #endif /* __ASM_SMP_PLAT_H */ |
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index e8420f635bd4..781f4697dc26 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c | |||
@@ -207,6 +207,18 @@ static void __init smp_build_mpidr_hash(void) | |||
207 | } | 207 | } |
208 | #endif | 208 | #endif |
209 | 209 | ||
210 | void __init do_post_cpus_up_work(void) | ||
211 | { | ||
212 | apply_alternatives_all(); | ||
213 | } | ||
214 | |||
215 | #ifdef CONFIG_UP_LATE_INIT | ||
216 | void __init up_late_init(void) | ||
217 | { | ||
218 | do_post_cpus_up_work(); | ||
219 | } | ||
220 | #endif /* CONFIG_UP_LATE_INIT */ | ||
221 | |||
210 | static void __init setup_processor(void) | 222 | static void __init setup_processor(void) |
211 | { | 223 | { |
212 | struct cpu_info *cpu_info; | 224 | struct cpu_info *cpu_info; |
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 328b8ce4b007..4257369341e4 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c | |||
@@ -309,7 +309,7 @@ void cpu_die(void) | |||
309 | void __init smp_cpus_done(unsigned int max_cpus) | 309 | void __init smp_cpus_done(unsigned int max_cpus) |
310 | { | 310 | { |
311 | pr_info("SMP: Total of %d processors activated.\n", num_online_cpus()); | 311 | pr_info("SMP: Total of %d processors activated.\n", num_online_cpus()); |
312 | apply_alternatives_all(); | 312 | do_post_cpus_up_work(); |
313 | } | 313 | } |
314 | 314 | ||
315 | void __init smp_prepare_boot_cpu(void) | 315 | void __init smp_prepare_boot_cpu(void) |