From: Larry Bassel Date: Thu, 12 Jan 2017 16:29:49 +0000 (-0700) Subject: sparc64: shut down to OBP correctly X-Git-Tag: v4.1.12-92~1^2~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=eedab457423c356d4d0dde6b839a2815f1305500;p=users%2Fjedix%2Flinux-maple.git sparc64: shut down to OBP correctly Orabug: 23467092 The command "shutdown -h -H now" should shut the system down to the OBP, however the machine was being powered off in the LDOM case. In the LDOM case, the "reboot-command" variable must be set to the string "noop" and then ldom_reboot() must be called. This will make the OBP ignore the setting of "auto-boot?" after it completes the reset. This causes the system to stop at the ok prompt. Signed-off-by: Larry Bassel Reviewed-by: Shannon Nelson Signed-off-by: Allen Pais --- diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h index 23a184b01b253..58df56dd38aea 100644 --- a/arch/sparc/include/asm/ldc.h +++ b/arch/sparc/include/asm/ldc.h @@ -5,7 +5,7 @@ extern int ldom_domaining_enabled; void ldom_set_var(const char *var, const char *value); -void ldom_reboot(const char *boot_command); +void ldom_reboot(const char *boot_command, bool prepend_boot); void ldom_power_off(void); /* The event handler will be evoked when link state changes diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index 06b5e227639de..bd2bfbd7a3eb6 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c @@ -2917,7 +2917,7 @@ static int ldom_req_sp_token(const char *service_name, u32 *sp_token_result, static char full_boot_str[256] __aligned(32); static int reboot_data_supported; -void ldom_reboot(const char *boot_command) +void ldom_reboot(const char *boot_command, bool prepend_boot) { dprintk("entered.\n"); @@ -2928,8 +2928,8 @@ void ldom_reboot(const char *boot_command) if (boot_command && strlen(boot_command)) { unsigned long len; - strcpy(full_boot_str, "boot "); - strcpy(full_boot_str + strlen("boot "), boot_command); + snprintf(full_boot_str, sizeof(full_boot_str), "%s%s", + prepend_boot ? "boot " : "", boot_command); len = strlen(full_boot_str); if (reboot_data_supported) { diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index 53a696d3eb3bb..7efe361805bb4 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c @@ -54,7 +54,7 @@ void prom_reboot(const char *bcommand) #ifdef CONFIG_SUN_LDOMS if (ldom_domaining_enabled) - ldom_reboot(bcommand); + ldom_reboot(bcommand, true); #endif args[0] = (unsigned long) "boot"; args[1] = 1; @@ -116,8 +116,16 @@ void notrace prom_halt(void) unsigned long args[3]; #ifdef CONFIG_SUN_LDOMS + /* + * By storing a no-op command + * in the 'reboot-command' variable we cause OBP + * to ignore the setting of 'auto-boot?' after + * it completes the reset. This causes the system + * to stop at the ok prompt. + */ + if (ldom_domaining_enabled) - ldom_power_off(); + ldom_reboot("noop", false); #endif again: args[0] = (unsigned long) "exit";