aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/Makefile4
-rw-r--r--arch/x86/kernel/early-quirks.c2
-rw-r--r--arch/x86/kernel/reboot.c72
-rw-r--r--arch/x86/syscalls/Makefile2
-rw-r--r--arch/x86/syscalls/syscall_32.tbl1
-rw-r--r--arch/x86/tools/Makefile2
-rw-r--r--include/linux/reboot.h14
7 files changed, 52 insertions, 45 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 602f57e590b5..d1b7c377a234 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -250,8 +250,8 @@ archclean:
250PHONY += kvmconfig 250PHONY += kvmconfig
251kvmconfig: 251kvmconfig:
252 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target)) 252 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
253 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config arch/x86/configs/kvm_guest.config 253 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(srctree)/arch/x86/configs/kvm_guest.config
254 $(Q)yes "" | $(MAKE) oldconfig 254 $(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
255 255
256define archhelp 256define archhelp
257 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 257 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index b0cc3809723d..6e2537c32190 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -240,7 +240,7 @@ static u32 __init intel_stolen_base(int num, int slot, int func, size_t stolen_s
240 return base; 240 return base;
241} 241}
242 242
243#define KB(x) ((x) * 1024) 243#define KB(x) ((x) * 1024UL)
244#define MB(x) (KB (KB (x))) 244#define MB(x) (KB (KB (x)))
245#define GB(x) (MB (KB (x))) 245#define GB(x) (MB (KB (x)))
246 246
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 654b46574b91..3399d3a99730 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -114,8 +114,8 @@ EXPORT_SYMBOL(machine_real_restart);
114 */ 114 */
115static int __init set_pci_reboot(const struct dmi_system_id *d) 115static int __init set_pci_reboot(const struct dmi_system_id *d)
116{ 116{
117 if (reboot_type != BOOT_CF9) { 117 if (reboot_type != BOOT_CF9_FORCE) {
118 reboot_type = BOOT_CF9; 118 reboot_type = BOOT_CF9_FORCE;
119 pr_info("%s series board detected. Selecting %s-method for reboots.\n", 119 pr_info("%s series board detected. Selecting %s-method for reboots.\n",
120 d->ident, "PCI"); 120 d->ident, "PCI");
121 } 121 }
@@ -458,20 +458,23 @@ void __attribute__((weak)) mach_reboot_fixups(void)
458} 458}
459 459
460/* 460/*
461 * Windows compatible x86 hardware expects the following on reboot: 461 * To the best of our knowledge Windows compatible x86 hardware expects
462 * the following on reboot:
462 * 463 *
463 * 1) If the FADT has the ACPI reboot register flag set, try it 464 * 1) If the FADT has the ACPI reboot register flag set, try it
464 * 2) If still alive, write to the keyboard controller 465 * 2) If still alive, write to the keyboard controller
465 * 3) If still alive, write to the ACPI reboot register again 466 * 3) If still alive, write to the ACPI reboot register again
466 * 4) If still alive, write to the keyboard controller again 467 * 4) If still alive, write to the keyboard controller again
467 * 5) If still alive, call the EFI runtime service to reboot 468 * 5) If still alive, call the EFI runtime service to reboot
468 * 6) If still alive, write to the PCI IO port 0xCF9 to reboot 469 * 6) If no EFI runtime service, call the BIOS to do a reboot
469 * 7) If still alive, inform BIOS to do a proper reboot
470 * 470 *
471 * If the machine is still alive at this stage, it gives up. We default to 471 * We default to following the same pattern. We also have
472 * following the same pattern, except that if we're still alive after (7) we'll 472 * two other reboot methods: 'triple fault' and 'PCI', which
473 * try to force a triple fault and then cycle between hitting the keyboard 473 * can be triggered via the reboot= kernel boot option or
474 * controller and doing that 474 * via quirks.
475 *
476 * This means that this function can never return, it can misbehave
477 * by not rebooting properly and hanging.
475 */ 478 */
476static void native_machine_emergency_restart(void) 479static void native_machine_emergency_restart(void)
477{ 480{
@@ -492,6 +495,11 @@ static void native_machine_emergency_restart(void)
492 for (;;) { 495 for (;;) {
493 /* Could also try the reset bit in the Hammer NB */ 496 /* Could also try the reset bit in the Hammer NB */
494 switch (reboot_type) { 497 switch (reboot_type) {
498 case BOOT_ACPI:
499 acpi_reboot();
500 reboot_type = BOOT_KBD;
501 break;
502
495 case BOOT_KBD: 503 case BOOT_KBD:
496 mach_reboot_fixups(); /* For board specific fixups */ 504 mach_reboot_fixups(); /* For board specific fixups */
497 505
@@ -509,43 +517,29 @@ static void native_machine_emergency_restart(void)
509 } 517 }
510 break; 518 break;
511 519
512 case BOOT_TRIPLE:
513 load_idt(&no_idt);
514 __asm__ __volatile__("int3");
515
516 /* We're probably dead after this, but... */
517 reboot_type = BOOT_KBD;
518 break;
519
520 case BOOT_BIOS:
521 machine_real_restart(MRR_BIOS);
522
523 /* We're probably dead after this, but... */
524 reboot_type = BOOT_TRIPLE;
525 break;
526
527 case BOOT_ACPI:
528 acpi_reboot();
529 reboot_type = BOOT_KBD;
530 break;
531
532 case BOOT_EFI: 520 case BOOT_EFI:
533 if (efi_enabled(EFI_RUNTIME_SERVICES)) 521 if (efi_enabled(EFI_RUNTIME_SERVICES))
534 efi.reset_system(reboot_mode == REBOOT_WARM ? 522 efi.reset_system(reboot_mode == REBOOT_WARM ?
535 EFI_RESET_WARM : 523 EFI_RESET_WARM :
536 EFI_RESET_COLD, 524 EFI_RESET_COLD,
537 EFI_SUCCESS, 0, NULL); 525 EFI_SUCCESS, 0, NULL);
538 reboot_type = BOOT_CF9_COND; 526 reboot_type = BOOT_BIOS;
527 break;
528
529 case BOOT_BIOS:
530 machine_real_restart(MRR_BIOS);
531
532 /* We're probably dead after this, but... */
533 reboot_type = BOOT_CF9_SAFE;
539 break; 534 break;
540 535
541 case BOOT_CF9: 536 case BOOT_CF9_FORCE:
542 port_cf9_safe = true; 537 port_cf9_safe = true;
543 /* Fall through */ 538 /* Fall through */
544 539
545 case BOOT_CF9_COND: 540 case BOOT_CF9_SAFE:
546 if (port_cf9_safe) { 541 if (port_cf9_safe) {
547 u8 reboot_code = reboot_mode == REBOOT_WARM ? 542 u8 reboot_code = reboot_mode == REBOOT_WARM ? 0x06 : 0x0E;
548 0x06 : 0x0E;
549 u8 cf9 = inb(0xcf9) & ~reboot_code; 543 u8 cf9 = inb(0xcf9) & ~reboot_code;
550 outb(cf9|2, 0xcf9); /* Request hard reset */ 544 outb(cf9|2, 0xcf9); /* Request hard reset */
551 udelay(50); 545 udelay(50);
@@ -553,7 +547,15 @@ static void native_machine_emergency_restart(void)
553 outb(cf9|reboot_code, 0xcf9); 547 outb(cf9|reboot_code, 0xcf9);
554 udelay(50); 548 udelay(50);
555 } 549 }
556 reboot_type = BOOT_BIOS; 550 reboot_type = BOOT_TRIPLE;
551 break;
552
553 case BOOT_TRIPLE:
554 load_idt(&no_idt);
555 __asm__ __volatile__("int3");
556
557 /* We're probably dead after this, but... */
558 reboot_type = BOOT_KBD;
557 break; 559 break;
558 } 560 }
559 } 561 }
diff --git a/arch/x86/syscalls/Makefile b/arch/x86/syscalls/Makefile
index f325af26107c..3323c2745248 100644
--- a/arch/x86/syscalls/Makefile
+++ b/arch/x86/syscalls/Makefile
@@ -54,5 +54,7 @@ syshdr-$(CONFIG_X86_64) += syscalls_64.h
54 54
55targets += $(uapisyshdr-y) $(syshdr-y) 55targets += $(uapisyshdr-y) $(syshdr-y)
56 56
57PHONY += all
57all: $(addprefix $(uapi)/,$(uapisyshdr-y)) 58all: $(addprefix $(uapi)/,$(uapisyshdr-y))
58all: $(addprefix $(out)/,$(syshdr-y)) 59all: $(addprefix $(out)/,$(syshdr-y))
60 @:
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index 96bc506ac6de..d6b867921612 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -359,3 +359,4 @@
359350 i386 finit_module sys_finit_module 359350 i386 finit_module sys_finit_module
360351 i386 sched_setattr sys_sched_setattr 360351 i386 sched_setattr sys_sched_setattr
361352 i386 sched_getattr sys_sched_getattr 361352 i386 sched_getattr sys_sched_getattr
362353 i386 renameat2 sys_renameat2
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index e8120346903b..604a37efd4d5 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -40,4 +40,6 @@ $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/ina
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include 40HOST_EXTRACFLAGS += -I$(srctree)/tools/include
41hostprogs-y += relocs 41hostprogs-y += relocs
42relocs-objs := relocs_32.o relocs_64.o relocs_common.o 42relocs-objs := relocs_32.o relocs_64.o relocs_common.o
43PHONY += relocs
43relocs: $(obj)/relocs 44relocs: $(obj)/relocs
45 @:
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 9e7db9e73cc1..48bf152761c7 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -20,13 +20,13 @@ enum reboot_mode {
20extern enum reboot_mode reboot_mode; 20extern enum reboot_mode reboot_mode;
21 21
22enum reboot_type { 22enum reboot_type {
23 BOOT_TRIPLE = 't', 23 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k', 24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b', 25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a', 26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e', 27 BOOT_EFI = 'e',
28 BOOT_CF9 = 'p', 28 BOOT_CF9_FORCE = 'p',
29 BOOT_CF9_COND = 'q', 29 BOOT_CF9_SAFE = 'q',
30}; 30};
31extern enum reboot_type reboot_type; 31extern enum reboot_type reboot_type;
32 32