From 59586e5a262a29361c45c929ea3253d4aec830b0 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 26 Jul 2005 11:36:01 -0600 Subject: [PATCH] Don't export machine_restart, machine_halt, or machine_power_off. machine_restart, machine_halt and machine_power_off are machine specific hooks deep into the reboot logic, that modules have no business messing with. Usually code should be calling kernel_restart, kernel_halt, kernel_power_off, or emergency_restart. So don't export machine_restart, machine_halt, and machine_power_off so we can catch buggy users. Signed-off-by: Eric W. Biederman Signed-off-by: Linus Torvalds --- arch/i386/kernel/reboot.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'arch/i386/kernel/reboot.c') diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index b3e58484996..1b24bc7271a 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c @@ -337,14 +337,10 @@ void machine_restart(char * __unused) machine_real_restart(jump_to_bios, sizeof(jump_to_bios)); } -EXPORT_SYMBOL(machine_restart); - void machine_halt(void) { } -EXPORT_SYMBOL(machine_halt); - void machine_power_off(void) { lapic_shutdown(); @@ -355,5 +351,4 @@ void machine_power_off(void) pm_power_off(); } -EXPORT_SYMBOL(machine_power_off); -- cgit v1.2.3 From 4a1421f81b64e49ce932125e7222a2d7b7f87f13 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 26 Jul 2005 11:41:26 -0600 Subject: [PATCH] i386: Implement machine_emergency_reboot set_cpus_allowed is not safe in interrupt context and disabling apics is complicated code so don't call machine_shutdown on i386 from emergency_restart(). Signed-off-by: Eric W. Biederman Signed-off-by: Linus Torvalds --- arch/i386/kernel/reboot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'arch/i386/kernel/reboot.c') diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 1b24bc7271a..d473350aa05 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c @@ -311,10 +311,8 @@ void machine_shutdown(void) #endif } -void machine_restart(char * __unused) +void machine_emergency_restart(void) { - machine_shutdown(); - if (!reboot_thru_bios) { if (efi_enabled) { efi.reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL); @@ -337,6 +335,12 @@ void machine_restart(char * __unused) machine_real_restart(jump_to_bios, sizeof(jump_to_bios)); } +void machine_restart(char * __unused) +{ + machine_shutdown(); + machine_emergency_restart(); +} + void machine_halt(void) { } -- cgit v1.2.3 From d8e392e7c8f019657ff3ebe70a45d234990831db Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 26 Jul 2005 12:07:01 -0600 Subject: [PATCH] machine_shutdown: Typo fix to actually allow specifying which cpu to reboot on This appears to be a typo I introduced when cleaning this code up earlier. Ooops. Signed-off-by: Eric W. Biederman Signed-off-by: Linus Torvalds --- arch/i386/kernel/reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/i386/kernel/reboot.c') diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index d473350aa05..1049876702a 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c @@ -284,7 +284,7 @@ void machine_shutdown(void) reboot_cpu_id = 0; /* See if there has been given a command line override */ - if ((reboot_cpu_id != -1) && (reboot_cpu < NR_CPUS) && + if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && cpu_isset(reboot_cpu, cpu_online_map)) { reboot_cpu_id = reboot_cpu; } -- cgit v1.2.3 From 4fa2564a6fde9815df969ef3547744a22f66ba9d Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 26 Jul 2005 12:08:53 -0600 Subject: [PATCH] i386 machine_power_off cleanup Call machine_shutdown() to move to the boot cpu and disable apics. Both acpi_power_off and apm_power_off want to move to the boot cpu. and we are already disabling the local apics so calling machine_shutdown simply reuses code. ia64 doesn't have a special path in power_off for efi so there is no reason i386 should. If we really need to call the efi power off path the efi driver can set pm_power_off like everyone else. Signed-off-by: Eric W. Biederman Signed-off-by: Linus Torvalds --- arch/i386/kernel/reboot.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/i386/kernel/reboot.c') diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 1049876702a..c71fef31dc4 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c @@ -347,10 +347,8 @@ void machine_halt(void) void machine_power_off(void) { - lapic_shutdown(); + machine_shutdown(); - if (efi_enabled) - efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL); if (pm_power_off) pm_power_off(); } -- cgit v1.2.3