[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems



On Wed, Mar 11, 2015 at 02:08:37PM +0000, Jan Beulich wrote:
> >>> On 11.03.15 at 12:44, <ross.lagerwall@xxxxxxxxxx> wrote:
> > On some systems, the ResetSystem EFI runtime service is broken.  Follow the
> > Linux (and Windows) way by preferring ACPI reboot over EFI reboot.  This is
> > done by making BOOT_EFI a reboot mode similar to BOOT_ACPI and BOOT_KBD.
> 
> No. Just because Linux and/or Windows do things a certain way
> doesn't mean we should follow suit. Rebooting via EFI runtime
> services should still be the default when running on EFI. Quirks
> to overcome certain systems' limitations will of course be
> acceptable.

You might just use this patch (that I had forgotten to post) - and which
needs testing since the last posting.:

From 891f6df52dd9586a43cd76b1052a0caee35ee3e5 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 3 Feb 2015 11:18:04 -0500
Subject: [PATCH] efi: Allow reboot= overrides when running under EFI

By default we will always use EFI reboot mechanism when
running under EFI platforms. However some EFI platforms
are buggy and need to use the ACPI mechanism to
reboot (such as Lenovo ThinkCentre M57). As such
respect the 'reboot=' override and DMI overrides
for EFI platforms.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

---
 docs/misc/xen-command-line.markdown |  5 ++++-
 xen/arch/x86/shutdown.c             | 26 ++++++++++++++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown 
b/docs/misc/xen-command-line.markdown
index 9b458e1..b1f74a1 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1110,7 +1110,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`
 
@@ -1130,6 +1130,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 that method first).
+
 ### ro-hpet
 > `= <boolean>`
 
diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index 21f6cf5..021998e 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -28,16 +28,18 @@
 #include <asm/apic.h>
 
 enum reboot_type {
+        BOOT_INVALID = 'i',
         BOOT_TRIPLE = 't',
         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,8 +47,9 @@ 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 enum reboot_type reboot_type = BOOT_INVALID;
 static void __init set_reboot_type(char *str)
 {
     for ( ; ; )
@@ -66,6 +69,7 @@ static void __init set_reboot_type(char *str)
         case 'k':
         case 't':
         case 'p':
+        case 'e':
             reboot_type = *str;
             break;
         }
@@ -452,6 +456,9 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = 
{
 
 static int __init reboot_init(void)
 {
+    if ( reboot_type == BOOT_INVALID )
+        reboot_type = efi_enabled ? BOOT_EFI : BOOT_ACPI;
+
     dmi_check_system(reboot_dmi_table);
     return 0;
 }
@@ -504,10 +511,9 @@ 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;
+    if ( !efi_enabled )
+        *((unsigned short *)__va(0x472)) = reboot_mode;
 
     for ( attempt = 0; ; attempt++ )
     {
@@ -532,13 +538,21 @@ 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;
             break;
+        case BOOT_INVALID:
         case BOOT_ACPI:
             acpi_reboot();
-            reboot_type = BOOT_KBD;
+            if ( efi_enabled && attempt == 0 )
+                reboot_type = BOOT_EFI;
+            else
+                reboot_type = BOOT_KBD;
             break;
         case BOOT_CF9:
             {
-- 
2.1.0

> 
> Jan
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.