From: Konrad Rzeszutek Wilk Subject: [PATCH RFC] efi: By default use the BOOT_ACPI method instead of BOOT_EFI unless on reduced ACPI hardware. Date: Wed, 21 Jan 2015 16:53:22 -0500 Message-ID: <1421877202-3043-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YE6ky-0007q3-8E for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 01:40:24 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0M1eKnl016386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Jan 2015 01:40:20 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0M1eJF4023896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 Jan 2015 01:40:20 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id t0M1eIXr027238 for ; Thu, 22 Jan 2015 01:40:18 GMT List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org This mimics the behavior of the Linux kernel in which the reboot sequence by default under EFI booted kernels is first ACPI. EFI reboot is only tried if the user supplied it or if the hardware is an ACPI 5.0 (or higher) reduced hardware board. This fixes the EFI firmware crashing on Lenovo ThinkCentre M57 Signed-off-by: Konrad Rzeszutek Wilk --- docs/misc/xen-command-line.markdown | 5 ++++- xen/arch/x86/shutdown.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index a061aa4..f037e0f 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1099,7 +1099,7 @@ The following resources are available: * `rmid_max` indicates the max value for rmid. ### reboot -> `= t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old]` +> `= t[riple] | k[bd] | a[cpi] | p[ci] | n[o] | [e]fi [, [w]arm | [c]old]` > Default: `0` @@ -1119,6 +1119,9 @@ Specify the host reboot method. `pci` instructs Xen to reboot the host using PCI reset register (port CF9). +'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by + default it will use ACPI method first). + ### sched > `= credit | credit2 | sedf | arinc653` diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 21f6cf5..f17ae9b 100644 --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -32,12 +32,13 @@ enum reboot_type { BOOT_KBD = 'k', BOOT_ACPI = 'a', BOOT_CF9 = 'p', + BOOT_EFI = 'e', }; static int reboot_mode; /* - * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old] + * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] | [e]fi [, [w]arm | [c]old] * warm Don't set the cold reboot flag * cold Set the cold reboot flag * no Suppress automatic reboot after panics or crashes @@ -45,6 +46,7 @@ static int reboot_mode; * kbd Use the keyboard controller. cold reset (default) * acpi Use the RESET_REG in the FADT * pci Use the so-called "PCI reset register", CF9 + * efi Use the EFI reboot (if running under EFI) */ static enum reboot_type reboot_type = BOOT_ACPI; static void __init set_reboot_type(char *str) @@ -66,6 +68,7 @@ static void __init set_reboot_type(char *str) case 'k': case 't': case 'p': + case 'e': reboot_type = *str; break; } @@ -452,7 +455,11 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { static int __init reboot_init(void) { - dmi_check_system(reboot_dmi_table); + int rv; + + rv = dmi_check_system(reboot_dmi_table); + if ( !rv && acpi_gbl_reduced_hardware ) + reboot_type = BOOT_EFI; return 0; } __initcall(reboot_init); @@ -504,8 +511,6 @@ void machine_restart(unsigned int delay_millisecs) tboot_shutdown(TB_SHUTDOWN_REBOOT); } - efi_reset_system(reboot_mode != 0); - /* Rebooting needs to touch the page at absolute address 0. */ *((unsigned short *)__va(0x472)) = reboot_mode; @@ -532,6 +537,10 @@ void machine_restart(unsigned int delay_millisecs) reboot_type = (((attempt == 1) && (orig_reboot_type == BOOT_ACPI)) ? BOOT_ACPI : BOOT_TRIPLE); break; + case BOOT_EFI: + efi_reset_system(reboot_mode != 0); + reboot_type = BOOT_ACPI; + break; case BOOT_TRIPLE: asm volatile ("lidt %0; int3" : : "m" (no_idt)); reboot_type = BOOT_KBD; -- 2.1.0