aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-30 14:34:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-30 14:34:25 -0500
commit1ec63573b2db363848abb313cc75eb29e9abc1b3 (patch)
tree3efb06fe490831e48f8708c4ac21f14f486bab58
parenta1b3cf6d943800059adc262c4d839524c529db2d (diff)
parent60c8144afc287ef09ce8c1230c6aa972659ba1bb (diff)
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 ae7e1238e68f2a ("Add ACPI RSDP address to setup_header") x86/ptrace: Fix documentation for tracehook_report_syscall_entry()
-rw-r--r--Documentation/x86/boot.txt32
-rw-r--r--arch/x86/boot/header.S6
-rw-r--r--arch/x86/include/asm/fpu/internal.h2
-rw-r--r--arch/x86/include/asm/x86_init.h2
-rw-r--r--arch/x86/include/uapi/asm/bootparam.h7
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c19
-rw-r--r--arch/x86/kernel/fpu/signal.c4
-rw-r--r--arch/x86/kernel/head32.c1
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/setup.c17
-rw-r--r--include/linux/tracehook.h4
12 files changed, 16 insertions, 82 deletions
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
index 7727db8f94bc..5e9b826b5f62 100644
--- a/Documentation/x86/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -61,18 +61,6 @@ Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields
61 to struct boot_params for loading bzImage and ramdisk 61 to struct boot_params for loading bzImage and ramdisk
62 above 4G in 64bit. 62 above 4G in 64bit.
63 63
64Protocol 2.13: (Kernel 3.14) Support 32- and 64-bit flags being set in
65 xloadflags to support booting a 64-bit kernel from 32-bit
66 EFI
67
68Protocol 2.14: (Kernel 4.20) Added acpi_rsdp_addr holding the physical
69 address of the ACPI RSDP table.
70 The bootloader updates version with:
71 0x8000 | min(kernel-version, bootloader-version)
72 kernel-version being the protocol version supported by
73 the kernel and bootloader-version the protocol version
74 supported by the bootloader.
75
76**** MEMORY LAYOUT 64**** MEMORY LAYOUT
77 65
78The traditional memory map for the kernel loader, used for Image or 66The traditional memory map for the kernel loader, used for Image or
@@ -209,7 +197,6 @@ Offset Proto Name Meaning
2090258/8 2.10+ pref_address Preferred loading address 1970258/8 2.10+ pref_address Preferred loading address
2100260/4 2.10+ init_size Linear memory required during initialization 1980260/4 2.10+ init_size Linear memory required during initialization
2110264/4 2.11+ handover_offset Offset of handover entry point 1990264/4 2.11+ handover_offset Offset of handover entry point
2120268/8 2.14+ acpi_rsdp_addr Physical address of RSDP table
213 200
214(1) For backwards compatibility, if the setup_sects field contains 0, the 201(1) For backwards compatibility, if the setup_sects field contains 0, the
215 real value is 4. 202 real value is 4.
@@ -322,7 +309,7 @@ Protocol: 2.00+
322 Contains the magic number "HdrS" (0x53726448). 309 Contains the magic number "HdrS" (0x53726448).
323 310
324Field name: version 311Field name: version
325Type: modify 312Type: read
326Offset/size: 0x206/2 313Offset/size: 0x206/2
327Protocol: 2.00+ 314Protocol: 2.00+
328 315
@@ -330,12 +317,6 @@ Protocol: 2.00+
330 e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version 317 e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version
331 10.17. 318 10.17.
332 319
333 Up to protocol version 2.13 this information is only read by the
334 bootloader. From protocol version 2.14 onwards the bootloader will
335 write the used protocol version or-ed with 0x8000 to the field. The
336 used protocol version will be the minimum of the supported protocol
337 versions of the bootloader and the kernel.
338
339Field name: realmode_swtch 320Field name: realmode_swtch
340Type: modify (optional) 321Type: modify (optional)
341Offset/size: 0x208/4 322Offset/size: 0x208/4
@@ -763,17 +744,6 @@ Offset/size: 0x264/4
763 744
764 See EFI HANDOVER PROTOCOL below for more details. 745 See EFI HANDOVER PROTOCOL below for more details.
765 746
766Field name: acpi_rsdp_addr
767Type: write
768Offset/size: 0x268/8
769Protocol: 2.14+
770
771 This field can be set by the boot loader to tell the kernel the
772 physical address of the ACPI RSDP table.
773
774 A value of 0 indicates the kernel should fall back to the standard
775 methods to locate the RSDP.
776
777 747
778**** THE IMAGE CHECKSUM 748**** THE IMAGE CHECKSUM
779 749
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 4c881c850125..850b8762e889 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -300,7 +300,7 @@ _start:
300 # Part 2 of the header, from the old setup.S 300 # Part 2 of the header, from the old setup.S
301 301
302 .ascii "HdrS" # header signature 302 .ascii "HdrS" # header signature
303 .word 0x020e # header version number (>= 0x0105) 303 .word 0x020d # header version number (>= 0x0105)
304 # or else old loadlin-1.5 will fail) 304 # or else old loadlin-1.5 will fail)
305 .globl realmode_swtch 305 .globl realmode_swtch
306realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 306realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
@@ -558,10 +558,6 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
558init_size: .long INIT_SIZE # kernel initialization size 558init_size: .long INIT_SIZE # kernel initialization size
559handover_offset: .long 0 # Filled in by build.c 559handover_offset: .long 0 # Filled in by build.c
560 560
561acpi_rsdp_addr: .quad 0 # 64-bit physical pointer to the
562 # ACPI RSDP table, added with
563 # version 2.14
564
565# End of setup header ##################################################### 561# End of setup header #####################################################
566 562
567 .section ".entrytext", "ax" 563 .section ".entrytext", "ax"
diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index 5f7290e6e954..69dcdf195b61 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -226,7 +226,7 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu)
226 "3: movl $-2,%[err]\n\t" \ 226 "3: movl $-2,%[err]\n\t" \
227 "jmp 2b\n\t" \ 227 "jmp 2b\n\t" \
228 ".popsection\n\t" \ 228 ".popsection\n\t" \
229 _ASM_EXTABLE_UA(1b, 3b) \ 229 _ASM_EXTABLE(1b, 3b) \
230 : [err] "=r" (err) \ 230 : [err] "=r" (err) \
231 : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ 231 : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \
232 : "memory") 232 : "memory")
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index 0f842104862c..b85a7c54c6a1 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -303,6 +303,4 @@ extern void x86_init_noop(void);
303extern void x86_init_uint_noop(unsigned int unused); 303extern void x86_init_uint_noop(unsigned int unused);
304extern bool x86_pnpbios_disabled(void); 304extern bool x86_pnpbios_disabled(void);
305 305
306void x86_verify_bootdata_version(void);
307
308#endif 306#endif
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
index 22f89d040ddd..60733f137e9a 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -16,9 +16,6 @@
16#define RAMDISK_PROMPT_FLAG 0x8000 16#define RAMDISK_PROMPT_FLAG 0x8000
17#define RAMDISK_LOAD_FLAG 0x4000 17#define RAMDISK_LOAD_FLAG 0x4000
18 18
19/* version flags */
20#define VERSION_WRITTEN 0x8000
21
22/* loadflags */ 19/* loadflags */
23#define LOADED_HIGH (1<<0) 20#define LOADED_HIGH (1<<0)
24#define KASLR_FLAG (1<<1) 21#define KASLR_FLAG (1<<1)
@@ -89,7 +86,6 @@ struct setup_header {
89 __u64 pref_address; 86 __u64 pref_address;
90 __u32 init_size; 87 __u32 init_size;
91 __u32 handover_offset; 88 __u32 handover_offset;
92 __u64 acpi_rsdp_addr;
93} __attribute__((packed)); 89} __attribute__((packed));
94 90
95struct sys_desc_table { 91struct sys_desc_table {
@@ -159,7 +155,8 @@ struct boot_params {
159 __u8 _pad2[4]; /* 0x054 */ 155 __u8 _pad2[4]; /* 0x054 */
160 __u64 tboot_addr; /* 0x058 */ 156 __u64 tboot_addr; /* 0x058 */
161 struct ist_info ist_info; /* 0x060 */ 157 struct ist_info ist_info; /* 0x060 */
162 __u8 _pad3[16]; /* 0x070 */ 158 __u64 acpi_rsdp_addr; /* 0x070 */
159 __u8 _pad3[8]; /* 0x078 */
163 __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ 160 __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
164 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ 161 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
165 struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */ 162 struct sys_desc_table sys_desc_table; /* obsolete! */ /* 0x0a0 */
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 92c76bf97ad8..06635fbca81c 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1776,5 +1776,5 @@ void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
1776 1776
1777u64 x86_default_get_root_pointer(void) 1777u64 x86_default_get_root_pointer(void)
1778{ 1778{
1779 return boot_params.hdr.acpi_rsdp_addr; 1779 return boot_params.acpi_rsdp_addr;
1780} 1780}
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index dd33c357548f..e12454e21b8a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -56,7 +56,7 @@
56/* Threshold LVT offset is at MSR0xC0000410[15:12] */ 56/* Threshold LVT offset is at MSR0xC0000410[15:12] */
57#define SMCA_THR_LVT_OFF 0xF000 57#define SMCA_THR_LVT_OFF 0xF000
58 58
59static bool thresholding_en; 59static bool thresholding_irq_en;
60 60
61static const char * const th_names[] = { 61static const char * const th_names[] = {
62 "load_store", 62 "load_store",
@@ -534,9 +534,8 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,
534 534
535set_offset: 535set_offset:
536 offset = setup_APIC_mce_threshold(offset, new); 536 offset = setup_APIC_mce_threshold(offset, new);
537 537 if (offset == new)
538 if ((offset == new) && (mce_threshold_vector != amd_threshold_interrupt)) 538 thresholding_irq_en = true;
539 mce_threshold_vector = amd_threshold_interrupt;
540 539
541done: 540done:
542 mce_threshold_block_init(&b, offset); 541 mce_threshold_block_init(&b, offset);
@@ -1357,9 +1356,6 @@ int mce_threshold_remove_device(unsigned int cpu)
1357{ 1356{
1358 unsigned int bank; 1357 unsigned int bank;
1359 1358
1360 if (!thresholding_en)
1361 return 0;
1362
1363 for (bank = 0; bank < mca_cfg.banks; ++bank) { 1359 for (bank = 0; bank < mca_cfg.banks; ++bank) {
1364 if (!(per_cpu(bank_map, cpu) & (1 << bank))) 1360 if (!(per_cpu(bank_map, cpu) & (1 << bank)))
1365 continue; 1361 continue;
@@ -1377,9 +1373,6 @@ int mce_threshold_create_device(unsigned int cpu)
1377 struct threshold_bank **bp; 1373 struct threshold_bank **bp;
1378 int err = 0; 1374 int err = 0;
1379 1375
1380 if (!thresholding_en)
1381 return 0;
1382
1383 bp = per_cpu(threshold_banks, cpu); 1376 bp = per_cpu(threshold_banks, cpu);
1384 if (bp) 1377 if (bp)
1385 return 0; 1378 return 0;
@@ -1408,9 +1401,6 @@ static __init int threshold_init_device(void)
1408{ 1401{
1409 unsigned lcpu = 0; 1402 unsigned lcpu = 0;
1410 1403
1411 if (mce_threshold_vector == amd_threshold_interrupt)
1412 thresholding_en = true;
1413
1414 /* to hit CPUs online before the notifier is up */ 1404 /* to hit CPUs online before the notifier is up */
1415 for_each_online_cpu(lcpu) { 1405 for_each_online_cpu(lcpu) {
1416 int err = mce_threshold_create_device(lcpu); 1406 int err = mce_threshold_create_device(lcpu);
@@ -1419,6 +1409,9 @@ static __init int threshold_init_device(void)
1419 return err; 1409 return err;
1420 } 1410 }
1421 1411
1412 if (thresholding_irq_en)
1413 mce_threshold_vector = amd_threshold_interrupt;
1414
1422 return 0; 1415 return 0;
1423} 1416}
1424/* 1417/*
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 61a949d84dfa..d99a8ee9e185 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -344,10 +344,10 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
344 sanitize_restored_xstate(tsk, &env, xfeatures, fx_only); 344 sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);
345 } 345 }
346 346
347 local_bh_disable();
347 fpu->initialized = 1; 348 fpu->initialized = 1;
348 preempt_disable();
349 fpu__restore(fpu); 349 fpu__restore(fpu);
350 preempt_enable(); 350 local_bh_enable();
351 351
352 return err; 352 return err;
353 } else { 353 } else {
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 76fa3b836598..ec6fefbfd3c0 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -37,7 +37,6 @@ asmlinkage __visible void __init i386_start_kernel(void)
37 cr4_init_shadow(); 37 cr4_init_shadow();
38 38
39 sanitize_boot_params(&boot_params); 39 sanitize_boot_params(&boot_params);
40 x86_verify_bootdata_version();
41 40
42 x86_early_init_platform_quirks(); 41 x86_early_init_platform_quirks();
43 42
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 7663a8eb602b..16b1cbd3a61e 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -457,8 +457,6 @@ void __init x86_64_start_reservations(char *real_mode_data)
457 if (!boot_params.hdr.version) 457 if (!boot_params.hdr.version)
458 copy_bootdata(__va(real_mode_data)); 458 copy_bootdata(__va(real_mode_data));
459 459
460 x86_verify_bootdata_version();
461
462 x86_early_init_platform_quirks(); 460 x86_early_init_platform_quirks();
463 461
464 switch (boot_params.hdr.hardware_subarch) { 462 switch (boot_params.hdr.hardware_subarch) {
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index b74e7bfed6ab..d494b9bfe618 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1280,23 +1280,6 @@ void __init setup_arch(char **cmdline_p)
1280 unwind_init(); 1280 unwind_init();
1281} 1281}
1282 1282
1283/*
1284 * From boot protocol 2.14 onwards we expect the bootloader to set the
1285 * version to "0x8000 | <used version>". In case we find a version >= 2.14
1286 * without the 0x8000 we assume the boot loader supports 2.13 only and
1287 * reset the version accordingly. The 0x8000 flag is removed in any case.
1288 */
1289void __init x86_verify_bootdata_version(void)
1290{
1291 if (boot_params.hdr.version & VERSION_WRITTEN)
1292 boot_params.hdr.version &= ~VERSION_WRITTEN;
1293 else if (boot_params.hdr.version >= 0x020e)
1294 boot_params.hdr.version = 0x020d;
1295
1296 if (boot_params.hdr.version < 0x020e)
1297 boot_params.hdr.acpi_rsdp_addr = 0;
1298}
1299
1300#ifdef CONFIG_X86_32 1283#ifdef CONFIG_X86_32
1301 1284
1302static struct resource video_ram_resource = { 1285static struct resource video_ram_resource = {
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 40b0b4c1bf7b..df20f8bdbfa3 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -83,8 +83,8 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
83 * tracehook_report_syscall_entry - task is about to attempt a system call 83 * tracehook_report_syscall_entry - task is about to attempt a system call
84 * @regs: user register state of current task 84 * @regs: user register state of current task
85 * 85 *
86 * This will be called if %TIF_SYSCALL_TRACE has been set, when the 86 * This will be called if %TIF_SYSCALL_TRACE or %TIF_SYSCALL_EMU have been set,
87 * current task has just entered the kernel for a system call. 87 * when the current task has just entered the kernel for a system call.
88 * Full user register state is available here. Changing the values 88 * Full user register state is available here. Changing the values
89 * in @regs can affect the system call number and arguments to be tried. 89 * in @regs can affect the system call number and arguments to be tried.
90 * It is safe to block here, preventing the system call from beginning. 90 * It is safe to block here, preventing the system call from beginning.