All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xen.org, Keir Fraser <keir@xen.org>,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Date: Wed, 11 Mar 2015 14:49:14 -0400	[thread overview]
Message-ID: <20150311184914.GA3299@l.oracle.com> (raw)
In-Reply-To: <55006B100200007800068A2A@mail.emea.novell.com>

On Wed, Mar 11, 2015 at 03:19:28PM +0000, Jan Beulich wrote:
> >>> On 11.03.15 at 15:36, <konrad.wilk@oracle.com> wrote:
> > @@ -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;
> 
> This shouldn't depend on efi_enabled, but on reboot type not being
> BOOT_EFI (which means it may need to be duplicated in the "case
> BOOT_EFI:" code).

<nods>

>From da22ca80c2c1570636b5c8f2382e053b63c14a0e Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
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@oracle.com>
---
 docs/misc/xen-command-line.markdown |  5 ++++-
 xen/arch/x86/shutdown.c             | 27 +++++++++++++++++++++------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 5044da1..7685aa0 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1145,7 +1145,7 @@ The following resources are available:
   Technology.
 
 ### 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`
 
@@ -1165,6 +1165,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..9c93b64 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 ( reboot_type != BOOT_EFI )
+        *((unsigned short *)__va(0x472)) = reboot_mode;
 
     for ( attempt = 0; ; attempt++ )
     {
@@ -532,13 +538,22 @@ 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;
+            *((unsigned short *)__va(0x472)) = reboot_mode;
+            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

  reply	other threads:[~2015-03-11 18:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 11:44 [PATCH 1/2] x86: Don't apply reboot quirks if reboot set by user Ross Lagerwall
2015-03-11 11:44 ` [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems Ross Lagerwall
2015-03-11 12:26   ` Andrew Cooper
2015-03-11 14:08   ` Jan Beulich
2015-03-11 14:36     ` Konrad Rzeszutek Wilk
2015-03-11 15:19       ` Jan Beulich
2015-03-11 18:49         ` Konrad Rzeszutek Wilk [this message]
2015-03-12 11:44           ` Jan Beulich
2015-03-12 13:43             ` Konrad Rzeszutek Wilk
2015-03-12 14:07             ` Andrew Cooper
2015-03-12 14:39               ` Jan Beulich
2015-03-11 12:13 ` [PATCH 1/2] x86: Don't apply reboot quirks if reboot set by user Andrew Cooper
2015-03-11 14:05 ` Jan Beulich
2015-03-11 14:36 ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150311184914.GA3299@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.