x86: Don't apply reboot quirks if reboot set by user
PATCH 1/2 x86: Don't apply reboot quirks if reboot set by user
If reboot= is specified on the command-line, don't apply reboot quirks to allow the command-line option to take precedence.
This is a port of Linux commit 5955633e91bf ("x86/reboot: Skip DMI checks if reboot set by user").
--- xen/arch/x86/shutdown.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
xen/arch/x86/shutdown.c +10 -0
@@ -35,6 +35,7 @@ enum reboot_type { };static int reboot_mode; +static bool_t reboot_default =1 ;/* * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old]
@@ -51,6 +52,8 @@ static void __init set_reboot_type(char *str) {for ( ; ; ) { + reboot_default =0 ; +switch ( *str ) {case 'n' :/* no reboot */
@@ -452,6 +455,13 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {static int __init reboot_init (void ) { +/* +* Only do the DMI check if reboot_type hasn't been overridden +* on the command line +*/ +if ( !reboot_default ) +return 0 ; +dmi_check_system (reboot_dmi_table);return 0 ; }
Signature · 1 line
2.1.0
PATCH 2/2 CA-162192: Fix rebooting on some EFI-booted systems
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.
This was seen on an Intel S1200RP_SE with firmware S1200RP.86B.02.02.0005.102320140911, version 4.6, date 2014-10-23.
Based on the following Linux commits:de18c850af70 ("x86: EFI runtime service support: EFI runtime services") a4f1987e4c54 ("x86, reboot: Add EFI and CF9 reboot methods into the default list")44be28e9dd98 ("x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag")
--- docs/misc/xen-command-line.markdown | 5 ++++- xen/arch/x86/shutdown.c | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-)
docs/misc/xen-command-line.markdown +4 -1
@@ -1113,7 +1113,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] | e[fi] | p[ci] | n[o] [, [w]arm | [c]old]` > Default: `0`
@@ -1131,6 +1131,9 @@ Specify the host reboot method. `acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT. +`efi` instructs Xen to reboot the host using the ResetSystem EFI runtime +service. + `pci` instructs Xen to reboot the host using PCI reset register (port CF9). ### ro-hpet
xen/arch/x86/shutdown.c +19 -7
@@ -31,6 +31,7 @@ enum reboot_type {BOOT_TRIPLE ='t' ,BOOT_KBD ='k' ,BOOT_ACPI ='a' , +BOOT_EFI ='e' , BOOT_CF9 = 'p', };
@@ -38,13 +39,14 @@ static int reboot_mode;static bool_t reboot_default =1 ;/* -* reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old] +* reboot=t[riple] | k[bd] | a[cpi] | e[fi] | p[ci] | n[o] [, [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 * triple Force a triple fault (init) * kbd Use the keyboard controller. cold reset (default) * acpi Use the RESET_REG in the FADT +* efi Use the ResetSystem EFI runtime service * pci Use the so-called "PCI reset register", CF9 */ static enum reboot_type reboot_type =BOOT_ACPI ;
@@ -66,6 +68,7 @@ static void __init set_reboot_type(char *str) reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :
@@ -462,7 +465,14 @@ static int __init reboot_init(void)if ( !reboot_default )return 0 ; -dmi_check_system (reboot_dmi_table); +/* +* If no quirks apply and the ACPI Hardware Reduced bit is set, prefer EFI +* runtime services over ACPI. +*/ +if ( !dmi_check_system (reboot_dmi_table) && + (acpi_gbl_FADT.flags &ACPI_FADT_HW_REDUCED ) ) + reboot_type =BOOT_EFI ; +return 0 ; }__initcall (reboot_init);
@@ -514,8 +524,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;
@@ -535,12 +543,12 @@ void machine_restart(unsigned int delay_millisecs)/* * If this platform supports ACPI reset, we follow a Windows-style * reboot attempt sequence: -* ACPI -> KBD -> ACPI -> KBD +* ACPI -> KBD -> ACPI -> KBD -> EFI * After this we revert to our usual sequence: -* KBD -> TRIPLE -> KBD -> TRIPLE -> KBD -> ... +* TRIPLE -> KBD -> TRIPLE -> KBD -> ... */ reboot_type = (((attempt ==1 ) && (orig_reboot_type ==BOOT_ACPI )) - ?BOOT_ACPI :BOOT_TRIPLE ); + ?BOOT_ACPI :BOOT_EFI );break ;case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt));
@@ -550,6 +558,10 @@ void machine_restart(unsigned int delay_millisecs)acpi_reboot (); reboot_type =BOOT_KBD ;break ; +case BOOT_EFI : +efi_reset_system (reboot_mode !=0 ); + reboot_type =BOOT_TRIPLE ; +break ;case BOOT_CF9 : {u8 cf9 =inb (0xcf9 ) & ~6 ;
Signature · 1 line
2.1.0
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 7 lines · Ross Lagerwall
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_EFIa reboot mode similar toBOOT_ACPIandBOOT_KBD.This was seen on an Intel
S1200RP_SEwith firmware S1200RP.86B.02.02.0005.102320140911, version 4.6, date 2014-10-23.
Quoted 8 lines
Based on the following Linux commits:
de18c850af70("x86: EFI runtime service support: EFI runtime services")a4f1987e4c54("x86, reboot: Add EFI and CF9 reboot methods into the default list")44be28e9dd98("x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag")Signed-off-by Ross Lagerwall <[email protected]>
You should avoid the internal ticket reference in the subject.
If Jan is happy, this could be fixed up on commit.
For the patch itself, Reviewed-by: Andrew Cooper <[email protected]>
Quoted 116 lines
--- docs/misc/xen-command-line.markdown | 5 ++++- xen/arch/x86/shutdown.c | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-)docs/misc/xen-command-line.markdown +4
-1@@ -1113,7 +1113,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] | e[fi] | p[ci] | n[o] [, [w]arm | [c]old]` > Default: `0`@@ -1131,6 +1131,9 @@ Specify the host reboot method. `acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT. +`efi` instructs Xen to reboot the host using the ResetSystem EFI runtime +service. + `pci` instructs Xen to reboot the host using PCI reset register (port CF9). ### ro-hpetxen/arch/x86/shutdown.c +19
-7@@ -31,6 +31,7 @@ enum reboot_type {BOOT_TRIPLE ='t' ,BOOT_KBD ='k' ,BOOT_ACPI ='a' , +BOOT_EFI ='e' , BOOT_CF9 = 'p', };@@ -38,13 +39,14 @@ static int reboot_mode;static bool_t reboot_default =1 ;/* -* reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old] +* reboot=t[riple] | k[bd] | a[cpi] | e[fi] | p[ci] | n[o] [, [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 * triple Force a triple fault (init) * kbd Use the keyboard controller. cold reset (default) * acpi Use the RESET_REG in the FADT +* efi Use the ResetSystem EFI runtime service * pci Use the so-called "PCI reset register", CF9 */ static enum reboot_type reboot_type =BOOT_ACPI ;@@ -66,6 +68,7 @@ static void __init set_reboot_type(char *str) reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :@@ -462,7 +465,14 @@ static int __init reboot_init(void)if ( !reboot_default )return 0 ; -dmi_check_system (reboot_dmi_table); +/* +* If no quirks apply and the ACPI Hardware Reduced bit is set, prefer EFI +* runtime services over ACPI. +*/ +if ( !dmi_check_system (reboot_dmi_table) && + (acpi_gbl_FADT.flags &ACPI_FADT_HW_REDUCED ) ) + reboot_type =BOOT_EFI ; +return 0 ; }__initcall (reboot_init);@@ -514,8 +524,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;@@ -535,12 +543,12 @@ void machine_restart(unsigned int delay_millisecs)/* * If this platform supports ACPI reset, we follow a Windows-style * reboot attempt sequence: -* ACPI -> KBD -> ACPI -> KBD +* ACPI -> KBD -> ACPI -> KBD -> EFI * After this we revert to our usual sequence: -* KBD -> TRIPLE -> KBD -> TRIPLE -> KBD -> ... +* TRIPLE -> KBD -> TRIPLE -> KBD -> ... */ reboot_type = (((attempt ==1 ) && (orig_reboot_type ==BOOT_ACPI )) - ?BOOT_ACPI :BOOT_TRIPLE ); + ?BOOT_ACPI :BOOT_EFI );break ;case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt));@@ -550,6 +558,10 @@ void machine_restart(unsigned int delay_millisecs)acpi_reboot (); reboot_type =BOOT_KBD ;break ; +case BOOT_EFI : +efi_reset_system (reboot_mode !=0 ); + reboot_type =BOOT_TRIPLE ; +break ;case BOOT_CF9 : {u8 cf9 =inb (0xcf9 ) & ~6 ;
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
In reply to Ross LagerwallQuoted 4 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 12:44, <[email protected]> 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_EFIa reboot mode similar toBOOT_ACPIandBOOT_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.
Jan
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 10 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 12:44, <[email protected]> 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_EFIa reboot mode similar toBOOT_ACPIandBOOT_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.:
Quoted 1 line
From
891f6df52dd9586a43cd76b1052a0caee35ee3e5Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
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.
--- docs/misc/xen-command-line.markdown | 5 ++++- xen/arch/x86/shutdown.c | 26 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-)
docs/misc/xen-command-line.markdown +4 -1
@@ -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>`
xen/arch/x86/shutdown.c +20 -6
@@ -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 : asmvolatile ("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 : {
Signature · 1 line
2.1.0
Quoted 8 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
xen/arch/x86/shutdown.c void machine_restart(unsigned int delay_millisecs) · line 516
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 15:36, <[email protected]> wrote:
xen/arch/x86/shutdown.c +2
-3@@ -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).
Jan
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 15:36, <[email protected]> wrote:
(quoted diff) +0
-0@@ -504,10 +511,9 @@ void machine_restart(unsigned int delay_millisecs) tboot_shutdown(TB_SHUTDOWN_REBOOT); }
Quoted 10 lines
Review void machine_restart(unsigned int delay_millisecs) · line 516
Quoted 6 lines
(quoted diff) +2
-3- 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 beingBOOT_EFI(which means it may need to be duplicated in the "caseBOOT_EFI:" code).
<nods>
Quoted 1 line
From
da22ca80c2c1570636b5c8f2382e053b63c14a0eMon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <[email protected]>
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.
--- docs/misc/xen-command-line.markdown | 5 ++++- xen/arch/x86/shutdown.c | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-)
docs/misc/xen-command-line.markdown +4 -1
@@ -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>`
xen/arch/x86/shutdown.c +21 -6
@@ -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 : asmvolatile ("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 : {
Signature · 1 line
2.1.0
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 19:49, <[email protected]> wrote:
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 3 Feb 2015 11:18:04 -0500
Subject: [PATCH] efi: Allow reboot= overrides when running under EFI
Quoted 8 lines
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 <[email protected]>
Further re-worked (hopefully we're reaching something everyone is okay with):
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.
- BOOT_INVALID is just zero
- also consider acpi_disabled in BOOT_INVALID resolution
- duplicate BOOT_INVALID resolution in machine_restart()
- don't fall back from BOOT_ACPI to BOOT_EFI (if it was overridden, it surely was for a reason)
- adjust doc change formatting
docs/misc/xen-command-line.markdown +4 -1
@@ -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] | e[fi] | n[o] [, [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>`
xen/arch/x86/shutdown.c +28 -5
@@ -28,16 +28,18 @@#include <asm/apic.h> enum reboot_type { +BOOT_INVALID ,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 ( ; ; )
@@ -63,6 +66,7 @@ static void __init set_reboot_type(char reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :
@@ -106,6 +110,14 @@ void machine_halt(void)__machine_halt (NULL ); } +static void default_reboot_type (void ) +{ +if ( reboot_type ==BOOT_INVALID ) + reboot_type = efi_enabled ?BOOT_EFI + : acpi_disabled ?BOOT_KBD + :BOOT_ACPI ; +} +static int __init override_reboot (struct dmi_system_id *d) {enum reboot_type type = (long )d->driver_data;
@@ -452,6 +464,7 @@ static struct dmi_system_id __initdata rstatic int __init reboot_init (void ) { +default_reboot_type ();dmi_check_system (reboot_dmi_table);return 0 ; }
@@ -465,7 +478,7 @@ static void noreturn __machine_restart(vvoid machine_restart (unsigned int delay_millisecs) {unsigned int i, attempt; -enum reboot_type orig_reboot_type = reboot_type; +enum reboot_type orig_reboot_type;const struct desc_ptr no_idt = {0 };watchdog_disable ();
@@ -504,15 +517,20 @@ void machine_restart(unsigned int delay_tboot_shutdown (TB_SHUTDOWN_REBOOT ); } -efi_reset_system (reboot_mode !=0 ); +/* Just in case reboot_init() didn't run yet. */ +default_reboot_type (); + orig_reboot_type = reboot_type;/* 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++ ) {switch ( reboot_type ) { +case BOOT_INVALID : +ASSERT_UNREACHABLE ();case BOOT_KBD :/* Pulse the keyboard reset line. */ for ( i =0 ; i <100 ; i++ )
@@ -532,6 +550,11 @@ void machine_restart(unsigned int delay_ 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 = acpi_disabled ?BOOT_KBD :BOOT_ACPI ; + *((unsigned short *)__va (0x472 )) = reboot_mode; +break ;case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt)); reboot_type =BOOT_KBD ;
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.
- BOOT_INVALID is just zero
- also consider acpi_disabled in BOOT_INVALID resolution
- duplicate BOOT_INVALID resolution in machine_restart()
- don't fall back from BOOT_ACPI to BOOT_EFI (if it was overridden, it surely was for a reason)
- adjust doc change formatting
docs/misc/xen-command-line.markdown +4 -1
@@ -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] | e[fi] | n[o] [, [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>`
xen/arch/x86/shutdown.c +28 -5
@@ -28,16 +28,18 @@#include <asm/apic.h> enum reboot_type { +BOOT_INVALID ,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 ( ; ; )
@@ -63,6 +66,7 @@ static void __init set_reboot_type(char reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :
@@ -106,6 +110,14 @@ void machine_halt(void)__machine_halt (NULL ); } +static void default_reboot_type (void ) +{ +if ( reboot_type ==BOOT_INVALID ) + reboot_type = efi_enabled ?BOOT_EFI + : acpi_disabled ?BOOT_KBD + :BOOT_ACPI ; +} +static int __init override_reboot (struct dmi_system_id *d) {enum reboot_type type = (long )d->driver_data;
@@ -452,6 +464,7 @@ static struct dmi_system_id __initdata rstatic int __init reboot_init (void ) { +default_reboot_type ();dmi_check_system (reboot_dmi_table);return 0 ; }
@@ -465,7 +478,7 @@ static void noreturn __machine_restart(vvoid machine_restart (unsigned int delay_millisecs) {unsigned int i, attempt; -enum reboot_type orig_reboot_type = reboot_type; +enum reboot_type orig_reboot_type;const struct desc_ptr no_idt = {0 };watchdog_disable ();
@@ -504,15 +517,20 @@ void machine_restart(unsigned int delay_tboot_shutdown (TB_SHUTDOWN_REBOOT ); } -efi_reset_system (reboot_mode !=0 ); +/* Just in case reboot_init() didn't run yet. */ +default_reboot_type (); + orig_reboot_type = reboot_type;/* 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++ ) {switch ( reboot_type ) { +case BOOT_INVALID : +ASSERT_UNREACHABLE ();case BOOT_KBD :/* Pulse the keyboard reset line. */ for ( i =0 ; i <100 ; i++ )
@@ -532,6 +550,11 @@ void machine_restart(unsigned int delay_ 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 = acpi_disabled ?BOOT_KBD :BOOT_ACPI ; + *((unsigned short *)__va (0x472 )) = reboot_mode; +break ;case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt)); reboot_type =BOOT_KBD ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 19 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 19:49, <[email protected]> wrote:
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 3 Feb 2015 11:18:04 -0500
Subject: [PATCH] efi: Allow reboot= overrides when running under EFIQuoted 8 lines
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 <[email protected]>Further re-worked (hopefully we're reaching something everyone is okay with):
efi: Allow reboot= overrides when running under EFI
Quoted 8 lines
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 <[email protected]>
And Reviewed-by as well.
Quoted 143 lines
-
BOOT_INVALIDis just zero
- also consideracpi_disabledinBOOT_INVALIDresolution
- duplicateBOOT_INVALIDresolution inmachine_restart()
- don't fall back fromBOOT_ACPItoBOOT_EFI(if it was overridden, it surely was for a reason)
- adjust doc change formattingSigned-off-by Jan Beulich <[email protected]>docs/misc/xen-command-line.markdown +1
-1@@ -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] | e[fi] | n[o] [, [w]arm |[c]old]`
Quoted 1 line
Default:
0docs/misc/xen-command-line.markdown +0
-0@@ -1165,6 +1165,9 @@ Specify the host reboot method.
pciinstructs 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-hpetQuoted 1 line
= <boolean>xen/arch/x86/shutdown.c +3
-1@@ -28,16 +28,18 @@#include <asm/apic.h> enum reboot_type { +BOOT_INVALID ,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 crashesxen/arch/x86/shutdown.c +25
-4@@ -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 ( ; ; )@@ -63,6 +66,7 @@ static void __init set_reboot_type(char reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :@@ -106,6 +110,14 @@ void machine_halt(void)__machine_halt (NULL ); } +static void default_reboot_type (void ) +{ +if ( reboot_type ==BOOT_INVALID ) + reboot_type = efi_enabled ?BOOT_EFI + : acpi_disabled ?BOOT_KBD + :BOOT_ACPI ; +} +static int __init override_reboot (struct dmi_system_id *d) {enum reboot_type type = (long )d->driver_data;@@ -452,6 +464,7 @@ static struct dmi_system_id __initdata rstatic int __init reboot_init (void ) { +default_reboot_type ();dmi_check_system (reboot_dmi_table);return 0 ; }@@ -465,7 +478,7 @@ static void noreturn __machine_restart(vvoid machine_restart (unsigned int delay_millisecs) {unsigned int i, attempt; -enum reboot_type orig_reboot_type = reboot_type; +enum reboot_type orig_reboot_type;const struct desc_ptr no_idt = {0 };watchdog_disable ();@@ -504,15 +517,20 @@ void machine_restart(unsigned int delay_tboot_shutdown (TB_SHUTDOWN_REBOOT ); } -efi_reset_system (reboot_mode !=0 ); +/* Just in case reboot_init() didn't run yet. */ +default_reboot_type (); + orig_reboot_type = reboot_type;/* 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++ ) {switch ( reboot_type ) { +case BOOT_INVALID : +ASSERT_UNREACHABLE ();case BOOT_KBD :/* Pulse the keyboard reset line. */ for ( i =0 ; i <100 ; i++ )@@ -532,6 +550,11 @@ void machine_restart(unsigned int delay_ 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 = acpi_disabled ?BOOT_KBD :BOOT_ACPI ; + *((unsigned short *)__va (0x472 )) = reboot_mode; +break ;case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt)); reboot_type =BOOT_KBD ;
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
In reply to Jan BeulichQuoted 114 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 19:49, <[email protected]> wrote:
From: Konrad Rzeszutek Wilk <[email protected]>
Date: Tue, 3 Feb 2015 11:18:04 -0500
Subject: [PATCH] efi: Allow reboot= overrides when running under EFIQuoted 8 lines
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 <[email protected]>Further re-worked (hopefully we're reaching something everyone is okay with):
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 <[email protected]>-
BOOT_INVALIDis just zero
- also consideracpi_disabledinBOOT_INVALIDresolution
- duplicateBOOT_INVALIDresolution inmachine_restart()
- don't fall back fromBOOT_ACPItoBOOT_EFI(if it was overridden, it surely was for a reason)
- adjust doc change formattingSigned-off-by Jan Beulich <[email protected]>docs/misc/xen-command-line.markdown +4
-1@@ -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] | e[fi] | n[o] [, [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>`xen/arch/x86/shutdown.c +14
-2@@ -28,16 +28,18 @@#include <asm/apic.h> enum reboot_type { +BOOT_INVALID ,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 ( ; ; )@@ -63,6 +66,7 @@ static void __init set_reboot_type(char reboot_mode =0x0 ;break ;case 'a' : +case 'e' :case 'k' :case 't' :case 'p' :@@ -106,6 +110,14 @@ void machine_halt(void)__machine_halt (NULL ); } +static void default_reboot_type (void ) +{ +if ( reboot_type ==BOOT_INVALID ) + reboot_type = efi_enabled ?BOOT_EFI + : acpi_disabled ?BOOT_KBD + :BOOT_ACPI ; +} +static int __init override_reboot (struct dmi_system_id *d) {enum reboot_type type = (long )d->driver_data;
xen/arch/x86/shutdown.c static struct dmi_system_id __initdata r · line 467
Quoted 4 lines
xen/arch/x86/shutdown.c +1
-0@@ -452,6 +464,7 @@ static struct dmi_system_id __initdata rstatic int __init reboot_init (void ) { +default_reboot_type ();
This still suffers from the bug Ross fixed in patch 1. If the user provides an override, the dmi quirks should be skipped so the request on the command line is honoured.
Quoted 36 lines
xen/arch/x86/shutdown.c +8
-3dmi_check_system (reboot_dmi_table);return 0 ; }@@ -465,7 +478,7 @@ static void noreturn __machine_restart(vvoid machine_restart (unsigned int delay_millisecs) {unsigned int i, attempt; -enum reboot_type orig_reboot_type = reboot_type; +enum reboot_type orig_reboot_type;const struct desc_ptr no_idt = {0 };watchdog_disable ();@@ -504,15 +517,20 @@ void machine_restart(unsigned int delay_tboot_shutdown (TB_SHUTDOWN_REBOOT ); } -efi_reset_system (reboot_mode !=0 ); +/* Just in case reboot_init() didn't run yet. */ +default_reboot_type (); + orig_reboot_type = reboot_type;/* 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++ ) {switch ( reboot_type ) { +case BOOT_INVALID : +ASSERT_UNREACHABLE ();case BOOT_KBD :/* Pulse the keyboard reset line. */ for ( i =0 ; i <100 ; i++ )
xen/arch/x86/shutdown.c void machine_restart(unsigned int delay_ · line 557
Quoted 8 lines
xen/arch/x86/shutdown.c +5
-0@@ -532,6 +550,11 @@ void machine_restart(unsigned int delay_ 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 = acpi_disabled ?BOOT_KBD :BOOT_ACPI ; + *((unsigned short *)__va (0x472 )) = reboot_mode; +break ;
Update the reboot type before calling efi_reset_system()
That way, if efi_reset_system() does fault, we will reenter machine_restart() and take an alternate route.
The exact symptoms with the reference code is that efi_reset_system() causes a #GP fault which breaks back into Xen, and the panic() path reenters efi_reset_system() at which point the system wedges and needs a hard power cycle.
~Andrew
Quoted 5 lines
xen/arch/x86/shutdown.c +0
-0case BOOT_TRIPLE : asmvolatile ("lidt %0; int3" : :"m" (no_idt)); reboot_type =BOOT_KBD ;
Re: [PATCH 2/2] CA-162192: Fix rebooting on some EFI-booted systems
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 12.03.15 at 15:07, <[email protected]> wrote:
xen/arch/x86/shutdown.c static struct dmi_system_id __initdata r · line 467
Quoted 5 lines · Jan Beulich
xen/arch/x86/shutdown.c +1
-0@@ -452,6 +464,7 @@ static struct dmi_system_id __initdata rstatic int __init reboot_init (void ) { +default_reboot_type ();This still suffers from the bug Ross fixed in patch 1. If the user provides an override, the dmi quirks should be skipped so the request on the command line is honoured.
And I assumed he'd resubmit that patch anyway, i.e. I didn't even mean to fix this here.
Quoted 12 lines
xen/arch/x86/shutdown.c void machine_restart(unsigned int delay_ · line 557
Quoted 9 lines
xen/arch/x86/shutdown.c +5
-0@@ -532,6 +550,11 @@ void machine_restart(unsigned int delay_ 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 = acpi_disabled ?BOOT_KBD :BOOT_ACPI ; + *((unsigned short *)__va (0x472 )) = reboot_mode; +break ;Update the reboot type before calling
efi_reset_system()
Quoted 7 lines
That way, if
efi_reset_system()does fault, we will reentermachine_restart()and take an alternate route.The exact symptoms with the reference code is that
efi_reset_system()causes a #GP fault which breaks back into Xen, and thepanic()path reentersefi_reset_system()at which point the system wedges and needs a hard power cycle.
Good point, flipped.
Jan
Quoted 7 lines · Ross Lagerwall
If reboot= is specified on the command-line, don't apply reboot quirks to allow the command-line option to take precedence.
This is a port of Linux commit
5955633e91bf("x86/reboot: Skip DMI checks if reboot set by user").Signed-off-by Ross Lagerwall <[email protected]>
Quoted 39 lines
--- xen/arch/x86/shutdown.c | 10 ++++++++++ 1 file changed, 10 insertions(+)xen/arch/x86/shutdown.c +10
-0@@ -35,6 +35,7 @@ enum reboot_type { };static int reboot_mode; +static bool_t reboot_default =1 ;/* * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old] @@ -51,6 +52,8 @@ static void __init set_reboot_type(char *str) {for ( ; ; ) { + reboot_default =0 ; +switch ( *str ) {case 'n' :/* no reboot */ @@ -452,6 +455,13 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {static int __init reboot_init (void ) { +/* +* Only do the DMI check if reboot_type hasn't been overridden +* on the command line +*/ +if ( !reboot_default ) +return 0 ; +dmi_check_system (reboot_dmi_table);return 0 ; }
xen/arch/x86/shutdown.c enum reboot_type { · line 38
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 11.03.15 at 12:44, <[email protected]> wrote:
xen/arch/x86/shutdown.c +1
-0@@ -35,6 +35,7 @@ enum reboot_type { };static int reboot_mode; +static bool_t reboot_default =1 ;
__initdata
xen/arch/x86/shutdown.c static void __init set_reboot_type(char *str) · line 55
Quoted 5 lines
xen/arch/x86/shutdown.c +1
-0@@ -51,6 +52,8 @@ static void __init set_reboot_type(char *str) {for ( ; ; ) { + reboot_default =0 ;
'n', 'w', and 'c' shouldn't have this effect.
Jan
Quoted 7 lines · Ross Lagerwall
If reboot= is specified on the command-line, don't apply reboot quirks to allow the command-line option to take precedence.
This is a port of Linux commit
5955633e91bf("x86/reboot: Skip DMI checks if reboot set by user").Signed-off-by Ross Lagerwall <[email protected]>
Quoted 47 lines
--- xen/arch/x86/shutdown.c | 10 ++++++++++ 1 file changed, 10 insertions(+)xen/arch/x86/shutdown.c +10
-0@@ -35,6 +35,7 @@ enum reboot_type { };static int reboot_mode; +static bool_t reboot_default =1 ;/* * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] [, [w]arm | [c]old] @@ -51,6 +52,8 @@ static void __init set_reboot_type(char *str) {for ( ; ; ) { + reboot_default =0 ; +switch ( *str ) {case 'n' :/* no reboot */ @@ -452,6 +455,13 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {static int __init reboot_init (void ) { +/* +* Only do the DMI check if reboot_type hasn't been overridden +* on the command line +*/ +if ( !reboot_default ) +return 0 ; +dmi_check_system (reboot_dmi_table);return 0 ; }Signature · 7 lines
2.1.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel