Commit 1ec63573 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes:

   - MCE related boot crash fix on certain AMD systems

   - FPU exception handling fix

   - FPU handling race fix

   - revert+rewrite of the RSDP boot protocol extension, use boot_params
     instead

   - documentation fix"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/MCE/AMD: Fix the thresholding machinery initialization order
  x86/fpu: Use the correct exception table macro in the XSTATE_OP wrapper
  x86/fpu: Disable bottom halves while loading FPU registers
  x86/acpi, x86/boot: Take RSDP address from boot params if available
  x86/boot: Mostly revert commit ae7e1238 ("Add ACPI RSDP address to setup_header")
  x86/ptrace: Fix documentation for tracehook_report_syscall_entry()
parents a1b3cf6d 60c8144a
...@@ -61,18 +61,6 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields ...@@ -61,18 +61,6 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields
to struct boot_params for loading bzImage and ramdisk to struct boot_params for loading bzImage and ramdisk
above 4G in 64bit. above 4G in 64bit.
Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
xloadflags to support booting a 64-bit kernel from 32-bit
EFI
Protocol 2.14: (Kernel 4.20) Added acpi_rsdp_addr holding the physical
address of the ACPI RSDP table.
The bootloader updates version with:
0x8000 | min(kernel-version, bootloader-version)
kernel-version being the protocol version supported by
the kernel and bootloader-version the protocol version
supported by the bootloader.
**** MEMORY LAYOUT **** MEMORY LAYOUT
The traditional memory map for the kernel loader, used for Image or The traditional memory map for the kernel loader, used for Image or
...@@ -209,7 +197,6 @@ Offset Proto Name Meaning ...@@ -209,7 +197,6 @@ Offset Proto Name Meaning
0258/8 2.10+ pref_address Preferred loading address 0258/8 2.10+ pref_address Preferred loading address
0260/4 2.10+ init_size Linear memory required during initialization 0260/4 2.10+ init_size Linear memory required during initialization
0264/4 2.11+ handover_offset Offset of handover entry point 0264/4 2.11+ handover_offset Offset of handover entry point
0268/8 2.14+ acpi_rsdp_addr Physical address of RSDP table
(1) For backwards compatibility, if the setup_sects field contains 0, the (1) For backwards compatibility, if the setup_sects field contains 0, the
real value is 4. real value is 4.
...@@ -322,7 +309,7 @@ Protocol: 2.00+ ...@@ -322,7 +309,7 @@ Protocol: 2.00+
Contains the magic number "HdrS" (0x53726448). Contains the magic number "HdrS" (0x53726448).
Field name: version Field name: version
Type: modify Type: read
Offset/size: 0x206/2 Offset/size: 0x206/2
Protocol: 2.00+ Protocol: 2.00+
...@@ -330,12 +317,6 @@ Protocol: 2.00+ ...@@ -330,12 +317,6 @@ Protocol: 2.00+
e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
10.17. 10.17.
Up to protocol version 2.13 this information is only read by the
bootloader. From protocol version 2.14 onwards the bootloader will
write the used protocol version or-ed with 0x8000 to the field. The
used protocol version will be the minimum of the supported protocol
versions of the bootloader and the kernel.
Field name: realmode_swtch Field name: realmode_swtch
Type: modify (optional) Type: modify (optional)
Offset/size: 0x208/4 Offset/size: 0x208/4
...@@ -763,17 +744,6 @@ Offset/size: 0x264/4 ...@@ -763,17 +744,6 @@ Offset/size: 0x264/4
See EFI HANDOVER PROTOCOL below for more details. See EFI HANDOVER PROTOCOL below for more details.
Field name: acpi_rsdp_addr
Type: write
Offset/size: 0x268/8
Protocol: 2.14+
This field can be set by the boot loader to tell the kernel the
physical address of the ACPI RSDP table.
A value of 0 indicates the kernel should fall back to the standard
methods to locate the RSDP.
**** THE IMAGE CHECKSUM **** THE IMAGE CHECKSUM
......
...@@ -300,7 +300,7 @@ _start: ...@@ -300,7 +300,7 @@ _start:
# Part 2 of the header, from the old setup.S # Part 2 of the header, from the old setup.S
.ascii "HdrS" # header signature .ascii "HdrS" # header signature
.word 0x020e # header version number (>= 0x0105) .word 0x020d # header version number (>= 0x0105)
# or else old loadlin-1.5 will fail) # or else old loadlin-1.5 will fail)
.globl realmode_swtch .globl realmode_swtch
realmode_swtch: .word 0, 0 # default_switch, SETUPSEG realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
...@@ -558,10 +558,6 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr ...@@ -558,10 +558,6 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
init_size: .long INIT_SIZE # kernel initialization size init_size: .long INIT_SIZE # kernel initialization size
handover_offset: .long 0 # Filled in by build.c handover_offset: .long 0 # Filled in by build.c
acpi_rsdp_addr: .quad 0 # 64-bit physical pointer to the
# ACPI RSDP table, added with
# version 2.14
# End of setup header ##################################################### # End of setup header #####################################################
.section ".entrytext", "ax" .section ".entrytext", "ax"
......
...@@ -226,7 +226,7 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu) ...@@ -226,7 +226,7 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu)
"3: movl $-2,%[err]\n\t" \ "3: movl $-2,%[err]\n\t" \
"jmp 2b\n\t" \ "jmp 2b\n\t" \
".popsection\n\t" \ ".popsection\n\t" \
_ASM_EXTABLE_UA(1b, 3b) \ _ASM_EXTABLE(1b, 3b) \
: [err] "=r" (err) \ : [err] "=r" (err) \
: "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \
: "memory") : "memory")
......
...@@ -303,6 +303,4 @@ extern void x86_init_noop(void); ...@@ -303,6 +303,4 @@ extern void x86_init_noop(void);
extern void x86_init_uint_noop(unsigned int unused); extern void x86_init_uint_noop(unsigned int unused);
extern bool x86_pnpbios_disabled(void); extern bool x86_pnpbios_disabled(void);
void x86_verify_bootdata_version(void);
#endif #endif
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_PROMPT_FLAG 0x8000
#define RAMDISK_LOAD_FLAG 0x4000 #define RAMDISK_LOAD_FLAG 0x4000
/* version flags */
#define VERSION_WRITTEN 0x8000
/* loadflags */ /* loadflags */
#define LOADED_HIGH (1<<0) #define LOADED_HIGH (1<<0)
#define KASLR_FLAG (1<<1) #define KASLR_FLAG (1<<1)
...@@ -89,7 +86,6 @@ struct setup_header { ...@@ -89,7 +86,6 @@ struct setup_header {
__u64 pref_address; __u64 pref_address;
__u32 init_size; __u32 init_size;
__u32 handover_offset; __u32 handover_offset;
__u64 acpi_rsdp_addr;
} __attribute__((packed)); } __attribute__((packed));
struct sys_desc_table { struct sys_desc_table {
...@@ -159,7 +155,8 @@ struct boot_params { ...@@ -159,7 +155,8 @@ struct boot_params {
__u8 _pad2[4]; /* 0x054 */ __u8 _pad2[4]; /* 0x054 */
__u64 tboot_addr; /* 0x058 */ __u64 tboot_addr; /* 0x058 */
struct ist_info ist_info; /* 0x060 */ struct ist_info ist_info; /* 0x060 */
__u8 _pad3[16]; /* 0x070 */ __u64 acpi_rsdp_addr; /* 0x070 */
__u8 _pad3[8]; /* 0x078 */
__u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
__u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */ struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */
......
...@@ -1776,5 +1776,5 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size) ...@@ -1776,5 +1776,5 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
u64 x86_default_get_root_pointer(void) u64 x86_default_get_root_pointer(void)
{ {
return boot_params.hdr.acpi_rsdp_addr; return boot_params.acpi_rsdp_addr;
} }
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
/* Threshold LVT offset is at MSR0xC0000410[15:12] */ /* Threshold LVT offset is at MSR0xC0000410[15:12] */
#define SMCA_THR_LVT_OFF 0xF000 #define SMCA_THR_LVT_OFF 0xF000
static bool thresholding_en; static bool thresholding_irq_en;
static const char * const th_names[] = { static const char * const th_names[] = {
"load_store", "load_store",
...@@ -534,9 +534,8 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr, ...@@ -534,9 +534,8 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,
set_offset: set_offset:
offset = setup_APIC_mce_threshold(offset, new); offset = setup_APIC_mce_threshold(offset, new);
if (offset == new)
if ((offset == new) && (mce_threshold_vector != amd_threshold_interrupt)) thresholding_irq_en = true;
mce_threshold_vector = amd_threshold_interrupt;
done: done:
mce_threshold_block_init(&b, offset); mce_threshold_block_init(&b, offset);
...@@ -1357,9 +1356,6 @@ int mce_threshold_remove_device(unsigned int cpu) ...@@ -1357,9 +1356,6 @@ int mce_threshold_remove_device(unsigned int cpu)
{ {
unsigned int bank; unsigned int bank;
if (!thresholding_en)
return 0;
for (bank = 0; bank < mca_cfg.banks; ++bank) { for (bank = 0; bank < mca_cfg.banks; ++bank) {
if (!(per_cpu(bank_map, cpu) & (1 << bank))) if (!(per_cpu(bank_map, cpu) & (1 << bank)))
continue; continue;
...@@ -1377,9 +1373,6 @@ int mce_threshold_create_device(unsigned int cpu) ...@@ -1377,9 +1373,6 @@ int mce_threshold_create_device(unsigned int cpu)
struct threshold_bank **bp; struct threshold_bank **bp;
int err = 0; int err = 0;
if (!thresholding_en)
return 0;
bp = per_cpu(threshold_banks, cpu); bp = per_cpu(threshold_banks, cpu);
if (bp) if (bp)
return 0; return 0;
...@@ -1408,9 +1401,6 @@ static __init int threshold_init_device(void) ...@@ -1408,9 +1401,6 @@ static __init int threshold_init_device(void)
{ {
unsigned lcpu = 0; unsigned lcpu = 0;
if (mce_threshold_vector == amd_threshold_interrupt)
thresholding_en = true;
/* to hit CPUs online before the notifier is up */ /* to hit CPUs online before the notifier is up */
for_each_online_cpu(lcpu) { for_each_online_cpu(lcpu) {
int err = mce_threshold_create_device(lcpu); int err = mce_threshold_create_device(lcpu);
...@@ -1419,6 +1409,9 @@ static __init int threshold_init_device(void) ...@@ -1419,6 +1409,9 @@ static __init int threshold_init_device(void)
return err; return err;
} }
if (thresholding_irq_en)
mce_threshold_vector = amd_threshold_interrupt;
return 0; return 0;
} }
/* /*
......
...@@ -344,10 +344,10 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) ...@@ -344,10 +344,10 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
sanitize_restored_xstate(tsk, &env, xfeatures, fx_only); sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);
} }
local_bh_disable();
fpu->initialized = 1; fpu->initialized = 1;
preempt_disable();
fpu__restore(fpu); fpu__restore(fpu);
preempt_enable(); local_bh_enable();
return err; return err;
} else { } else {
......
...@@ -37,7 +37,6 @@ asmlinkage __visible void __init i386_start_kernel(void) ...@@ -37,7 +37,6 @@ asmlinkage __visible void __init i386_start_kernel(void)
cr4_init_shadow(); cr4_init_shadow();
sanitize_boot_params(&boot_params); sanitize_boot_params(&boot_params);
x86_verify_bootdata_version();
x86_early_init_platform_quirks(); x86_early_init_platform_quirks();
......
...@@ -457,8 +457,6 @@ void __init x86_64_start_reservations(char *real_mode_data) ...@@ -457,8 +457,6 @@ void __init x86_64_start_reservations(char *real_mode_data)
if (!boot_params.hdr.version) if (!boot_params.hdr.version)
copy_bootdata(__va(real_mode_data)); copy_bootdata(__va(real_mode_data));
x86_verify_bootdata_version();
x86_early_init_platform_quirks(); x86_early_init_platform_quirks();
switch (boot_params.hdr.hardware_subarch) { switch (boot_params.hdr.hardware_subarch) {
......
...@@ -1280,23 +1280,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -1280,23 +1280,6 @@ void __init setup_arch(char **cmdline_p)
unwind_init(); unwind_init();
} }
/*
* From boot protocol 2.14 onwards we expect the bootloader to set the
* version to "0x8000 | <used version>". In case we find a version >= 2.14
* without the 0x8000 we assume the boot loader supports 2.13 only and
* reset the version accordingly. The 0x8000 flag is removed in any case.
*/
void __init x86_verify_bootdata_version(void)
{
if (boot_params.hdr.version & VERSION_WRITTEN)
boot_params.hdr.version &= ~VERSION_WRITTEN;
else if (boot_params.hdr.version >= 0x020e)
boot_params.hdr.version = 0x020d;
if (boot_params.hdr.version < 0x020e)
boot_params.hdr.acpi_rsdp_addr = 0;
}
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
static struct resource video_ram_resource = { static struct resource video_ram_resource = {
......
...@@ -83,8 +83,8 @@ static inline int ptrace_report_syscall(struct pt_regs *regs) ...@@ -83,8 +83,8 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
* tracehook_report_syscall_entry - task is about to attempt a system call * tracehook_report_syscall_entry - task is about to attempt a system call
* @regs: user register state of current task * @regs: user register state of current task
* *
* This will be called if %TIF_SYSCALL_TRACE has been set, when the * This will be called if %TIF_SYSCALL_TRACE or %TIF_SYSCALL_EMU have been set,
* current task has just entered the kernel for a system call. * when the current task has just entered the kernel for a system call.
* Full user register state is available here. Changing the values * Full user register state is available here. Changing the values
* in @regs can affect the system call number and arguments to be tried. * in @regs can affect the system call number and arguments to be tried.
* It is safe to block here, preventing the system call from beginning. * It is safe to block here, preventing the system call from beginning.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment