Skip to content

Commit 7cffdbe

Browse files
committed
Merge tag 'x86-boot-2023-06-26' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 boot updates from Thomas Gleixner: "Initialize FPU late. Right now FPU is initialized very early during boot. There is no real requirement to do so. The only requirement is to have it done before alternatives are patched. That's done in check_bugs() which does way more than what the function name suggests. So first rename check_bugs() to arch_cpu_finalize_init() which makes it clear what this is about. Move the invocation of arch_cpu_finalize_init() earlier in start_kernel() as it has to be done before fork_init() which needs to know the FPU register buffer size. With those prerequisites the FPU initialization can be moved into arch_cpu_finalize_init(), which removes it from the early and fragile part of the x86 bringup" * tag 'x86-boot-2023-06-26' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mem_encrypt: Unbreak the AMD_MEM_ENCRYPT=n build x86/fpu: Move FPU initialization into arch_cpu_finalize_init() x86/fpu: Mark init functions __init x86/fpu: Remove cpuinfo argument from init functions x86/init: Initialize signal frame size late init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init() init: Invoke arch_cpu_finalize_init() earlier init: Remove check_bugs() leftovers um/cpu: Switch to arch_cpu_finalize_init() sparc/cpu: Switch to arch_cpu_finalize_init() sh/cpu: Switch to arch_cpu_finalize_init() mips/cpu: Switch to arch_cpu_finalize_init() m68k/cpu: Switch to arch_cpu_finalize_init() loongarch/cpu: Switch to arch_cpu_finalize_init() ia64/cpu: Switch to arch_cpu_finalize_init() ARM: cpu: Switch to arch_cpu_finalize_init() x86/cpu: Switch to arch_cpu_finalize_init() init: Provide arch_cpu_finalize_init()
2 parents 0017387 + 0a9567a commit 7cffdbe

File tree

44 files changed

+194
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+194
-352
lines changed

arch/Kconfig

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

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

arch/alpha/include/asm/bugs.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config ARM
55
select ARCH_32BIT_OFF_T
66
select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND
77
select ARCH_HAS_BINFMT_FLAT
8+
select ARCH_HAS_CPU_FINALIZE_INIT if MMU
89
select ARCH_HAS_CURRENT_STACK_POINTER
910
select ARCH_HAS_DEBUG_VIRTUAL if MMU
1011
select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE

arch/arm/include/asm/bugs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
3-
* arch/arm/include/asm/bugs.h
4-
*
53
* Copyright (C) 1995-2003 Russell King
64
*/
75
#ifndef __ASM_BUGS_H
@@ -10,10 +8,8 @@
108
extern void check_writebuffer_bugs(void);
119

1210
#ifdef CONFIG_MMU
13-
extern void check_bugs(void);
1411
extern void check_other_bugs(void);
1512
#else
16-
#define check_bugs() do { } while (0)
1713
#define check_other_bugs() do { } while (0)
1814
#endif
1915

arch/arm/kernel/bugs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/init.h>
3+
#include <linux/cpu.h>
34
#include <asm/bugs.h>
45
#include <asm/proc-fns.h>
56

@@ -11,7 +12,7 @@ void check_other_bugs(void)
1112
#endif
1213
}
1314

14-
void __init check_bugs(void)
15+
void __init arch_cpu_finalize_init(void)
1516
{
1617
check_writebuffer_bugs();
1718
check_other_bugs();

arch/ia64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ menu "Processor type and features"
99
config IA64
1010
bool
1111
select ARCH_BINFMT_ELF_EXTRA_PHDRS
12+
select ARCH_HAS_CPU_FINALIZE_INIT
1213
select ARCH_HAS_DMA_MARK_CLEAN
1314
select ARCH_HAS_STRNCPY_FROM_USER
1415
select ARCH_HAS_STRNLEN_USER

arch/ia64/include/asm/bugs.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

arch/ia64/kernel/setup.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,7 @@ cpu_init (void)
10671067
}
10681068
}
10691069

1070-
void __init
1071-
check_bugs (void)
1070+
void __init arch_cpu_finalize_init(void)
10721071
{
10731072
ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
10741073
(unsigned long) __end___mckinley_e9_bundles);

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config LOONGARCH
1010
select ARCH_ENABLE_MEMORY_HOTPLUG
1111
select ARCH_ENABLE_MEMORY_HOTREMOVE
1212
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
13+
select ARCH_HAS_CPU_FINALIZE_INIT
1314
select ARCH_HAS_FORTIFY_SOURCE
1415
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
1516
select ARCH_HAS_PTE_SPECIAL

