x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
Subsystems (3)
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit 44be28e9dd9880dca3e2cbf7a844f2114e67f2cb
Author: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100
x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
Ben.
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
Quoted 8 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
Be sure to also include commit 8562c99cdd30 ("efi/reboot: Add generic wrapper around EfiResetSystem()") and commit 0c5ed61adbdb ("efi/reboot:
Allow powering off machines using EFI").
Quoted 8 lines · Matt Fleming
Quoted 7 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100
Quoted 6 lines
Quoted 1 line
x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").
Thanks.
Ben.
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
Quoted 9 lines · Ben Hutchings
Quoted 8 lines · Matt Fleming
Quoted 7 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100
Quoted 13 lines
Quoted 6 lines
Quoted 1 line
x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").
Thank you Ben and Matt. I'll have a look at these commits and queue them for the next release.
Cheers,
--
Lu�s
Quoted 17 lines · Luis Henriques
Quoted 16 lines · Ben Hutchings
Quoted 14 lines · Matt Fleming
Quoted 8 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
Quoted 6 lines
Quoted 6 lines
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").
Ok, it looks like the easy approach to bring this into 3.16 is to pick the following commits (in this order):
eeb9db09f738 x86/efi: Move all workarounds to a separate file quirks.c 8562c99cdd30 efi/reboot: Add generic wrapper around EfiResetSystem() 0c5ed61adbdb efi/reboot: Allow powering off machines using EFI 44be28e9dd98 x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
All of these are clean cherry-picks (except for the last one that needs same really small context adjustment). If there's no objection, I'll be sending this out for review shortly.
Cheers,
--
Lu�s
Quoted 28 lines · Luis Henriques
Quoted 17 lines · Luis Henriques
Quoted 16 lines · Ben Hutchings
Quoted 14 lines · Matt Fleming
Quoted 8 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
Quoted 6 lines
Quoted 6 lines
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").Ok, it looks like the easy approach to bring this into 3.16 is to pick the following commits (in this order):
Quoted 8 lines
eeb9db09f738x86/efi: Move all workarounds to a separate filequirks.c8562c99cdd30efi/reboot: Add generic wrapper aroundEfiResetSystem()0c5ed61adbdbefi/reboot: Allow powering off machines using EFI44be28e9dd98x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flagAll of these are clean cherry-picks (except for the last one that needs same really small context adjustment). If there's no objection, I'll be sending this out for review shortly.
The first one is really too big according to stable rules. Sorry I raised this; I didn't realise there were all these dependencies.
Ben.
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
Quoted 34 lines · Ben Hutchings
Quoted 33 lines · Luis Henriques
Quoted 17 lines · Luis Henriques
Quoted 16 lines · Ben Hutchings
Quoted 14 lines · Matt Fleming
Quoted 8 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
Quoted 6 lines
Quoted 6 lines
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").Ok, it looks like the easy approach to bring this into 3.16 is to pick the following commits (in this order):
eeb9db09f738x86/efi: Move all workarounds to a separate filequirks.c8562c99cdd30efi/reboot: Add generic wrapper aroundEfiResetSystem()0c5ed61adbdbefi/reboot: Allow powering off machines using EFI44be28e9dd98x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
Quoted 6 lines
Quoted 3 lines
All of these are clean cherry-picks (except for the last one that needs same really small context adjustment). If there's no objection, I'll be sending this out for review shortly.
The first one is really too big according to stable rules. Sorry I raised this; I didn't realise there were all these dependencies.
True, that commit simply moves code around but it's still huge.
Anyway, a different approach would be to backport 44be28e9dd98 by moving the changes done to quirks.c into efi.c. I'm attaching a (just compile tested) backport bellow.
Obviously, the 2 other commits are still required i.e. we're only dropping eeb9db09f738 ("x86/efi: Move all workarounds to a separate file quirks.c").
Cheers,
--
Lu�s
Quoted 1 line
From
41aaf1bdee7e9423a35aee310703111eef96b6b3Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Fri, 13 Jun 2014 12:39:55 +0100
Subject: [PATCH] x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced
flag
commit 44be28e9dd9880dca3e2cbf7a844f2114e67f2cb upstream.
It appears that the BayTrail-T class of hardware requires EFI in order to powerdown and reboot and no other reliable method exists.
This quirk is generally applicable to all hardware that has the ACPI Hardware Reduced bit set, since usually ACPI would be the preferred method.
[ luis: backported to 3.16:
- move changes from quirks.c into efi.c
- adjusted context ]
--- arch/x86/include/asm/efi.h | 7 +++++++ arch/x86/kernel/reboot.c | 18 ++++++++++++++++-- arch/x86/platform/efi/efi.c | 23 +++++++++++++++++++++++ drivers/firmware/efi/reboot.c | 8 ++++++++ include/linux/efi.h | 1 + 5 files changed, 55 insertions(+), 2 deletions(-)
arch/x86/include/asm/efi.h +7 -0
@@ -156,6 +156,9 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( return EFI_SUCCESS; }#endif /* CONFIG_EFI_MIXED */ + +extern bool efi_reboot_required (void ); +#else /* * IF EFI is not configured, have the EFI calls return -ENOSYS.
@@ -168,6 +171,10 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(#define efi_call5 (_f, _a1, _a2, _a3, _a4, _a5) (-ENOSYS)#define efi_call6 (_f, _a1, _a2, _a3, _a4, _a5, _a6) (-ENOSYS)static inline void parse_efi_setup (u64 phys_addr,u32 data_len) {} +static inline bool efi_reboot_required (void ) +{ +return false; +}#endif /* CONFIG_EFI */ #endif /* _ASM_X86_EFI_H */
arch/x86/kernel/reboot.c +16 -2
@@ -28,6 +28,7 @@#include <linux/mc146818rtc.h> #include <asm/realmode.h> #include <asm/x86_init.h> +#include <asm/efi.h> /* * Power off function, if any
@@ -411,12 +412,25 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {static int __init reboot_init (void ) { +int rv; +/* * Only do the DMI check if reboot_type hasn't been overridden * on the command line */ -if (reboot_default) -dmi_check_system (reboot_dmi_table); +if (!reboot_default) +return 0 ; + +/* +* The DMI quirks table takes precedence. If no quirks entry +* matches and the ACPI Hardware Reduced bit is set, force EFI +* reboot. +*/ + rv =dmi_check_system (reboot_dmi_table); + +if (!rv &&efi_reboot_required ()) + reboot_type =BOOT_EFI ; +return 0 ; }core_initcall (reboot_init);
arch/x86/platform/efi/efi.c +23 -0
@@ -44,6 +44,7 @@#include <linux/io.h> #include <linux/reboot.h> #include <linux/bcd.h> +#include <linux/acpi.h> #include <asm/setup.h> #include <asm/efi.h>
@@ -1340,3 +1341,25 @@ void __init efi_apply_memmap_quirks(void)if (is_uv_system ())set_bit (EFI_OLD_MEMMAP , &efi.flags); } + +/* +* For most modern platforms the preferred method of powering off is via +* ACPI. However, there are some that are known to require the use of +* EFI runtime services and for which ACPI does not work at all. +* +* Using EFI is a last resort, to be used only if no other option +* exists. +*/ +bool efi_reboot_required (void ) +{ +if (!acpi_gbl_reduced_hardware) +return false; + + efi_reboot_quirk_mode =EFI_RESET_WARM ; +return true; +} + +bool efi_poweroff_required (void ) +{ +return !!acpi_gbl_reduced_hardware; +}
drivers/firmware/efi/reboot.c +8 -0
@@ -5,6 +5,8 @@#include <linux/efi.h> #include <linux/reboot.h> +int efi_reboot_quirk_mode =-1 ; +void efi_reboot (enum reboot_mode reboot_mode,const char *__unused) {int efi_mode;
@@ -22,6 +24,12 @@ void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)break ; } +/* +* If a quirk forced an EFI reset mode, always use that. +*/ +if (efi_reboot_quirk_mode !=-1 ) + efi_mode = efi_reboot_quirk_mode; + efi.reset_system (efi_mode,EFI_SUCCESS ,0 ,NULL ); }
include/linux/efi.h +1 -0
@@ -876,6 +876,7 @@ extern void efi_reserve_boot_services(void);extern int efi_get_fdt_params (struct efi_fdt_params *params,int verbose);extern struct efi_memory_map memmap; +extern int efi_reboot_quirk_mode;extern bool efi_poweroff_required (void );/* Iterate through an efi_memory_map */
Quoted 44 lines · Luis Henriques
Quoted 34 lines · Ben Hutchings
Quoted 33 lines · Luis Henriques
Quoted 17 lines · Luis Henriques
Quoted 16 lines · Ben Hutchings
Quoted 14 lines · Matt Fleming
Quoted 8 lines · Ben Hutchings
Would this be a sensible addition to 3.16-stable or any older stable branch?
commit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbAuthor: Matt Fleming <[email protected]> Date: Fri Jun 13 12:39:55 2014 +0100x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag
I'm not sure what the support for ACPI hardware-reduced platforms (ASUS T100, etc) is like in the stable releases but if it does exist then yeah you probably want the above commit. The above commit should be a pretty low-risk change.
Quoted 6 lines
Quoted 6 lines
I understand that the Asus T100 at least is mostly working under 3.16.
Quoted 3 lines
Be sure to also include commit
8562c99cdd30("efi/reboot: Add generic wrapper aroundEfiResetSystem()") and commit0c5ed61adbdb("efi/reboot:
Allow powering off machines using EFI").Ok, it looks like the easy approach to bring this into 3.16 is to pick the following commits (in this order):
eeb9db09f738x86/efi: Move all workarounds to a separate filequirks.c8562c99cdd30efi/reboot: Add generic wrapper aroundEfiResetSystem()0c5ed61adbdbefi/reboot: Allow powering off machines using EFI44be28e9dd98x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flagQuoted 6 lines
Quoted 3 lines
All of these are clean cherry-picks (except for the last one that needs same really small context adjustment). If there's no objection, I'll be sending this out for review shortly.
The first one is really too big according to stable rules. Sorry I raised this; I didn't realise there were all these dependencies.
True, that commit simply moves code around but it's still huge.
Quoted 7 lines
Anyway, a different approach would be to backport
44be28e9dd98by moving the changes done toquirks.cintoefi.c. I'm attaching a (just compile tested) backport bellow.Obviously, the 2 other commits are still required i.e. we're only dropping
eeb9db09f738("x86/efi: Move all workarounds to a separate filequirks.c").
That would be my personal preference.
Ben.
Quoted 177 lines
Cheers,
--
LuísFrom
41aaf1bdee7e9423a35aee310703111eef96b6b3Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Fri, 13 Jun 2014 12:39:55 +0100
Subject: [PATCH] x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced
flagcommit
44be28e9dd9880dca3e2cbf7a844f2114e67f2cbupstream.It appears that the BayTrail-T class of hardware requires EFI in order to powerdown and reboot and no other reliable method exists.
This quirk is generally applicable to all hardware that has the ACPI Hardware Reduced bit set, since usually ACPI would be the preferred method.
Cc Len Brown <[email protected]>Cc Mark Salter <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Matt Fleming <[email protected]>Cc Ben Hutchings <[email protected]>[ luis: backported to 3.16:
- move changes fromquirks.cintoefi.c
- adjusted context ]Signed-off-by Luis Henriques <[email protected]>--- arch/x86/include/asm/efi.h | 7 +++++++ arch/x86/kernel/reboot.c | 18 ++++++++++++++++-- arch/x86/platform/efi/efi.c | 23 +++++++++++++++++++++++ drivers/firmware/efi/reboot.c | 8 ++++++++ include/linux/efi.h | 1 + 5 files changed, 55 insertions(+), 2 deletions(-)arch/x86/include/asm/efi.h +7
-0@@ -156,6 +156,9 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( return EFI_SUCCESS; }#endif /* CONFIG_EFI_MIXED */ + +extern bool efi_reboot_required (void ); +#else /* * IF EFI is not configured, have the EFI calls return -ENOSYS. @@ -168,6 +171,10 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(#define efi_call5 (_f, _a1, _a2, _a3, _a4, _a5) (-ENOSYS)#define efi_call6 (_f, _a1, _a2, _a3, _a4, _a5, _a6) (-ENOSYS)static inline void parse_efi_setup (u64 phys_addr,u32 data_len) {} +static inline bool efi_reboot_required (void ) +{ +return false; +}#endif /* CONFIG_EFI */ #endif /* _ASM_X86_EFI_H */ arch/x86/kernel/reboot.c +16
-2@@ -28,6 +28,7 @@#include <linux/mc146818rtc.h> #include <asm/realmode.h> #include <asm/x86_init.h> +#include <asm/efi.h> /* * Power off function, if any @@ -411,12 +412,25 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {static int __init reboot_init (void ) { +int rv; +/* * Only do the DMI check if reboot_type hasn't been overridden * on the command line */ -if (reboot_default) -dmi_check_system (reboot_dmi_table); +if (!reboot_default) +return 0 ; + +/* +* The DMI quirks table takes precedence. If no quirks entry +* matches and the ACPI Hardware Reduced bit is set, force EFI +* reboot. +*/ + rv =dmi_check_system (reboot_dmi_table); + +if (!rv &&efi_reboot_required ()) + reboot_type =BOOT_EFI ; +return 0 ; }core_initcall (reboot_init);arch/x86/platform/efi/efi.c +23
-0@@ -44,6 +44,7 @@#include <linux/io.h> #include <linux/reboot.h> #include <linux/bcd.h> +#include <linux/acpi.h> #include <asm/setup.h> #include <asm/efi.h> @@ -1340,3 +1341,25 @@ void __init efi_apply_memmap_quirks(void)if (is_uv_system ())set_bit (EFI_OLD_MEMMAP , &efi.flags); } + +/* +* For most modern platforms the preferred method of powering off is via +* ACPI. However, there are some that are known to require the use of +* EFI runtime services and for which ACPI does not work at all. +* +* Using EFI is a last resort, to be used only if no other option +* exists. +*/ +bool efi_reboot_required (void ) +{ +if (!acpi_gbl_reduced_hardware) +return false; + + efi_reboot_quirk_mode =EFI_RESET_WARM ; +return true; +} + +bool efi_poweroff_required (void ) +{ +return !!acpi_gbl_reduced_hardware; +}drivers/firmware/efi/reboot.c +8
-0@@ -5,6 +5,8 @@#include <linux/efi.h> #include <linux/reboot.h> +int efi_reboot_quirk_mode =-1 ; +void efi_reboot (enum reboot_mode reboot_mode,const char *__unused) {int efi_mode;@@ -22,6 +24,12 @@ void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)break ; } +/* +* If a quirk forced an EFI reset mode, always use that. +*/ +if (efi_reboot_quirk_mode !=-1 ) + efi_mode = efi_reboot_quirk_mode; + efi.reset_system (efi_mode,EFI_SUCCESS ,0 ,NULL ); }include/linux/efi.h +1
-0@@ -876,6 +876,7 @@ extern void efi_reserve_boot_services(void);extern int efi_get_fdt_params (struct efi_fdt_params *params,int verbose);extern struct efi_memory_map memmap; +extern int efi_reboot_quirk_mode;extern bool efi_poweroff_required (void );/* Iterate through an efi_memory_map */
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.