init, treewide, x86: Cleanup check_bugs() and start sanitizing the x86 boot process
Subsystems (15)
cover init, treewide, x86: Cleanup check_bugs() and start sanitizing the x86 boot process
Hi!
My team and myself are working on sanitizing the x86 boot process, especially the complete horror show of CPUID evaluation, which is constructed with hay-wire circuits, duct tape and superglue.
A related goal is to move the initialization of infrastructure which is not required during early boot out into a later phase of the boot process. Early boot is fragile and convoluted enough already, so anything which can move into a later phase is a win.
X86 FPU initialization is one of the obvious parts which has zero justification to be done early. The only requirement is that it happens before alternative patching. Doing it early also requires custom command line parsing which can be obviously avoided when the initialization happens later.
Alternative patching happens from check_bugs() which is invoked late in start_kernel(). Moving FPU initialization into that is too late because check_bugs() is invoked after fork_init(), but fork_init() requires that the FPU is initialized on X86 as on X86 the size of task_struct depends on the FPU register buffer size.
In order to avoid another magic function we set out to move check_bugs() earlier and inspected all incarnations whether there is any reason to do that so late. It turned out there is none (famous last words), but it also revealed that check_bugs() is a gross misnomer.
check_bugs() has become a dump ground for finalizing the CPU initialization before running the rest of the init code.
Most implementations are empty, a few do actual bug checks, some do alternative patching and one cobbles a CPU advertisment string together...
As a consequence we decided to rename it to arch_cpu_finalize_init(). The purely mechanical 's/check_bugs/arch_cpu_finalize_init/' would have been trivial, but having stared at the actual implementations of check_bugs() had triggered the scavenger reflex already. So I got the mop out and cleaned it up completely.
The resulting series consists therefore of three parts:
1) Patches 1-11
Rename and mop up check_bugs() which removes a solid amount of redundant historical copy & pasta crud:
39 files changed, 161 insertions(+), 321 deletions(-)
11 out of the 39 changed files are removed completely.
2) Patches 12-13
Move the invocation of arch_cpu_finalize_init() earlier in start_kernel() and move the x86'ism mem_encrypt_init() into the x86 space.
3) Patches 14-17
Implement the late FPU initialization for X86 on top. Removal of the custom early command line parsing is subject to separate x86 specific changes. This part #3 is to illustrate the use case for #2.
The series applies on Linus tree and is also available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git init
Thanks,
tglx
--- a/arch/alpha/include/asm/bugs.h | 20 --------- a/arch/ia64/include/asm/bugs.h | 20 --------- a/arch/loongarch/include/asm/bugs.h | 15 ------ a/arch/m68k/include/asm/bugs.h | 21 --------- a/arch/parisc/include/asm/bugs.h | 20 --------- a/arch/powerpc/include/asm/bugs.h | 15 ------ a/arch/sh/include/asm/bugs.h | 74 --------------------------------- a/arch/sparc/include/asm/bugs.h | 18 -------- a/arch/um/include/asm/bugs.h | 7 --- a/arch/xtensa/include/asm/bugs.h | 18 -------- a/include/asm-generic/bugs.h | 11 ----- arch/Kconfig | 3 + arch/arm/Kconfig | 1 arch/arm/include/asm/bugs.h | 4 - arch/arm/kernel/bugs.c | 3 - arch/ia64/Kconfig | 1 arch/ia64/kernel/setup.c | 3 - arch/loongarch/Kconfig | 1 arch/loongarch/kernel/setup.c | 4 - arch/m68k/Kconfig | 1 arch/m68k/kernel/setup_mm.c | 3 - arch/mips/Kconfig | 1 arch/mips/include/asm/bugs.h | 17 ------- arch/mips/kernel/setup.c | 13 +++++ arch/sh/Kconfig | 1 arch/sh/include/asm/processor.h | 2 arch/sh/kernel/idle.c | 1 arch/sh/kernel/setup.c | 55 +++++++++++++++++++++++++ arch/sparc/Kconfig | 1 arch/sparc/kernel/setup_32.c | 7 +++ arch/um/Kconfig | 1 arch/um/kernel/um_arch.c | 3 - arch/x86/Kconfig | 1 arch/x86/include/asm/bugs.h | 2 arch/x86/include/asm/fpu/api.h | 2 arch/x86/include/asm/mem_encrypt.h | 7 +-- arch/x86/include/asm/sigframe.h | 2 arch/x86/kernel/cpu/bugs.c | 51 ----------------------- arch/x86/kernel/cpu/common.c | 79 ++++++++++++++++++++++++++++++++---- arch/x86/kernel/cpu/cpu.h | 1 arch/x86/kernel/fpu/init.c | 8 +-- arch/x86/kernel/signal.c | 4 + include/linux/cpu.h | 6 ++ init/main.c | 16 ------- 44 files changed, 192 insertions(+), 352 deletions(-)
PATCH 1/17 init: Provide arch_cpu_finalize_init()
check_bugs() has become a dump 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 advertisment 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.
--- arch/Kconfig | 3 +++ include/linux/cpu.h | 6 ++++++ init/main.c | 4 ++++ 3 files changed, 13 insertions(+)
arch/Kconfig +3 -0
@@ -285,6 +285,9 @@ config ARCH_HAS_DMA_SET_UNCACHED config ARCH_HAS_DMA_CLEAR_UNCACHED bool +config ARCH_HAS_CPU_FINALIZE_INIT + bool + # Select if arch init_task must go in the __init_task_data section config ARCH_TASK_STRUCT_ON_STACK bool
include/linux/cpu.h +6 -0
@@ -184,6 +184,12 @@ void arch_cpu_idle_enter(void);void arch_cpu_idle_exit (void );void __noreturn arch_cpu_idle_dead (void ); +#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT +void arch_cpu_finalize_init (void ); +#else +static inline void arch_cpu_finalize_init (void ) { } +#endif +int cpu_report_state (int cpu);int cpu_check_up_prepare (int cpu);void cpu_set_state_online (int cpu);
init/main.c +4 -0
@@ -1078,7 +1078,11 @@ asmlinkage __visible void __init __no_sataskstats_init_early ();delayacct_init (); +arch_cpu_finalize_init (); +/* Temporary conditional until everything has been converted */ +#ifndef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT check_bugs (); +#endif acpi_subsystem_init ();arch_post_acpi_subsys_init ();
Borislav Petkov
maintainerRe: [patch 01/17] init: Provide arch_cpu_finalize_init()
Just typos:
Quoted 1 line · Thomas Gleixner
check_bugs()has become a dump ground for all sorts of activities to
"dumping ground"
Quoted 4 lines
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 advertisment string together....
advertisement
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette[tip: x86/boot] init: Provide arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 7725acaa4f0c04fbefb0e0d342635b967bb7d414 Gitweb: https://git.kernel.org/tip/7725acaa4f0c04fbefb0e0d342635b967bb7d414 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:22 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
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.
--- arch/Kconfig | 3 +++ include/linux/cpu.h | 6 ++++++ init/main.c | 4 ++++ 3 files changed, 13 insertions(+)
arch/Kconfig +3 -0
@@ -285,6 +285,9 @@ config ARCH_HAS_DMA_SET_UNCACHED config ARCH_HAS_DMA_CLEAR_UNCACHED bool +config ARCH_HAS_CPU_FINALIZE_INIT + bool + # Select if arch init_task must go in the __init_task_data section config ARCH_TASK_STRUCT_ON_STACK bool
include/linux/cpu.h +6 -0
@@ -184,6 +184,12 @@ void arch_cpu_idle_enter(void);void arch_cpu_idle_exit (void );void __noreturn arch_cpu_idle_dead (void ); +#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT +void arch_cpu_finalize_init (void ); +#else +static inline void arch_cpu_finalize_init (void ) { } +#endif +int cpu_report_state (int cpu);int cpu_check_up_prepare (int cpu);void cpu_set_state_online (int cpu);
init/main.c +4 -0
@@ -1078,7 +1078,11 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(vtaskstats_init_early ();delayacct_init (); +arch_cpu_finalize_init (); +/* Temporary conditional until everything has been converted */ +#ifndef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT check_bugs (); +#endif acpi_subsystem_init ();arch_post_acpi_subsys_init ();
PATCH 2/17 x86/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is a dump ground for finalizing the CPU bringup. Only parts of it has to do with actual CPU bugs.
Split it apart into arch_cpu_finalize_init() and cpu_select_mitigations().
Fixup the bogus 32bit comments while at it.
No functional change.
--- arch/x86/Kconfig | 1 arch/x86/include/asm/bugs.h | 2 - arch/x86/kernel/cpu/bugs.c | 51 ----------------------------------------- arch/x86/kernel/cpu/common.c | 53 +++++++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/cpu/cpu.h | 1 5 files changed, 56 insertions(+), 52 deletions(-)
arch/x86/Kconfig +1 -0
@@ -71,6 +71,7 @@ config X86 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE if !X86_PAE
arch/x86/include/asm/bugs.h +0 -2
@@ -4,8 +4,6 @@#include <asm/processor.h> -extern void check_bugs (void ); -#if defined(CONFIG_CPU_SUP_INTEL ) && defined(CONFIG_X86_32 )int ppro_with_ram_bug (void );#else
arch/x86/kernel/cpu/bugs.c +1 -50
76 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +53 -0
73 lines not on this page · raw message
arch/x86/kernel/cpu/cpu.h +1 -0
@@ -79,6 +79,7 @@ extern void detect_ht(struct cpuinfo_x86extern void check_null_seg_clears_base (struct cpuinfo_x86 *c);unsigned int aperfmperf_get_khz (int cpu); +void cpu_select_mitigations (void );extern void x86_spec_ctrl_setup_ap (void );extern void update_srbds_msr (void );
Re: [patch 02/17] x86/cpu: Switch to arch_cpu_finalize_init()
Quoted 4 lines · Thomas Gleixner
arch/x86/kernel/cpu/common.c +4
-0+/* +* identify_boot_cpu() initialized SMT support information, let the +* core code know. +*/
arch/x86/kernel/cpu/common.c void arch_smt_update(void) · line 2387
Quoted 10 lines
arch/x86/kernel/cpu/common.c +10
-0+cpu_smt_check_topology (); + +if (!IS_ENABLED (CONFIG_SMP )) { +pr_info ("CPU: " ); +print_cpu_info (&boot_cpu_data); + } + +arch_smt_update (); + +cpu_select_mitigations ();
That's the wrong order. mitigations must come before the smt update. Thanks to Boris for spotting it.
Re: [patch 02/17] x86/cpu: Switch to arch_cpu_finalize_init()
Quoted 2 lines · Thomas Gleixner
That's the wrong order. mitigations must come before the smt update. Thanks to Boris for spotting it.
Right, with that fixed the ordering looks good now.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette[tip: x86/boot] x86/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 7c7077a72674402654f3291354720cd73cdf649e Gitweb: https://git.kernel.org/tip/7c7077a72674402654f3291354720cd73cdf649e Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:24 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
x86/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is a dumping ground for finalizing the CPU bringup. Only parts of it has to do with actual CPU bugs.
Split it apart into arch_cpu_finalize_init() and cpu_select_mitigations().
Fixup the bogus 32bit comments while at it.
No functional change.
--- arch/x86/Kconfig | 1 +- arch/x86/include/asm/bugs.h | 2 +- arch/x86/kernel/cpu/bugs.c | 51 +---------------------------------- arch/x86/kernel/cpu/common.c | 53 +++++++++++++++++++++++++++++++++++- arch/x86/kernel/cpu/cpu.h | 1 +- 5 files changed, 56 insertions(+), 52 deletions(-)
arch/x86/Kconfig +1 -0
@@ -71,6 +71,7 @@ config X86 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE if !X86_PAE
arch/x86/include/asm/bugs.h +0 -2
@@ -4,8 +4,6 @@#include <asm/processor.h> -extern void check_bugs (void ); -#if defined(CONFIG_CPU_SUP_INTEL ) && defined(CONFIG_X86_32 )int ppro_with_ram_bug (void );#else
arch/x86/kernel/cpu/bugs.c +1 -50
76 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +53 -0
73 lines not on this page · raw message
arch/x86/kernel/cpu/cpu.h +1 -0
@@ -79,6 +79,7 @@ extern void detect_ht(struct cpuinfo_x86 *c);extern void check_null_seg_clears_base (struct cpuinfo_x86 *c);unsigned int aperfmperf_get_khz (int cpu); +void cpu_select_mitigations (void );extern void x86_spec_ctrl_setup_ap (void );extern void update_srbds_msr (void );
PATCH 3/17 ARM: cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/arm/Kconfig | 1 + arch/arm/include/asm/bugs.h | 4 ---- arch/arm/kernel/bugs.c | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/Kconfig +1 -0
@@ -5,6 +5,7 @@ config ARM select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
arch/arm/include/asm/bugs.h +0 -4
@@ -1,7 +1,5 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* arch/arm/include/asm/bugs.h -* * Copyright (C) 1995-2003 Russell King */ #ifndef __ASM_BUGS_H
@@ -10,10 +8,8 @@extern void check_writebuffer_bugs (void );#ifdef CONFIG_MMU -extern void check_bugs (void );extern void check_other_bugs (void );#else -#define check_bugs () do { } while (0)#define check_other_bugs () do { } while (0)#endif
arch/arm/kernel/bugs.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/init.h> +#include <linux/cpu.h> #include <asm/bugs.h> #include <asm/proc-fns.h>
@@ -11,7 +12,7 @@ void check_other_bugs(void)#endif } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {check_writebuffer_bugs ();check_other_bugs ();
[tip: x86/boot] ARM: cpu: Switch to arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: ee31bb0524a2e7c99b03f50249a411cc1eaa411f Gitweb: https://git.kernel.org/tip/ee31bb0524a2e7c99b03f50249a411cc1eaa411f Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:25 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
ARM: cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/arm/Kconfig | 1 + arch/arm/include/asm/bugs.h | 4 ---- arch/arm/kernel/bugs.c | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/Kconfig +1 -0
@@ -5,6 +5,7 @@ config ARM select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
arch/arm/include/asm/bugs.h +0 -4
@@ -1,7 +1,5 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* arch/arm/include/asm/bugs.h -* * Copyright (C) 1995-2003 Russell King */ #ifndef __ASM_BUGS_H
@@ -10,10 +8,8 @@extern void check_writebuffer_bugs (void );#ifdef CONFIG_MMU -extern void check_bugs (void );extern void check_other_bugs (void );#else -#define check_bugs () do { } while (0)#define check_other_bugs () do { } while (0)#endif
arch/arm/kernel/bugs.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/init.h> +#include <linux/cpu.h> #include <asm/bugs.h> #include <asm/proc-fns.h>
@@ -11,7 +12,7 @@ void check_other_bugs(void)#endif } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {check_writebuffer_bugs ();check_other_bugs ();
Re: [patch 03/17] ARM: cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 9 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Russell King <[email protected]>Cc Arnd Bergmann <[email protected]>
Quoted 5 lines
--- arch/arm/Kconfig | 1 + arch/arm/include/asm/bugs.h | 4 ---- arch/arm/kernel/bugs.c | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-)
PATCH 4/17 ia64/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/bugs.h | 20 -------------------- arch/ia64/kernel/setup.c | 3 +-- 3 files changed, 2 insertions(+), 22 deletions(-)
arch/ia64/Kconfig +1 -0
@@ -9,6 +9,7 @@ menu "Processor type and features" config IA64 bool select ARCH_BINFMT_ELF_EXTRA_PHDRS + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_DMA_MARK_CLEAN select ARCH_HAS_STRNCPY_FROM_USER select ARCH_HAS_STRNLEN_USER
arch/ia64/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -* -* Based on <asm-alpha/bugs.h>. -* -* Modified 1998, 1999, 2003 -* David Mosberger-Tang <[email protected]>, Hewlett-Packard Co. -*/ -#ifndef _ASM_IA64_BUGS_H -#define _ASM_IA64_BUGS_H - -#include <asm/processor.h> - -extern void check_bugs (void ); - -#endif /* _ASM_IA64_BUGS_H */
arch/ia64/kernel/setup.c +1 -2
@@ -1067,8 +1067,7 @@ cpu_init (void) } } -void __init -check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {ia64_patch_mckinley_e9 ((unsigned long ) __start___mckinley_e9_bundles, (unsigned long ) __end___mckinley_e9_bundles);
[tip: x86/boot] ia64/cpu: Switch to arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 6c38e3005621800263f117fb00d6787a76e16de7 Gitweb: https://git.kernel.org/tip/6c38e3005621800263f117fb00d6787a76e16de7 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:27 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
ia64/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/bugs.h | 20 -------------------- arch/ia64/kernel/setup.c | 3 +-- 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 arch/ia64/include/asm/bugs.h
arch/ia64/Kconfig +1 -0
@@ -9,6 +9,7 @@ menu "Processor type and features" config IA64 bool select ARCH_BINFMT_ELF_EXTRA_PHDRS + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_DMA_MARK_CLEAN select ARCH_HAS_STRNCPY_FROM_USER select ARCH_HAS_STRNLEN_USER
arch/ia64/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -* -* Based on <asm-alpha/bugs.h>. -* -* Modified 1998, 1999, 2003 -* David Mosberger-Tang <[email protected]>, Hewlett-Packard Co. -*/ -#ifndef _ASM_IA64_BUGS_H -#define _ASM_IA64_BUGS_H - -#include <asm/processor.h> - -extern void check_bugs (void ); - -#endif /* _ASM_IA64_BUGS_H */
arch/ia64/kernel/setup.c +1 -2
@@ -1067,8 +1067,7 @@ cpu_init (void) } } -void __init -check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {ia64_patch_mckinley_e9 ((unsigned long ) __start___mckinley_e9_bundles, (unsigned long ) __end___mckinley_e9_bundles);
Re: [patch 04/17] ia64/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 5 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Quoted 7 lines
Signed-off-by Thomas Gleixner <[email protected]>--- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/bugs.h | 20 -------------------- arch/ia64/kernel/setup.c | 3 +-- 3 files changed, 2 insertions(+), 22 deletions(-)
PATCH 5/17 loongarch/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/bugs.h | 15 --------------- arch/loongarch/kernel/setup.c | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-)
arch/loongarch/Kconfig +1 -0
@@ -10,6 +10,7 @@ config LOONGARCH select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select ARCH_HAS_PTE_SPECIAL
arch/loongarch/include/asm/bugs.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Copyright (C) 2020-2022 Loongson Technology Corporation Limited -*/ -#ifndef _ASM_BUGS_H -#define _ASM_BUGS_H - -#include <asm/cpu.h> -#include <asm/cpu-info.h> - -extern void check_bugs (void ); - -#endif /* _ASM_BUGS_H */
arch/loongarch/kernel/setup.c +2 -2
@@ -12,6 +12,7 @@*/ #include <linux/init.h> #include <linux/acpi.h> +#include <linux/cpu.h> #include <linux/dmi.h> #include <linux/efi.h> #include <linux/export.h>
@@ -37,7 +38,6 @@#include <asm/addrspace.h> #include <asm/alternative.h> #include <asm/bootinfo.h> -#include <asm/bugs.h> #include <asm/cache.h> #include <asm/cpu.h> #include <asm/dma.h>
@@ -87,7 +87,7 @@ const char *get_system_type(void)return "generic-loongson-machine" ; } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {alternative_instructions (); }
[tip: x86/boot] loongarch/cpu: Switch to arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 9841c423164787feb8f1442f922b7d80a70c82f1 Gitweb: https://git.kernel.org/tip/9841c423164787feb8f1442f922b7d80a70c82f1 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:28 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
loongarch/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/bugs.h | 15 --------------- arch/loongarch/kernel/setup.c | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 arch/loongarch/include/asm/bugs.h
arch/loongarch/Kconfig +1 -0
@@ -10,6 +10,7 @@ config LOONGARCH select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select ARCH_HAS_PTE_SPECIAL
arch/loongarch/include/asm/bugs.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Copyright (C) 2020-2022 Loongson Technology Corporation Limited -*/ -#ifndef _ASM_BUGS_H -#define _ASM_BUGS_H - -#include <asm/cpu.h> -#include <asm/cpu-info.h> - -extern void check_bugs (void ); - -#endif /* _ASM_BUGS_H */
arch/loongarch/kernel/setup.c +2 -2
@@ -12,6 +12,7 @@*/ #include <linux/init.h> #include <linux/acpi.h> +#include <linux/cpu.h> #include <linux/dmi.h> #include <linux/efi.h> #include <linux/export.h>
@@ -37,7 +38,6 @@#include <asm/addrspace.h> #include <asm/alternative.h> #include <asm/bootinfo.h> -#include <asm/bugs.h> #include <asm/cache.h> #include <asm/cpu.h> #include <asm/dma.h>
@@ -87,7 +87,7 @@ const char *get_system_type(void)return "generic-loongson-machine" ; } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {alternative_instructions (); }
Re: [patch 05/17] loongarch/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 9 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Huacai Chen <[email protected]>Cc WANG Xuerui <[email protected]>
Quoted 5 lines
--- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/bugs.h | 15 --------------- arch/loongarch/kernel/setup.c | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-)
PATCH 6/17 m68k/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/m68k/Kconfig | 1 + arch/m68k/include/asm/bugs.h | 21 --------------------- arch/m68k/kernel/setup_mm.c | 3 ++- 3 files changed, 3 insertions(+), 22 deletions(-)
arch/m68k/Kconfig +1 -0
@@ -4,6 +4,7 @@ config M68K default y select ARCH_32BIT_OFF_T select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
arch/m68k/include/asm/bugs.h deleted +0 -21
@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* include/asm-m68k/bugs.h -* -* Copyright (C) 1994 Linus Torvalds -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -#ifdef CONFIG_MMU -extern void check_bugs (void );/* in arch/m68k/kernel/setup.c */ -#else -static void check_bugs (void ) -{ -} -#endif
arch/m68k/kernel/setup_mm.c +2 -1
@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/cpu.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/delay.h>
@@ -504,7 +505,7 @@ static int __init proc_hardware_init(voimodule_init (proc_hardware_init);#endif -void check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {#if defined(CONFIG_FPU ) && !defined(CONFIG_M68KFPU_EMU )if (m68k_fputype ==0 ) {
Re: [patch 06/17] m68k/cpu: Switch to arch_cpu_finalize_init()
Quoted 6 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[tip: x86/boot] m68k/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 9ceecc2589b9d7cef6b321339ed8de484eac4b20 Gitweb: https://git.kernel.org/tip/9ceecc2589b9d7cef6b321339ed8de484eac4b20 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:30 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:15:59 +02:00
m68k/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/m68k/Kconfig | 1 + arch/m68k/include/asm/bugs.h | 21 --------------------- arch/m68k/kernel/setup_mm.c | 3 ++- 3 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 arch/m68k/include/asm/bugs.h
arch/m68k/Kconfig +1 -0
@@ -4,6 +4,7 @@ config M68K default y select ARCH_32BIT_OFF_T select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
arch/m68k/include/asm/bugs.h deleted +0 -21
@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* include/asm-m68k/bugs.h -* -* Copyright (C) 1994 Linus Torvalds -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -#ifdef CONFIG_MMU -extern void check_bugs (void );/* in arch/m68k/kernel/setup.c */ -#else -static void check_bugs (void ) -{ -} -#endif
arch/m68k/kernel/setup_mm.c +2 -1
@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/cpu.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/delay.h>
@@ -504,7 +505,7 @@ static int __init proc_hardware_init(void)module_init (proc_hardware_init);#endif -void check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {#if defined(CONFIG_FPU ) && !defined(CONFIG_M68KFPU_EMU )if (m68k_fputype ==0 ) {
PATCH 7/17 mips/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/bugs.h | 17 ----------------- arch/mips/kernel/setup.c | 13 +++++++++++++ 3 files changed, 14 insertions(+), 17 deletions(-)
arch/mips/Kconfig +1 -0
@@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000 select ARCH_HAS_DEBUG_VIRTUAL if !64BIT select ARCH_HAS_FORTIFY_SOURCE
arch/mips/include/asm/bugs.h +0 -17
@@ -1,17 +1,11 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* This is included by init/main.c to check for architecture-dependent bugs. -* * Copyright (C) 2007 Maciej W. Rozycki -* -* Needs: -* void check_bugs(void); */ #ifndef _ASM_BUGS_H#define _ASM_BUGS_H#include <linux/bug.h> -#include <linux/delay.h> #include <linux/smp.h> #include <asm/cpu.h>
@@ -24,17 +18,6 @@ extern void check_bugs64_early(void);extern void check_bugs32 (void );extern void check_bugs64 (void ); -static inline void __init check_bugs (void ) -{ -unsigned int cpu =smp_processor_id (); - - cpu_data[cpu].udelay_val = loops_per_jiffy; -check_bugs32 (); - -if (IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 )) -check_bugs64 (); -} -static inline int r4k_daddiu_bug (void ) {if (!IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 ))
arch/mips/kernel/setup.c +13 -0
@@ -11,6 +11,8 @@* Copyright (C) 2000, 2001, 2002, 2007 Maciej W. Rozycki */ #include <linux/init.h> +#include <linux/cpu.h> +#include <linux/delay.h> #include <linux/ioport.h> #include <linux/export.h> #include <linux/screen_info.h>
@@ -841,3 +843,14 @@ static int __init setnocoherentio(char * }early_param ("nocoherentio" , setnocoherentio);#endif + +void __init arch_cpu_finalize_init (void ) +{ +unsigned int cpu =smp_processor_id (); + + cpu_data[cpu].udelay_val = loops_per_jiffy; +check_bugs32 (); + +if (IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 )) +check_bugs64 (); +}
[tip: x86/boot] mips/cpu: Switch to arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 7f066a22fe353a827a402ee2835e81f045b1574d Gitweb: https://git.kernel.org/tip/7f066a22fe353a827a402ee2835e81f045b1574d Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:32 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
mips/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/mips/Kconfig | 1 + arch/mips/include/asm/bugs.h | 17 ----------------- arch/mips/kernel/setup.c | 13 +++++++++++++ 3 files changed, 14 insertions(+), 17 deletions(-)
arch/mips/Kconfig +1 -0
@@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000 select ARCH_HAS_DEBUG_VIRTUAL if !64BIT select ARCH_HAS_FORTIFY_SOURCE
arch/mips/include/asm/bugs.h +0 -17
@@ -1,17 +1,11 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* This is included by init/main.c to check for architecture-dependent bugs. -* * Copyright (C) 2007 Maciej W. Rozycki -* -* Needs: -* void check_bugs(void); */ #ifndef _ASM_BUGS_H#define _ASM_BUGS_H#include <linux/bug.h> -#include <linux/delay.h> #include <linux/smp.h> #include <asm/cpu.h>
@@ -24,17 +18,6 @@ extern void check_bugs64_early(void);extern void check_bugs32 (void );extern void check_bugs64 (void ); -static inline void __init check_bugs (void ) -{ -unsigned int cpu =smp_processor_id (); - - cpu_data[cpu].udelay_val = loops_per_jiffy; -check_bugs32 (); - -if (IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 )) -check_bugs64 (); -} -static inline int r4k_daddiu_bug (void ) {if (!IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 ))
arch/mips/kernel/setup.c +13 -0
@@ -11,6 +11,8 @@* Copyright (C) 2000, 2001, 2002, 2007 Maciej W. Rozycki */ #include <linux/init.h> +#include <linux/cpu.h> +#include <linux/delay.h> #include <linux/ioport.h> #include <linux/export.h> #include <linux/screen_info.h>
@@ -840,3 +842,14 @@ static int __init setnocoherentio(char *str) }early_param ("nocoherentio" , setnocoherentio);#endif + +void __init arch_cpu_finalize_init (void ) +{ +unsigned int cpu =smp_processor_id (); + + cpu_data[cpu].udelay_val = loops_per_jiffy; +check_bugs32 (); + +if (IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 )) +check_bugs64 (); +}
Re: [patch 07/17] mips/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 5 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Quoted 8 lines
Signed-off-by Thomas Gleixner <[email protected]>Cc Thomas Bogendoerfer <[email protected]>--- arch/mips/Kconfig | 1 + arch/mips/include/asm/bugs.h | 17 ----------------- arch/mips/kernel/setup.c | 13 +++++++++++++ 3 files changed, 14 insertions(+), 17 deletions(-)
PATCH 8/17 sh/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/sh/Kconfig | 1 arch/sh/include/asm/bugs.h | 74 ---------------------------------------- arch/sh/include/asm/processor.h | 2 + arch/sh/kernel/idle.c | 1 arch/sh/kernel/setup.c | 55 +++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 74 deletions(-)
arch/sh/Kconfig +1 -0
@@ -6,6 +6,7 @@ config SUPERH select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) select ARCH_HAS_BINFMT_FLAT if !MMU + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_GCOV_PROFILE_ALL
arch/sh/include/asm/bugs.h deleted +0 -74
74 lines not on this page · raw message
arch/sh/include/asm/processor.h +2 -0
@@ -166,6 +166,8 @@ extern unsigned int instruction_size(uns#define instruction_size (insn) (2)#endif +void select_idle_routine (void ); +#endif /* __ASSEMBLY__ */ #include <asm/processor_32.h>
arch/sh/kernel/idle.c +1 -0
@@ -15,6 +15,7 @@#include <linux/irqflags.h> #include <linux/smp.h> #include <linux/atomic.h> +#include <asm/processor.h> #include <asm/smp.h> #include <asm/bl_bit.h>
arch/sh/kernel/setup.c +55 -0
64 lines not on this page · raw message
[tip: x86/boot] sh/cpu: Switch to arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 01eb454e9bfe593f320ecbc9aaec60bf87cd453d Gitweb: https://git.kernel.org/tip/01eb454e9bfe593f320ecbc9aaec60bf87cd453d Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:33 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
sh/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/sh/Kconfig | 1 +- arch/sh/include/asm/bugs.h | 74 +-------------------------------- arch/sh/include/asm/processor.h | 2 +- arch/sh/kernel/idle.c | 1 +- arch/sh/kernel/setup.c | 55 ++++++++++++++++++++++++- 5 files changed, 59 insertions(+), 74 deletions(-) delete mode 100644 arch/sh/include/asm/bugs.h
arch/sh/Kconfig +1 -0
@@ -6,6 +6,7 @@ config SUPERH select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) select ARCH_HAS_BINFMT_FLAT if !MMU + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_GCOV_PROFILE_ALL
arch/sh/include/asm/bugs.h deleted +0 -74
74 lines not on this page · raw message
arch/sh/include/asm/processor.h +2 -0
@@ -166,6 +166,8 @@ extern unsigned int instruction_size(unsigned int insn);#define instruction_size (insn) (2)#endif +void select_idle_routine (void ); +#endif /* __ASSEMBLY__ */ #include <asm/processor_32.h>
arch/sh/kernel/idle.c +1 -0
@@ -15,6 +15,7 @@#include <linux/irqflags.h> #include <linux/smp.h> #include <linux/atomic.h> +#include <asm/processor.h> #include <asm/smp.h> #include <asm/bl_bit.h>
arch/sh/kernel/setup.c +55 -0
64 lines not on this page · raw message
Re: [patch 08/17] sh/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 10 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Yoshinori Sato <[email protected]>Cc Rich Felker <[email protected]>Cc John Paul Adrian Glaubitz <[email protected]>
Quoted 7 lines
--- arch/sh/Kconfig | 1 arch/sh/include/asm/bugs.h | 74 ---------------------------------------- arch/sh/include/asm/processor.h | 2 + arch/sh/kernel/idle.c | 1 arch/sh/kernel/setup.c | 55 +++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 74 deletions(-)
Re: [patch 08/17] sh/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 184 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Yoshinori Sato <[email protected]>Cc Rich Felker <[email protected]>Cc John Paul Adrian Glaubitz <[email protected]>--- arch/sh/Kconfig | 1 arch/sh/include/asm/bugs.h | 74 ---------------------------------------- arch/sh/include/asm/processor.h | 2 + arch/sh/kernel/idle.c | 1 arch/sh/kernel/setup.c | 55 +++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 74 deletions(-)arch/sh/Kconfig +1
-0@@ -6,6 +6,7 @@ config SUPERH select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) select ARCH_HAS_BINFMT_FLAT if !MMU + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_GCOV_PROFILE_ALLarch/sh/include/asm/bugs.h deleted +0
-74@@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SH_BUGS_H -#define __ASM_SH_BUGS_H - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -/* -* I don't know of any Super-H bugs yet. -*/ - -#include <asm/processor.h> - -extern void select_idle_routine (void ); - -static void __init check_bugs (void ) -{ -extern unsigned long loops_per_jiffy; -char *p = &init_utsname ()->machine[2 ];/* "sh" */ - -select_idle_routine (); - - current_cpu_data.loops_per_jiffy = loops_per_jiffy; - -switch (current_cpu_data.family) { -case CPU_FAMILY_SH2 : - *p++ ='2' ; -break ; -case CPU_FAMILY_SH2A : - *p++ ='2' ; - *p++ ='a' ; -break ; -case CPU_FAMILY_SH3 : - *p++ ='3' ; -break ; -case CPU_FAMILY_SH4 : - *p++ ='4' ; -break ; -case CPU_FAMILY_SH4A : - *p++ ='4' ; - *p++ ='a' ; -break ; -case CPU_FAMILY_SH4AL_DSP : - *p++ ='4' ; - *p++ ='a' ; - *p++ ='l' ; - *p++ ='-' ; - *p++ ='d' ; - *p++ ='s' ; - *p++ ='p' ; -break ; -case CPU_FAMILY_UNKNOWN : -/* -* Specifically use CPU_FAMILY_UNKNOWN rather than -* default:, so we're able to have the compiler whine -* about unhandled enumerations. -*/ -break ; - } - -printk ("CPU: %s\n" ,get_cpu_subtype (¤t_cpu_data)); - -#ifndef __LITTLE_ENDIAN__ -/* 'eb' means 'Endian Big' */ - *p++ ='e' ; - *p++ ='b' ; -#endif - *p ='\0' ; -} -#endif /* __ASM_SH_BUGS_H */ arch/sh/include/asm/processor.h +2
-0@@ -166,6 +166,8 @@ extern unsigned int instruction_size(uns#define instruction_size (insn) (2)#endif +void select_idle_routine (void ); +#endif /* __ASSEMBLY__ */ #include <asm/processor_32.h> arch/sh/kernel/idle.c +1
-0@@ -15,6 +15,7 @@#include <linux/irqflags.h> #include <linux/smp.h> #include <linux/atomic.h> +#include <asm/processor.h> #include <asm/smp.h> #include <asm/bl_bit.h> arch/sh/kernel/setup.c +45
-0@@ -43,6 +43,7 @@#include <asm/smp.h> #include <asm/mmu_context.h> #include <asm/mmzone.h> +#include <asm/processor.h> #include <asm/sparsemem.h> #include <asm/platform_early.h> @@ -354,3 +355,57 @@ int test_mode_pin(int pin) {return sh_mv.mv_mode_pins () & pin; } + +void __init arch_cpu_finalize_init (void ) +{ +char *p = &init_utsname ()->machine[2 ];/* "sh" */ + +select_idle_routine (); + + current_cpu_data.loops_per_jiffy = loops_per_jiffy; + +switch (current_cpu_data.family) { +case CPU_FAMILY_SH2 : + *p++ ='2' ; +break ; +case CPU_FAMILY_SH2A : + *p++ ='2' ; + *p++ ='a' ; +break ; +case CPU_FAMILY_SH3 : + *p++ ='3' ; +break ; +case CPU_FAMILY_SH4 : + *p++ ='4' ; +break ; +case CPU_FAMILY_SH4A : + *p++ ='4' ; + *p++ ='a' ; +break ; +case CPU_FAMILY_SH4AL_DSP : + *p++ ='4' ; + *p++ ='a' ; + *p++ ='l' ; + *p++ ='-' ; + *p++ ='d' ; + *p++ ='s' ; + *p++ ='p' ; +break ; +case CPU_FAMILY_UNKNOWN : +/* +* Specifically use CPU_FAMILY_UNKNOWN rather than +* default:, so we're able to have the compiler whine +* about unhandled enumerations. +*/ +break ; + }
arch/sh/kernel/setup.c int test_mode_pin(int pin) · line 411
Quoted 10 lines
arch/sh/kernel/setup.c +10
-0+ +pr_info ("CPU: %s\n" ,get_cpu_subtype (¤t_cpu_data)); + +#ifndef __LITTLE_ENDIAN__ +/* 'eb' means 'Endian Big' */ + *p++ ='e' ; + *p++ ='b' ; +#endif + *p ='\0' ; +}
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
PATCH 9/17 sparc/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/bugs.h | 18 ------------------ arch/sparc/kernel/setup_32.c | 7 +++++++ 3 files changed, 8 insertions(+), 18 deletions(-)
arch/sparc/Kconfig +1 -0
@@ -52,6 +52,7 @@ config SPARC config SPARC32 def_bool !64BIT select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_FINALIZE_INIT if !SMP select ARCH_HAS_SYNC_DMA_FOR_CPU select CLZ_TAB select DMA_DIRECT_REMAP
arch/sparc/include/asm/bugs.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include/asm/bugs.h: Sparc probes for various bugs. -* -* Copyright (C) 1996, 2007 David S. Miller ([email protected]) -*/ - -#ifdef CONFIG_SPARC32 -#include <asm/cpudata.h> -#endif - -extern unsigned long loops_per_jiffy; - -static void __init check_bugs (void ) -{ -#if defined(CONFIG_SPARC32 ) && !defined(CONFIG_SMP ) -cpu_data (0 ).udelay_val = loops_per_jiffy; -#endif -}
arch/sparc/kernel/setup_32.c +7 -0
@@ -412,3 +412,10 @@ static int __init topology_init(void) }subsys_initcall (topology_init); + +#if defined(CONFIG_SPARC32 ) && !defined(CONFIG_SMP ) +void __init arch_cpu_finalize_init (void ) +{ +cpu_data (0 ).udelay_val = loops_per_jiffy; +} +#endif
Re: [patch 09/17] sparc/cpu: Switch to arch_cpu_finalize_init()
Quoted 8 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc "David S. Miller" <[email protected]>
[tip: x86/boot] sparc/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 44ade508e3bfac45ae97864587de29eb1a881ec0 Gitweb: https://git.kernel.org/tip/44ade508e3bfac45ae97864587de29eb1a881ec0 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:35 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
sparc/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/bugs.h | 18 ------------------ arch/sparc/kernel/setup_32.c | 7 +++++++ 3 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 arch/sparc/include/asm/bugs.h
arch/sparc/Kconfig +1 -0
@@ -52,6 +52,7 @@ config SPARC config SPARC32 def_bool !64BIT select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_FINALIZE_INIT if !SMP select ARCH_HAS_SYNC_DMA_FOR_CPU select CLZ_TAB select DMA_DIRECT_REMAP
arch/sparc/include/asm/bugs.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* include/asm/bugs.h: Sparc probes for various bugs. -* -* Copyright (C) 1996, 2007 David S. Miller ([email protected]) -*/ - -#ifdef CONFIG_SPARC32 -#include <asm/cpudata.h> -#endif - -extern unsigned long loops_per_jiffy; - -static void __init check_bugs (void ) -{ -#if defined(CONFIG_SPARC32 ) && !defined(CONFIG_SMP ) -cpu_data (0 ).udelay_val = loops_per_jiffy; -#endif -}
arch/sparc/kernel/setup_32.c +7 -0
@@ -412,3 +412,10 @@ static int __init topology_init(void) }subsys_initcall (topology_init); + +#if defined(CONFIG_SPARC32 ) && !defined(CONFIG_SMP ) +void __init arch_cpu_finalize_init (void ) +{ +cpu_data (0 ).udelay_val = loops_per_jiffy; +} +#endif
Re: [patch 09/17] sparc/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 5 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Quoted 8 lines
Signed-off-by Thomas Gleixner <[email protected]>Cc "David S. Miller" <[email protected]>--- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/bugs.h | 18 ------------------ arch/sparc/kernel/setup_32.c | 7 +++++++ 3 files changed, 8 insertions(+), 18 deletions(-)
PATCH 10/17 um/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas Gleixnercheck_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/um/Kconfig | 1 + arch/um/include/asm/bugs.h | 7 ------- arch/um/kernel/um_arch.c | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-)
arch/um/Kconfig +1 -0
@@ -6,6 +6,7 @@ config UML bool default y select ARCH_EPHEMERAL_INODES + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_KCOV
arch/um/include/asm/bugs.h deleted +0 -7
@@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __UM_BUGS_H -#define __UM_BUGS_H - -void check_bugs (void ); - -#endif
arch/um/kernel/um_arch.c +2 -1
@@ -3,6 +3,7 @@* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) */ +#include <linux/cpu.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/mm.h>
@@ -430,7 +431,7 @@ void __init setup_arch(char **cmdline_p) } } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {arch_check_bugs ();os_check_bugs ();
Re: [patch 10/17] um/cpu: Switch to arch_cpu_finalize_init()
----- Ursprüngliche Mail -----
Quoted 5 lines
Von: "tglx" <[email protected]>
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Confirmed. :-)
Quoted 5 lines
Signed-off-by Thomas Gleixner <[email protected]>Cc Richard Weinberger <[email protected]>Cc Anton Ivanov <[email protected]>Cc Johannes Berg <[email protected]>
Thanks,
//richard
[tip: x86/boot] um/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 9349b5cd0908f8afe95529fc7a8cbb1417df9b0c Gitweb: https://git.kernel.org/tip/9349b5cd0908f8afe95529fc7a8cbb1417df9b0c Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:36 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
um/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation.
No functional change.
--- arch/um/Kconfig | 1 + arch/um/include/asm/bugs.h | 7 ------- arch/um/kernel/um_arch.c | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 arch/um/include/asm/bugs.h
arch/um/Kconfig +1 -0
@@ -6,6 +6,7 @@ config UML bool default y select ARCH_EPHEMERAL_INODES + select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_KCOV
arch/um/include/asm/bugs.h deleted +0 -7
@@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __UM_BUGS_H -#define __UM_BUGS_H - -void check_bugs (void ); - -#endif
arch/um/kernel/um_arch.c +2 -1
@@ -3,6 +3,7 @@* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) */ +#include <linux/cpu.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/mm.h>
@@ -430,7 +431,7 @@ void __init setup_arch(char **cmdline_p) } } -void __init check_bugs (void ) +void __init arch_cpu_finalize_init (void ) {arch_check_bugs ();os_check_bugs ();
Re: [patch 10/17] um/cpu: Switch to arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 10 lines · Thomas Gleixner
check_bugs()is about to be phased out. Switch over to the newarch_cpu_finalize_init()implementation.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Richard Weinberger <[email protected]>Cc Anton Ivanov <[email protected]>Cc Johannes Berg <[email protected]>
Quoted 5 lines
--- arch/um/Kconfig | 1 + arch/um/include/asm/bugs.h | 7 ------- arch/um/kernel/um_arch.c | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-)
PATCH 11/17 init: Remove check_bugs() leftovers
In reply to Thomas GleixnerEverything is converted over to arch_cpu_finalize_init(). Remove the check_bugs() leftovers including the empty stubs in asm-generic, alpha, parisc, powerpc and xtensa.
--- arch/alpha/include/asm/bugs.h | 20 -------------------- arch/parisc/include/asm/bugs.h | 20 -------------------- arch/powerpc/include/asm/bugs.h | 15 --------------- arch/xtensa/include/asm/bugs.h | 18 ------------------ include/asm-generic/bugs.h | 11 ----------- init/main.c | 5 ----- 6 files changed, 89 deletions(-)
arch/alpha/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* include/asm-alpha/bugs.h -* -* Copyright (C) 1994 Linus Torvalds -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -/* -* I don't know of any alpha bugs yet.. Nice chip -*/ - -static void check_bugs (void ) -{ -}
arch/parisc/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* include/asm-parisc/bugs.h -* -* Copyright (C) 1999 Mike Shaver -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -#include <asm/processor.h> - -static inline void check_bugs (void ) -{ -// identify_cpu(&boot_cpu_data); -}
arch/powerpc/include/asm/bugs.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _ASM_POWERPC_BUGS_H -#define _ASM_POWERPC_BUGS_H - -/* -*/ - -/* -* This file is included by 'init/main.c' to check for -* architecture-dependent bugs. -*/ - -static inline void check_bugs (void ) { } - -#endif /* _ASM_POWERPC_BUGS_H */
arch/xtensa/include/asm/bugs.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* -* include/asm-xtensa/bugs.h -* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Xtensa processors don't have any bugs. :) -* -* This file is subject to the terms and conditions of the GNU General -* Public License. See the file "COPYING" in the main directory of -* this archive for more details. -*/ - -#ifndef _XTENSA_BUGS_H -#define _XTENSA_BUGS_H - -static void check_bugs (void ) { } - -#endif /* _XTENSA_BUGS_H */
include/asm-generic/bugs.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_GENERIC_BUGS_H -#define __ASM_GENERIC_BUGS_H -/* -* This file is included by 'init/main.c' to check for -* architecture-dependent bugs. -*/ - -static inline void check_bugs (void ) { } - -#endif /* __ASM_GENERIC_BUGS_H */
init/main.c +0 -5
@@ -103,7 +103,6 @@#include <net/net_namespace.h> #include <asm/io.h> -#include <asm/bugs.h> #include <asm/setup.h> #include <asm/sections.h> #include <asm/cacheflush.h>
@@ -1079,10 +1078,6 @@ asmlinkage __visible void __init __no_sadelayacct_init ();arch_cpu_finalize_init (); -/* Temporary conditional until everything has been converted */ -#ifndef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT -check_bugs (); -#endif acpi_subsystem_init ();arch_post_acpi_subsys_init ();
Re: [patch 11/17] init: Remove check_bugs() leftovers
Quoted 9 lines · Thomas Gleixner
Everything is converted over to
arch_cpu_finalize_init(). Remove thecheck_bugs()leftovers including the empty stubs in asm-generic, alpha, parisc, powerpc and xtensa.Signed-off-by Thomas Gleixner<[email protected]>Cc Richard Henderson<[email protected]>Cc "James E.J. Bottomley"<[email protected]>Cc Michael Ellerman<[email protected]>Cc Chris Zankel<[email protected]>
Quoted 8 lines
--- arch/alpha/include/asm/bugs.h | 20 -------------------- arch/parisc/include/asm/bugs.h | 20 -------------------- arch/powerpc/include/asm/bugs.h | 15 --------------- arch/xtensa/include/asm/bugs.h | 18 ------------------ include/asm-generic/bugs.h | 11 ----------- init/main.c | 5 ----- 6 files changed, 89 deletions(-)
r~
[tip: x86/boot] init: Remove check_bugs() leftovers
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 61235b24b9cb37c13fcad5b9596d59a1afdcec30 Gitweb: https://git.kernel.org/tip/61235b24b9cb37c13fcad5b9596d59a1afdcec30 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:38 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
init: Remove check_bugs() leftovers
Everything is converted over to arch_cpu_finalize_init(). Remove the check_bugs() leftovers including the empty stubs in asm-generic, alpha, parisc, powerpc and xtensa.
--- arch/alpha/include/asm/bugs.h | 20 -------------------- arch/parisc/include/asm/bugs.h | 20 -------------------- arch/powerpc/include/asm/bugs.h | 15 --------------- arch/xtensa/include/asm/bugs.h | 18 ------------------ include/asm-generic/bugs.h | 11 ----------- init/main.c | 5 ----- 6 files changed, 89 deletions(-) delete mode 100644 arch/alpha/include/asm/bugs.h delete mode 100644 arch/parisc/include/asm/bugs.h delete mode 100644 arch/powerpc/include/asm/bugs.h delete mode 100644 arch/xtensa/include/asm/bugs.h delete mode 100644 include/asm-generic/bugs.h
arch/alpha/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* include/asm-alpha/bugs.h -* -* Copyright (C) 1994 Linus Torvalds -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -/* -* I don't know of any alpha bugs yet.. Nice chip -*/ - -static void check_bugs (void ) -{ -}
arch/parisc/include/asm/bugs.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* include/asm-parisc/bugs.h -* -* Copyright (C) 1999 Mike Shaver -*/ - -/* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Needs: -* void check_bugs(void); -*/ - -#include <asm/processor.h> - -static inline void check_bugs (void ) -{ -// identify_cpu(&boot_cpu_data); -}
arch/powerpc/include/asm/bugs.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _ASM_POWERPC_BUGS_H -#define _ASM_POWERPC_BUGS_H - -/* -*/ - -/* -* This file is included by 'init/main.c' to check for -* architecture-dependent bugs. -*/ - -static inline void check_bugs (void ) { } - -#endif /* _ASM_POWERPC_BUGS_H */
arch/xtensa/include/asm/bugs.h deleted +0 -18
@@ -1,18 +0,0 @@ -/* -* include/asm-xtensa/bugs.h -* -* This is included by init/main.c to check for architecture-dependent bugs. -* -* Xtensa processors don't have any bugs. :) -* -* This file is subject to the terms and conditions of the GNU General -* Public License. See the file "COPYING" in the main directory of -* this archive for more details. -*/ - -#ifndef _XTENSA_BUGS_H -#define _XTENSA_BUGS_H - -static void check_bugs (void ) { } - -#endif /* _XTENSA_BUGS_H */
include/asm-generic/bugs.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_GENERIC_BUGS_H -#define __ASM_GENERIC_BUGS_H -/* -* This file is included by 'init/main.c' to check for -* architecture-dependent bugs. -*/ - -static inline void check_bugs (void ) { } - -#endif /* __ASM_GENERIC_BUGS_H */
init/main.c +0 -5
@@ -103,7 +103,6 @@#include <net/net_namespace.h> #include <asm/io.h> -#include <asm/bugs.h> #include <asm/setup.h> #include <asm/sections.h> #include <asm/cacheflush.h>
@@ -1079,10 +1078,6 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(vdelayacct_init ();arch_cpu_finalize_init (); -/* Temporary conditional until everything has been converted */ -#ifndef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT -check_bugs (); -#endif acpi_subsystem_init ();arch_post_acpi_subsys_init ();
Re: [patch 11/17] init: Remove check_bugs() leftovers
In reply to Thomas GleixnerQuoted 9 lines · Thomas Gleixner
Everything is converted over to
arch_cpu_finalize_init(). Remove thecheck_bugs()leftovers including the empty stubs in asm-generic, alpha, parisc, powerpc and xtensa.Signed-off-by Thomas Gleixner <[email protected]>Cc Richard Henderson <[email protected]>Cc "James E.J. Bottomley" <[email protected]>Cc Michael Ellerman <[email protected]>Cc Chris Zankel <[email protected]>
Quoted 8 lines
--- arch/alpha/include/asm/bugs.h | 20 -------------------- arch/parisc/include/asm/bugs.h | 20 -------------------- arch/powerpc/include/asm/bugs.h | 15 --------------- arch/xtensa/include/asm/bugs.h | 18 ------------------ include/asm-generic/bugs.h | 11 ----------- init/main.c | 5 ----- 6 files changed, 89 deletions(-)
Yay!
PATCH 12/17 init: Invoke arch_cpu_finalize_init() earlier
In reply to Thomas GleixnerX86 is reworking the boot process so that initializations which are not required during early boot can be moved into the late boot process and out of the fragile and restricted initial boot phase.
arch_cpu_finalize_init() is the obvious place to do such initializations, but arch_cpu_finalize_init() is invoked too late in start_kernel() e.g. for initializing the FPU completely. fork_init() requires that the FPU is initialized as the size of task_struct on X86 depends on the size of the required FPU register buffer.
Fortunately none of the init calls between calibrate_delay() and arch_cpu_finalize_init() is relevant for the functionality of arch_cpu_finalize_init().
Invoke it right after calibrate_delay() where everything which is relevant for arch_cpu_finalize_init() has been set up already.
No functional change intended.
--- init/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
init/main.c +2 -2
@@ -1041,6 +1041,8 @@ asmlinkage __visible void __init __no_sasched_clock_init ();calibrate_delay (); +arch_cpu_finalize_init (); +/* * This needs to be called before any devices perform DMA * operations that might use the SWIOTLB bounce buffers. It will
@@ -1077,8 +1079,6 @@ asmlinkage __visible void __init __no_sataskstats_init_early ();delayacct_init (); -arch_cpu_finalize_init (); -acpi_subsystem_init ();arch_post_acpi_subsys_init ();kcsan_init ();
Re: [patch 12/17] init: Invoke arch_cpu_finalize_init() earlier
Quoted 4 lines · Thomas Gleixner
Fortunately none of the init calls between
calibrate_delay()andarch_cpu_finalize_init()is relevant for the functionality ofarch_cpu_finalize_init().
I did my best to find a counterpoint to this statement. The only thing I found was that lockdep_init_task(&init_task) in fork_init() is now called after the spin_lock() usage in set_memory_4k(). But AFAICT, that whole lockdep_init_task() call is unneeded because the fields it sets are already statically initialized. I mention only because I'm not 100% sure the lockdep_init_task() call is not serving some purpose I'm missing.
Re: [patch 12/17] init: Invoke arch_cpu_finalize_init() earlier
Quoted 6 lines · Rick P. Edgecombe
Quoted 4 lines · Thomas Gleixner
Fortunately none of the init calls between
calibrate_delay()andarch_cpu_finalize_init()is relevant for the functionality ofarch_cpu_finalize_init().
Quoted 8 lines
Reviewed-by Rick Edgecombe <[email protected]>I did my best to find a counterpoint to this statement. The only thing I found was that
lockdep_init_task(&init_task)infork_init()is now called after thespin_lock()usage inset_memory_4k().But AFAICT, that whole
lockdep_init_task()call is unneeded because the fields it sets are already statically initialized.
Correct. The call there looks absolute pointless. Peter?
[tip: x86/boot] init: Invoke arch_cpu_finalize_init() earlier
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 9df9d2f0471b4c4702670380b8d8a45b40b23a7d Gitweb: https://git.kernel.org/tip/9df9d2f0471b4c4702670380b8d8a45b40b23a7d Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:39 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
init: Invoke arch_cpu_finalize_init() earlier
X86 is reworking the boot process so that initializations which are not required during early boot can be moved into the late boot process and out of the fragile and restricted initial boot phase.
arch_cpu_finalize_init() is the obvious place to do such initializations, but arch_cpu_finalize_init() is invoked too late in start_kernel() e.g. for initializing the FPU completely. fork_init() requires that the FPU is initialized as the size of task_struct on X86 depends on the size of the required FPU register buffer.
Fortunately none of the init calls between calibrate_delay() and arch_cpu_finalize_init() is relevant for the functionality of arch_cpu_finalize_init().
Invoke it right after calibrate_delay() where everything which is relevant for arch_cpu_finalize_init() has been set up already.
No functional change intended.
--- init/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
init/main.c +2 -2
@@ -1041,6 +1041,8 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(vsched_clock_init ();calibrate_delay (); +arch_cpu_finalize_init (); +/* * This needs to be called before any devices perform DMA * operations that might use the SWIOTLB bounce buffers. It will
@@ -1077,8 +1079,6 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(vtaskstats_init_early ();delayacct_init (); -arch_cpu_finalize_init (); -acpi_subsystem_init ();arch_post_acpi_subsys_init ();kcsan_init ();
PATCH 13/17 init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
In reply to Thomas GleixnerInvoke the X86ism mem_encrypt_init() from X86 arch_cpu_finalize_init() and remove the weak fallback from the core code.
No functional change.
--- arch/x86/include/asm/mem_encrypt.h | 7 ++++--- arch/x86/kernel/cpu/common.c | 11 +++++++++++ init/main.c | 13 ------------- 3 files changed, 15 insertions(+), 16 deletions(-)
arch/x86/include/asm/mem_encrypt.h +4 -3
@@ -51,6 +51,8 @@ void __init mem_encrypt_free_decrypted_mvoid __init sev_es_init_vc_handling (void ); +void __init mem_encrypt_init (void ); +#define __bss_decrypted __section(".bss..decrypted")#else /* !CONFIG_AMD_MEM_ENCRYPT */
@@ -83,13 +85,12 @@ early_set_mem_enc_dec_hypercall(unsignedstatic inline void mem_encrypt_free_decrypted_mem (void ) { } +static inline void mem_encrypt_init (void ) { } +#define __bss_decrypted#endif /* CONFIG_AMD_MEM_ENCRYPT */ -/* Architecture __weak replacement functions */ -void __init mem_encrypt_init (void ); -void add_encrypt_protection_map (void );/*
arch/x86/kernel/cpu/common.c +11 -0
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/kprobes.h> #include <linux/kgdb.h> +#include <linux/mem_encrypt.h> #include <linux/smp.h> #include <linux/cpu.h> #include <linux/io.h>
@@ -2417,4 +2418,14 @@ void __init arch_cpu_finalize_init(void) }else {fpu__init_check_bugs (); } + +/* +* This needs to be called before any devices perform DMA +* operations that might use the SWIOTLB bounce buffers. It will +* mark the bounce buffers as decrypted so that their usage will +* not cause "plain-text" data to be decrypted when accessed. It +* must be called after late_time_init() so that Hyper-V x86/x64 +* hypercalls work when the SWIOTLB bounce buffers are decrypted. +*/ +mem_encrypt_init (); }
init/main.c +0 -13
@@ -95,7 +95,6 @@#include <linux/cache.h> #include <linux/rodata_test.h> #include <linux/jump_label.h> -#include <linux/mem_encrypt.h> #include <linux/kcsan.h> #include <linux/init_syscalls.h> #include <linux/stackdepot.h>
@@ -786,8 +785,6 @@ void __init __weak thread_stack_cache_in }#endif -void __init __weak mem_encrypt_init (void ) { } -void __init __weak poking_init (void ) { }void __init __weak pgtable_cache_init (void ) { }
@@ -1043,16 +1040,6 @@ asmlinkage __visible void __init __no_saarch_cpu_finalize_init (); -/* -* This needs to be called before any devices perform DMA -* operations that might use the SWIOTLB bounce buffers. It will -* mark the bounce buffers as decrypted so that their usage will -* not cause "plain-text" data to be decrypted when accessed. It -* must be called after late_time_init() so that Hyper-V x86/x64 -* hypercalls work when the SWIOTLB bounce buffers are decrypted. -*/ -mem_encrypt_init (); -pid_idr_init ();anon_vma_init ();#ifdef CONFIG_X86
[tip: x86/boot] init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 439e17576eb47f26b78c5bbc72e344d4206d2327 Gitweb: https://git.kernel.org/tip/439e17576eb47f26b78c5bbc72e344d4206d2327 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:41 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
Invoke the X86ism mem_encrypt_init() from X86 arch_cpu_finalize_init() and remove the weak fallback from the core code.
No functional change.
--- arch/x86/include/asm/mem_encrypt.h | 7 ++++--- arch/x86/kernel/cpu/common.c | 11 +++++++++++ init/main.c | 13 ------------- 3 files changed, 15 insertions(+), 16 deletions(-)
arch/x86/include/asm/mem_encrypt.h +4 -3
@@ -51,6 +51,8 @@ void __init mem_encrypt_free_decrypted_mem(void);void __init sev_es_init_vc_handling (void ); +void __init mem_encrypt_init (void ); +#define __bss_decrypted __section(".bss..decrypted")#else /* !CONFIG_AMD_MEM_ENCRYPT */
@@ -83,13 +85,12 @@ early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, bool enc) {}static inline void mem_encrypt_free_decrypted_mem (void ) { } +static inline void mem_encrypt_init (void ) { } +#define __bss_decrypted#endif /* CONFIG_AMD_MEM_ENCRYPT */ -/* Architecture __weak replacement functions */ -void __init mem_encrypt_init (void ); -void add_encrypt_protection_map (void );/*
arch/x86/kernel/cpu/common.c +11 -0
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/kprobes.h> #include <linux/kgdb.h> +#include <linux/mem_encrypt.h> #include <linux/smp.h> #include <linux/cpu.h> #include <linux/io.h>
@@ -2414,4 +2415,14 @@ void __init arch_cpu_finalize_init(void) }else {fpu__init_check_bugs (); } + +/* +* This needs to be called before any devices perform DMA +* operations that might use the SWIOTLB bounce buffers. It will +* mark the bounce buffers as decrypted so that their usage will +* not cause "plain-text" data to be decrypted when accessed. It +* must be called after late_time_init() so that Hyper-V x86/x64 +* hypercalls work when the SWIOTLB bounce buffers are decrypted. +*/ +mem_encrypt_init (); }
init/main.c +0 -13
@@ -95,7 +95,6 @@#include <linux/cache.h> #include <linux/rodata_test.h> #include <linux/jump_label.h> -#include <linux/mem_encrypt.h> #include <linux/kcsan.h> #include <linux/init_syscalls.h> #include <linux/stackdepot.h>
@@ -786,8 +785,6 @@ void __init __weak thread_stack_cache_init(void) }#endif -void __init __weak mem_encrypt_init (void ) { } -void __init __weak poking_init (void ) { }void __init __weak pgtable_cache_init (void ) { }
@@ -1043,16 +1040,6 @@ asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(varch_cpu_finalize_init (); -/* -* This needs to be called before any devices perform DMA -* operations that might use the SWIOTLB bounce buffers. It will -* mark the bounce buffers as decrypted so that their usage will -* not cause "plain-text" data to be decrypted when accessed. It -* must be called after late_time_init() so that Hyper-V x86/x64 -* hypercalls work when the SWIOTLB bounce buffers are decrypted. -*/ -mem_encrypt_init (); -pid_idr_init ();anon_vma_init ();#ifdef CONFIG_X86
Re: [patch 13/17] init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
In reply to Thomas GleixnerQuoted 7 lines · Thomas Gleixner
Invoke the X86ism
mem_encrypt_init()from X86arch_cpu_finalize_init()and remove the weak fallback from the core code.No functional change.
Signed-off-by Thomas Gleixner <[email protected]>Cc Tom Lendacky <[email protected]>
Quoted 6 lines
--- arch/x86/include/asm/mem_encrypt.h | 7 ++++--- arch/x86/kernel/cpu/common.c | 11 +++++++++++ init/main.c | 13 ------------- 3 files changed, 15 insertions(+), 16 deletions(-)
PATCH 14/17 x86/init: Initialize signal frame size late
In reply to Thomas GleixnerNo point in doing this during really early boot. Move it to an early initcall so that it is set up before possible user mode helpers are started during device initialization.
--- arch/x86/include/asm/sigframe.h | 2 -- arch/x86/kernel/cpu/common.c | 3 --- arch/x86/kernel/signal.c | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/include/asm/sigframe.h +0 -2
@@ -85,6 +85,4 @@ struct rt_sigframe_x32 {#endif /* CONFIG_X86_64 */ -void __init init_sigframe_size (void ); -#endif /* _ASM_X86_SIGFRAME_H */
arch/x86/kernel/cpu/common.c +0 -3
@@ -64,7 +64,6 @@#include <asm/cpu_device_id.h> #include <asm/uv/uv.h> #include <asm/set_memory.h> -#include <asm/sigframe.h> #include <asm/traps.h> #include <asm/sev.h>
@@ -1607,8 +1606,6 @@ static void __init early_identify_cpu(stfpu__init_system (c); -init_sigframe_size (); -#ifdef CONFIG_X86_32 /* * Regardless of whether PCID is enumerated, the SDM says
arch/x86/kernel/signal.c +3 -1
@@ -182,7 +182,7 @@ get_sigframe(struct ksignal *ksig, strucstatic unsigned long __ro_after_init max_frame_size;static unsigned int __ro_after_init fpu_default_state_size; -void __init init_sigframe_size (void ) +static int __init init_sigframe_size (void ) { fpu_default_state_size =fpu__get_fpstate_size ();
@@ -194,7 +194,9 @@ void __init init_sigframe_size(void) max_frame_size =round_up (max_frame_size,FRAME_ALIGNMENT );pr_info ("max sigframe size: %lu\n" , max_frame_size); +return 0 ; } +early_initcall (init_sigframe_size);unsigned long get_sigframe_size (void ) {
[tip: x86/boot] x86/init: Initialize signal frame size late
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 54d9a91a3d6713d1332e93be13b4eaf0fa54349d Gitweb: https://git.kernel.org/tip/54d9a91a3d6713d1332e93be13b4eaf0fa54349d Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:42 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:00 +02:00
x86/init: Initialize signal frame size late
No point in doing this during really early boot. Move it to an early initcall so that it is set up before possible user mode helpers are started during device initialization.
--- arch/x86/include/asm/sigframe.h | 2 -- arch/x86/kernel/cpu/common.c | 3 --- arch/x86/kernel/signal.c | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/include/asm/sigframe.h +0 -2
@@ -85,6 +85,4 @@ struct rt_sigframe_x32 {#endif /* CONFIG_X86_64 */ -void __init init_sigframe_size (void ); -#endif /* _ASM_X86_SIGFRAME_H */
arch/x86/kernel/cpu/common.c +0 -3
@@ -64,7 +64,6 @@#include <asm/cpu_device_id.h> #include <asm/uv/uv.h> #include <asm/set_memory.h> -#include <asm/sigframe.h> #include <asm/traps.h> #include <asm/sev.h>
@@ -1607,8 +1606,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)fpu__init_system (c); -init_sigframe_size (); -#ifdef CONFIG_X86_32 /* * Regardless of whether PCID is enumerated, the SDM says
arch/x86/kernel/signal.c +3 -1
@@ -182,7 +182,7 @@ get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size,static unsigned long __ro_after_init max_frame_size;static unsigned int __ro_after_init fpu_default_state_size; -void __init init_sigframe_size (void ) +static int __init init_sigframe_size (void ) { fpu_default_state_size =fpu__get_fpstate_size ();
@@ -194,7 +194,9 @@ void __init init_sigframe_size(void) max_frame_size =round_up (max_frame_size,FRAME_ALIGNMENT );pr_info ("max sigframe size: %lu\n" , max_frame_size); +return 0 ; } +early_initcall (init_sigframe_size);unsigned long get_sigframe_size (void ) {
PATCH 15/17 x86/fpu: Remove cpuinfo argument from init functions
In reply to Thomas GleixnerNothing in the call chain requires it
--- arch/x86/include/asm/fpu/api.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/fpu/init.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/asm/fpu/api.h +1 -1
@@ -109,7 +109,7 @@ extern void fpu_reset_from_exception_fix/* Boot, hotplug and resume */ extern void fpu__init_cpu (void ); -extern void fpu__init_system (struct cpuinfo_x86 *c); +extern void fpu__init_system (void );extern void fpu__init_check_bugs (void );extern void fpu__resume_cpu (void );
arch/x86/kernel/cpu/common.c +1 -1
@@ -1604,7 +1604,7 @@ static void __init early_identify_cpu(stsld_setup (c); -fpu__init_system (c); +fpu__init_system ();#ifdef CONFIG_X86_32 /*
arch/x86/kernel/fpu/init.c +3 -3
@@ -71,7 +71,7 @@ static bool fpu__probe_without_cpuid(voireturn fsw ==0 && (fcw &0x103f ) ==0x003f ; } -static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +static void fpu__init_system_early_generic (void ) {if (!boot_cpu_has (X86_FEATURE_CPUID ) && !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) {
@@ -211,10 +211,10 @@ static void __init fpu__init_system_xsta* Called on the boot CPU once per system bootup, to set up the initial * FPU state that is later cloned into all processes: */ -void __init fpu__init_system (struct cpuinfo_x86 *c) +void __init fpu__init_system (void ) {fpstate_reset (¤t->thread.fpu); -fpu__init_system_early_generic (c); +fpu__init_system_early_generic ();/* * The FPU has to be operational for some of the
[tip: x86/boot] x86/fpu: Remove cpuinfo argument from init functions
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 1f34bb2a24643e0087652d81078e4f616562738d Gitweb: https://git.kernel.org/tip/1f34bb2a24643e0087652d81078e4f616562738d Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:43 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:01 +02:00
x86/fpu: Remove cpuinfo argument from init functions
Nothing in the call chain requires it
--- arch/x86/include/asm/fpu/api.h | 2 +- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/fpu/init.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/asm/fpu/api.h +1 -1
@@ -109,7 +109,7 @@ extern void fpu_reset_from_exception_fixup(void);/* Boot, hotplug and resume */ extern void fpu__init_cpu (void ); -extern void fpu__init_system (struct cpuinfo_x86 *c); +extern void fpu__init_system (void );extern void fpu__init_check_bugs (void );extern void fpu__resume_cpu (void );
arch/x86/kernel/cpu/common.c +1 -1
@@ -1604,7 +1604,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)sld_setup (c); -fpu__init_system (c); +fpu__init_system ();#ifdef CONFIG_X86_32 /*
arch/x86/kernel/fpu/init.c +3 -3
@@ -71,7 +71,7 @@ static bool fpu__probe_without_cpuid(void)return fsw ==0 && (fcw &0x103f ) ==0x003f ; } -static void fpu__init_system_early_generic (struct cpuinfo_x86 *c) +static void fpu__init_system_early_generic (void ) {if (!boot_cpu_has (X86_FEATURE_CPUID ) && !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) {
@@ -211,10 +211,10 @@ static void __init fpu__init_system_xstate_size_legacy(void)* Called on the boot CPU once per system bootup, to set up the initial * FPU state that is later cloned into all processes: */ -void __init fpu__init_system (struct cpuinfo_x86 *c) +void __init fpu__init_system (void ) {fpstate_reset (¤t->thread.fpu); -fpu__init_system_early_generic (c); +fpu__init_system_early_generic ();/* * The FPU has to be operational for some of the
PATCH 16/17 x86/fpu: Mark init functions __init
In reply to Thomas GleixnerNo point in keeping them around.
--- arch/x86/kernel/fpu/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/fpu/init.c +2 -2
@@ -53,7 +53,7 @@ void fpu__init_cpu(void)fpu__init_cpu_xstate (); } -static bool fpu__probe_without_cpuid (void ) +static bool __init fpu__probe_without_cpuid (void ) {unsigned long cr0;u16 fsw, fcw;
@@ -71,7 +71,7 @@ static bool fpu__probe_without_cpuid(voireturn fsw ==0 && (fcw &0x103f ) ==0x003f ; } -static void fpu__init_system_early_generic (void ) +static void __init fpu__init_system_early_generic (void ) {if (!boot_cpu_has (X86_FEATURE_CPUID ) && !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) {
[tip: x86/boot] x86/fpu: Mark init functions __init
The following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: 1703db2b90c91b2eb2d699519fc505fe431dde0e Gitweb: https://git.kernel.org/tip/1703db2b90c91b2eb2d699519fc505fe431dde0e Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:01 +02:00
x86/fpu: Mark init functions __init
No point in keeping them around.
--- arch/x86/kernel/fpu/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/fpu/init.c +2 -2
@@ -53,7 +53,7 @@ void fpu__init_cpu(void)fpu__init_cpu_xstate (); } -static bool fpu__probe_without_cpuid (void ) +static bool __init fpu__probe_without_cpuid (void ) {unsigned long cr0;u16 fsw, fcw;
@@ -71,7 +71,7 @@ static bool fpu__probe_without_cpuid(void)return fsw ==0 && (fcw &0x103f ) ==0x003f ; } -static void fpu__init_system_early_generic (void ) +static void __init fpu__init_system_early_generic (void ) {if (!boot_cpu_has (X86_FEATURE_CPUID ) && !test_bit (X86_FEATURE_FPU , (unsigned long *)cpu_caps_cleared)) {
PATCH 17/17 x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
In reply to Thomas GleixnerInitializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before fork_init() because the task_struct size depends on the FPU register buffer size.
Move the initialization to arch_cpu_finalize_init() which is the perfect place to do so.
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
--- arch/x86/kernel/cpu/common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +8 -4
@@ -1604,8 +1604,6 @@ static void __init early_identify_cpu(stsld_setup (c); -fpu__init_system (); -#ifdef CONFIG_X86_32 /* * Regardless of whether PCID is enumerated, the SDM says
@@ -2287,8 +2285,6 @@ void cpu_init(void)doublefault_init_cpu_tss (); -fpu__init_cpu (); -if (is_uv_system ())uv_cpu_init ();
@@ -2304,6 +2300,7 @@ void cpu_init_secondary(void)*/ cpu_init_exception_handling ();cpu_init (); + fpu__init_cpu(); }#endif
@@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void)'0' + (boot_cpu_data.x86 >6 ?6 : boot_cpu_data.x86); } +/* +* Must be before alternatives because it might set or clear +* feature bits. +*/ +fpu__init_system (); +fpu__init_cpu (); +alternative_instructions ();if (IS_ENABLED (CONFIG_X86_64 )) {
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
arch/x86/kernel/cpu/common.c void __init arch_cpu_finalize_init(void) · line 2401
Quoted 11 lines · Thomas Gleixner
arch/x86/kernel/cpu/common.c +6
-0@@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void)'0' + (boot_cpu_data.x86 >6 ?6 : boot_cpu_data.x86); } +/* +* Must be before alternatives because it might set or clear +* feature bits. +*/ +fpu__init_system (); +fpu__init_cpu ();
fpu__init_cpu() appears to be duplicated here because fpu__init_system() invoked this already:
void __init fpu__init_system(void)
{
...
/* * The FPU has to be operational for some of the * later FPU init activities: */ fpu__init_cpu();
...
}
Thanks,
Chang
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Quoted 16 lines · Chang S. Bae
arch/x86/kernel/cpu/common.c void __init arch_cpu_finalize_init(void) · line 2401
Quoted 11 lines · Thomas Gleixner
arch/x86/kernel/cpu/common.c +6
-0@@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void)'0' + (boot_cpu_data.x86 >6 ?6 : boot_cpu_data.x86); } +/* +* Must be before alternatives because it might set or clear +* feature bits. +*/ +fpu__init_system (); +fpu__init_cpu ();
fpu__init_cpu()appears to be duplicated here becausefpu__init_system()invoked this already:
Quoted 8 lines
void
__initfpu__init_system(void)
{
.../* * The FPU has to be operational for some of the * later FPU init activities: */ fpu__init_cpu();
Well, that's _before_ xstate initialization and I couldn't convince myself that it's good enough. All of this is such a horrible mess...
[tip: x86/boot] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
In reply to Thomas GleixnerThe following commit has been merged into the x86/boot branch of tip:
The following commit has been merged into the x86/boot branch of tip:
Commit-ID: b81fac906a8f9e682e513ddd95697ec7a20878d4 Gitweb: https://git.kernel.org/tip/b81fac906a8f9e682e513ddd95697ec7a20878d4 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 14 Jun 2023 01:39:46 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Fri, 16 Jun 2023 10:16:01 +02:00
x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before fork_init() because the task_struct size depends on the FPU register buffer size.
Move the initialization to arch_cpu_finalize_init() which is the perfect place to do so.
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
--- arch/x86/kernel/cpu/common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +8 -4
@@ -1604,8 +1604,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)sld_setup (c); -fpu__init_system (); -#ifdef CONFIG_X86_32 /* * Regardless of whether PCID is enumerated, the SDM says
@@ -2287,8 +2285,6 @@ void cpu_init(void)doublefault_init_cpu_tss (); -fpu__init_cpu (); -if (is_uv_system ())uv_cpu_init ();
@@ -2304,6 +2300,7 @@ void cpu_init_secondary(void)*/ cpu_init_exception_handling ();cpu_init (); + fpu__init_cpu(); }#endif
@@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void)'0' + (boot_cpu_data.x86 >6 ?6 : boot_cpu_data.x86); } +/* +* Must be before alternatives because it might set or clear +* feature bits. +*/ +fpu__init_system (); +fpu__init_cpu (); +alternative_instructions ();if (IS_ENABLED (CONFIG_X86_64 )) {
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
In reply to Thomas GleixnerHi,
Quoted 10 lines · Thomas Gleixner
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before
fork_init()because thetask_structsize depends on the FPU register buffer size.Move the initialization to
arch_cpu_finalize_init()which is the perfect place to do so.
Quoted 6 lines
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
Signed-off-by Thomas Gleixner <[email protected]>
The backport of this patch into chromeos-5.10 and chromeos-5.15 via stable relase merges is causing various Chromebooks (not all of them) to crash early during boot. Subsequent fixes have not addressed the problem for us, so we already reverted the patch from chromeos-5.15 and will revert it from chromeos-5.10 as well.
I don't know if this is a Chromebook specific problem, or if it affects mainline, so this is just a heads-up in case others experience similar problems.
Thanks,
Guenter
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Quoted 26 lines · Guenter Roeck
Hi,
Quoted 10 lines · Thomas Gleixner
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before
fork_init()because thetask_structsize depends on the FPU register buffer size.Move the initialization to
arch_cpu_finalize_init()which is the perfect place to do so.Quoted 6 lines
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
Signed-off-by Thomas Gleixner <[email protected]>The backport of this patch into chromeos-5.10 and chromeos-5.15 via stable relase merges is causing various Chromebooks (not all of them) to crash early during boot. Subsequent fixes have not addressed the problem for us, so we already reverted the patch from chromeos-5.15 and will revert it from chromeos-5.10 as well.
Quoted 3 lines
I don't know if this is a Chromebook specific problem, or if it affects mainline, so this is just a heads-up in case others experience similar problems.
Looking at 5.15 the following prerequisites are likely missing:
af8060279968 ("mm: Move mm_cachep initialization to mm_init()") 5b93a83649c7 ("x86/mm: Initialize text poking earlier")
Can you test with those patches backported to 5.15.y and see if it works?
Quoted 3 lines
Thanks,
Guenter
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Quoted 34 lines · Nikolay Borisov
Quoted 26 lines · Guenter Roeck
Hi,
Quoted 10 lines · Thomas Gleixner
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before
fork_init()because thetask_structsize depends on the FPU register buffer size.Move the initialization to
arch_cpu_finalize_init()which is the perfect place to do so.Quoted 6 lines
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
Signed-off-by Thomas Gleixner <[email protected]>The backport of this patch into chromeos-5.10 and chromeos-5.15 via stable relase merges is causing various Chromebooks (not all of them) to crash early during boot. Subsequent fixes have not addressed the problem for us, so we already reverted the patch from chromeos-5.15 and will revert it from chromeos-5.10 as well.
Quoted 3 lines
I don't know if this is a Chromebook specific problem, or if it affects mainline, so this is just a heads-up in case others experience similar problems.
Quoted 7 lines
Looking at 5.15 the following prerequisites are likely missing:
af8060279968("mm: Movemm_cachepinitialization tomm_init()")5b93a83649c7("x86/mm: Initialize text poking earlier")Can you test with those patches backported to 5.15.y and see if it works?
Both patches are already in v5.10.y and 5.15.y, so unfortunately that doesn't help.
Guenter
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
In reply to Guenter RoeckQuoted 26 lines · Guenter Roeck
Hi,
Quoted 10 lines · Thomas Gleixner
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before
fork_init()because thetask_structsize depends on the FPU register buffer size.Move the initialization to
arch_cpu_finalize_init()which is the perfect place to do so.Quoted 6 lines
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
Signed-off-by Thomas Gleixner <[email protected]>The backport of this patch into chromeos-5.10 and chromeos-5.15 via stable relase merges is causing various Chromebooks (not all of them) to crash early during boot. Subsequent fixes have not addressed the problem for us, so we already reverted the patch from chromeos-5.15 and will revert it from chromeos-5.10 as well.
Quoted 3 lines
I don't know if this is a Chromebook specific problem, or if it affects mainline, so this is just a heads-up in case others experience similar problems.
Another thing - if you choose to revert the arch_finalize patch then bear in mind that the GDS' 'force' option is rendered inoperable as the FPU can't be disabled due to the way things are sequenced.
Quoted 3 lines
Thanks,
Guenter
Re: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
Quoted 29 lines · Nikolay Borisov
Quoted 26 lines · Guenter Roeck
Hi,
Quoted 10 lines · Thomas Gleixner
Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough.
Nothing requires that the FPU is set up early. It has to be initialized before
fork_init()because thetask_structsize depends on the FPU register buffer size.Move the initialization to
arch_cpu_finalize_init()which is the perfect place to do so.Quoted 6 lines
No functional change.
This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment.
Signed-off-by Thomas Gleixner <[email protected]>The backport of this patch into chromeos-5.10 and chromeos-5.15 via stable relase merges is causing various Chromebooks (not all of them) to crash early during boot. Subsequent fixes have not addressed the problem for us, so we already reverted the patch from chromeos-5.15 and will revert it from chromeos-5.10 as well.
Quoted 8 lines
Quoted 3 lines
I don't know if this is a Chromebook specific problem, or if it affects mainline, so this is just a heads-up in case others experience similar problems.
Another thing - if you choose to revert the
arch_finalizepatch then bear in mind that the GDS' 'force' option is rendered inoperable as the FPU can't be disabled due to the way things are sequenced.
I understand, but that is still better than not being able to boot in the first place.
Thanks,
Guenter
Quoted 5 lines · Thomas Gleixner
Hi!
My team and myself are working on sanitizing the x86 boot process, especially the complete horror show of CPUID evaluation, which is constructed with hay-wire circuits, duct tape and superglue.
What's with Intel and its glue analogies? Not to mention it stuck very well, if I may say so myself (not to mention the glue in the co struction of the 12th Intel series).