arch/loongarch/include/asm/bugs.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

arch/loongarch/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313
#include <linux/init.h>
1414
#include <linux/acpi.h>
15+
#include <linux/cpu.h>
1516
#include <linux/dmi.h>
1617
#include <linux/efi.h>
1718
#include <linux/export.h>
@@ -37,7 +38,6 @@
3738
#include <asm/addrspace.h>
3839
#include <asm/alternative.h>
3940
#include <asm/bootinfo.h>
40-
#include <asm/bugs.h>
4141
#include <asm/cache.h>
4242
#include <asm/cpu.h>
4343
#include <asm/dma.h>
@@ -87,7 +87,7 @@ const char *get_system_type(void)
8787
return "generic-loongson-machine";
8888
}
8989

90-
void __init check_bugs(void)
90+
void __init arch_cpu_finalize_init(void)
9191
{
9292
alternative_instructions();
9393
}

arch/m68k/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config M68K
44
default y
55
select ARCH_32BIT_OFF_T
66
select ARCH_HAS_BINFMT_FLAT
7+
select ARCH_HAS_CPU_FINALIZE_INIT if MMU
78
select ARCH_HAS_CURRENT_STACK_POINTER
89
select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE
910
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA

arch/m68k/include/asm/bugs.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

arch/m68k/kernel/setup_mm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <linux/kernel.h>
13+
#include <linux/cpu.h>
1314
#include <linux/mm.h>
1415
#include <linux/sched.h>
1516
#include <linux/delay.h>
@@ -504,7 +505,7 @@ static int __init proc_hardware_init(void)
504505
module_init(proc_hardware_init);
505506
#endif
506507

507-
void check_bugs(void)
508+
void __init arch_cpu_finalize_init(void)
508509
{
509510
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU)
510511
if (m68k_fputype == 0) {

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config MIPS
44
default y
55
select ARCH_32BIT_OFF_T if !64BIT
66
select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
7+
select ARCH_HAS_CPU_FINALIZE_INIT
78
select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000
89
select ARCH_HAS_DEBUG_VIRTUAL if !64BIT
910
select ARCH_HAS_FORTIFY_SOURCE

arch/mips/include/asm/bugs.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/*
3-
* This is included by init/main.c to check for architecture-dependent bugs.
4-
*
53
* Copyright (C) 2007 Maciej W. Rozycki
6-
*
7-
* Needs:
8-
* void check_bugs(void);
94
*/
105
#ifndef _ASM_BUGS_H
116
#define _ASM_BUGS_H
127

138
#include <linux/bug.h>
14-
#include <linux/delay.h>
159
#include <linux/smp.h>
1610

1711
#include <asm/cpu.h>
@@ -24,17 +18,6 @@ extern void check_bugs64_early(void);
2418
extern void check_bugs32(void);
2519
extern void check_bugs64(void);
2620

27-
static inline void __init check_bugs(void)
28-
{
29-
unsigned int cpu = smp_processor_id();
30-
31-
cpu_data[cpu].udelay_val = loops_per_jiffy;
32-
check_bugs32();
33-
34-
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
35-
check_bugs64();
36-
}
37-
3821
static inline int r4k_daddiu_bug(void)
3922
{
4023
if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))

arch/mips/kernel/setup.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* Copyright (C) 2000, 2001, 2002, 2007 Maciej W. Rozycki
1212
*/
1313
#include <linux/init.h>
14+
#include <linux/cpu.h>
15+
#include <linux/delay.h>
1416
#include <linux/ioport.h>
1517
#include <linux/export.h>
1618
#include <linux/screen_info.h>
@@ -841,3 +843,14 @@ static int __init setnocoherentio(char *str)
841843
}
842844
early_param("nocoherentio", setnocoherentio);
843845
#endif
846+
847+
void __init arch_cpu_finalize_init(void)
848+
{
849+
unsigned int cpu = smp_processor_id();
850+
851+
cpu_data[cpu].udelay_val = loops_per_jiffy;
852+
check_bugs32();
853+
854+
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
855+
check_bugs64();
856+
}

arch/parisc/include/asm/bugs.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

arch/powerpc/include/asm/bugs.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

arch/sh/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config SUPERH
66
select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU
77
select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
88
select ARCH_HAS_BINFMT_FLAT if !MMU
9+
select ARCH_HAS_CPU_FINALIZE_INIT
910
select ARCH_HAS_CURRENT_STACK_POINTER
1011
select ARCH_HAS_GIGANTIC_PAGE
1112
select ARCH_HAS_GCOV_PROFILE_ALL

arch/sh/include/asm/bugs.h

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)