Skip to content

Commit 7725aca

Browse files
committed
init: Provide arch_cpu_finalize_init()
check_bugs() has become a dumping ground for all sorts of activities to finalize the CPU initialization before running the rest of the init code. Most are empty, a few do actual bug checks, some do alternative patching and some cobble a CPU advertisement string together.... Aside of that the current implementation requires duplicated function declaration and mostly empty header files for them. Provide a new function arch_cpu_finalize_init(). Provide a generic declaration if CONFIG_ARCH_HAS_CPU_FINALIZE_INIT is selected and a stub inline otherwise. This requires a temporary #ifdef in start_kernel() which will be removed along with check_bugs() once the architectures are converted over. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230613224544.957805717@linutronix.de
1 parent f1fcbaa commit 7725aca

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

arch/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ config ARCH_HAS_DMA_SET_UNCACHED
285285
config ARCH_HAS_DMA_CLEAR_UNCACHED
286286
bool
287287

288+
config ARCH_HAS_CPU_FINALIZE_INIT
289+
bool
290+
288291
# Select if arch init_task must go in the __init_task_data section
289292
config ARCH_TASK_STRUCT_ON_STACK
290293
bool

include/linux/cpu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ void arch_cpu_idle_enter(void);
184184
void arch_cpu_idle_exit(void);
185185
void __noreturn arch_cpu_idle_dead(void);
186186

187+
#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT
188+
void arch_cpu_finalize_init(void);
189+
#else
190+
static inline void arch_cpu_finalize_init(void) { }
191+
#endif
192+
187193
int cpu_report_state(int cpu);
188194
int cpu_check_up_prepare(int cpu);
189195
void cpu_set_state_online(int cpu);

init/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,11 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(v
10781078
taskstats_init_early();
10791079
delayacct_init();
10801080

1081+
arch_cpu_finalize_init();
1082+
/* Temporary conditional until everything has been converted */
1083+
#ifndef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT
10811084
check_bugs();
1085+
#endif
10821086

10831087
acpi_subsystem_init();
10841088
arch_post_acpi_subsys_init();

0 commit comments

Comments
 (0)