* [PATCH 1/2] x86: Unify reboot_type selection
[not found] ` <alpine.LFD.2.00.1001200007560.4265@localhost.localdomain>
@ 2010-01-21 17:18 ` Christian Hofstaedtler
2010-01-21 17:18 ` [PATCH 2/2] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
2010-01-21 18:29 ` [PATCH 1/2] x86: Unify reboot_type selection H. Peter Anvin
2010-01-21 17:24 ` [PATCH] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
1 sibling, 2 replies; 5+ messages in thread
From: Christian Hofstaedtler @ 2010-01-21 17:18 UTC (permalink / raw)
To: x86
Cc: hpa, lenb, tglx, linux-acpi, venkatesh.pallipadi, arjan,
bruce.w.allan, linux-kernel, Christian Hofstaedtler
Unify x86_32-only and x86_32+x86_64 reboot quirks selection functions,
so the code path is a bit easier to understand and gets a predefined
execution order.
Signed-off-by: Christian Hofstaedtler <ch@zeha.at>
---
arch/x86/include/asm/emergency-restart.h | 1 +
arch/x86/kernel/reboot.c | 43 +++++++++++++++++++++---------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/arch/x86/include/asm/emergency-restart.h b/arch/x86/include/asm/emergency-restart.h
index cc70c1c..72ee23a 100644
--- a/arch/x86/include/asm/emergency-restart.h
+++ b/arch/x86/include/asm/emergency-restart.h
@@ -2,6 +2,7 @@
#define _ASM_X86_EMERGENCY_RESTART_H
enum reboot_type {
+ BOOT_UNDECIDED = '?',
BOOT_TRIPLE = 't',
BOOT_KBD = 'k',
#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 1545bc0..36f0c86 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -34,7 +34,7 @@ EXPORT_SYMBOL(pm_power_off);
static const struct desc_ptr no_idt = {};
static int reboot_mode;
-enum reboot_type reboot_type = BOOT_KBD;
+enum reboot_type reboot_type = BOOT_UNDECIDED;
int reboot_force;
#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
@@ -134,7 +134,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
return 0;
}
-static struct dmi_system_id __initdata reboot_dmi_table[] = {
+/*
+ * This table only gets used on x86_32, so only use with
+ * set_bios_reboot.
+ */
+static struct dmi_system_id __initdata reboot_dmi_table_x86_32[] = {
{ /* Handle problems with rebooting on Dell E520's */
.callback = set_bios_reboot,
.ident = "Dell E520",
@@ -270,13 +274,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
{ }
};
-static int __init reboot_init(void)
-{
- dmi_check_system(reboot_dmi_table);
- return 0;
-}
-core_initcall(reboot_init);
-
/* The following code and data reboots the machine by switching to real
mode and jumping to the BIOS reset entry point, as if the CPU has
really been reset. The previous version asked the keyboard
@@ -427,7 +424,8 @@ static int __init set_pci_reboot(const struct dmi_system_id *d)
return 0;
}
-static struct dmi_system_id __initdata pci_reboot_dmi_table[] = {
+/* This table gets used on x86_32 AND x86_64. */
+static struct dmi_system_id __initdata reboot_dmi_table_all[] = {
{ /* Handle problems with rebooting on Apple MacBook5 */
.callback = set_pci_reboot,
.ident = "Apple MacBook5",
@@ -455,12 +453,30 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = {
{ }
};
-static int __init pci_reboot_init(void)
+/* Decide how we will reboot:
+ * - Check the X86_32-only quirks table.
+ * - Check the generic quirks table.
+ * - Default to old-style Keyboard Controller reboot.
+ */
+static int __init reboot_init(void)
{
- dmi_check_system(pci_reboot_dmi_table);
+ /* don't override user decisions (reboot=...) */
+ if (reboot_type != BOOT_UNDECIDED)
+ return 0;
+
+#ifdef CONFIG_X86_32
+ dmi_check_system(reboot_dmi_table_x86_32);
+#endif /* CONFIG_X86_32 */
+ dmi_check_system(reboot_dmi_table_all);
+
+ if (reboot_type != BOOT_UNDECIDED)
+ return 0;
+
+ reboot_type = BOOT_KBD;
+
return 0;
}
-core_initcall(pci_reboot_init);
+core_initcall(reboot_init);
static inline void kb_wait(void)
{
@@ -534,6 +550,7 @@ static void native_machine_emergency_restart(void)
for (;;) {
/* Could also try the reset bit in the Hammer NB */
switch (reboot_type) {
+ case BOOT_UNDECIDED:
case BOOT_KBD:
mach_reboot_fixups(); /* for board specific fixups */
--
1.6.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Default to ACPI reboots on newish X86 hardware
2010-01-21 17:18 ` [PATCH 1/2] x86: Unify reboot_type selection Christian Hofstaedtler
@ 2010-01-21 17:18 ` Christian Hofstaedtler
2010-01-23 19:57 ` Len Brown
2010-01-21 18:29 ` [PATCH 1/2] x86: Unify reboot_type selection H. Peter Anvin
1 sibling, 1 reply; 5+ messages in thread
From: Christian Hofstaedtler @ 2010-01-21 17:18 UTC (permalink / raw)
To: x86
Cc: hpa, lenb, tglx, linux-acpi, venkatesh.pallipadi, arjan,
bruce.w.allan, linux-kernel, Christian Hofstaedtler
Newer hardware reportedly can no longer successfully reboot using the
keyboard controller, but needs to use ACPI instead.
To not cause problems with older hardware, only hardware with a BIOS
date 2003 or newer is considered for this choice.
Broken BIOSes (no DMI BIOS date, or BIOS date of 0) also get ACPI
reboots, but those will auto fallback to KBD reboots, as ACPI won't get
enabled without acpi=force.
---
arch/x86/kernel/reboot.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 36f0c86..919453a 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -453,10 +453,33 @@ static struct dmi_system_id __initdata reboot_dmi_table_all[] = {
{ }
};
+/* See if the Hardware is new enough to support ACPI reboots. */
+static int __init reboot_acpi_likey_supported(void)
+{
+ int year;
+
+ /* No BIOS date? We can safely say "Yes" here, because ACPI-reboot
+ * will only work when acpi=force was specified, else it falls back
+ * to KBD-reboots anyway. */
+ if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
+ return 1;
+ }
+ if (year == 0) {
+ return 1;
+ }
+
+ /* 2003 was decided as the cut-off year. */
+ if (year < 2003) {
+ return 0;
+ }
+ return 1;
+}
+
/* Decide how we will reboot:
* - Check the X86_32-only quirks table.
* - Check the generic quirks table.
- * - Default to old-style Keyboard Controller reboot.
+ * - Check if we could use ACPI-based reboot.
+ * - Fall back to old-style Keyboard Controller reboot.
*/
static int __init reboot_init(void)
{
@@ -472,7 +495,12 @@ static int __init reboot_init(void)
if (reboot_type != BOOT_UNDECIDED)
return 0;
- reboot_type = BOOT_KBD;
+ if (reboot_acpi_likey_supported()) {
+ reboot_type = BOOT_ACPI;
+ } else {
+ printk(KERN_INFO "Selecting old-style reboot for older hardware\n");
+ reboot_type = BOOT_KBD;
+ }
return 0;
}
--
1.6.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Default to ACPI reboots on newish X86 hardware
[not found] ` <alpine.LFD.2.00.1001200007560.4265@localhost.localdomain>
2010-01-21 17:18 ` [PATCH 1/2] x86: Unify reboot_type selection Christian Hofstaedtler
@ 2010-01-21 17:24 ` Christian Hofstaedtler
1 sibling, 0 replies; 5+ messages in thread
From: Christian Hofstaedtler @ 2010-01-21 17:24 UTC (permalink / raw)
To: Len Brown
Cc: x86, hpa, tglx, linux-acpi, venkatesh.pallipadi, arjan,
bruce.w.allan, linux-kernel
Len,
* Len Brown <lenb@kernel.org> [100120 06:21]:
> On Thu, 7 Jan 2010, Christian Hofstaedtler wrote:
>
> Thanks for writing this patch Christian,
> it is something that has been unsettled for
> a long time and it will be great to close the issue.
>
> > Newer hardware is assumed to no longer reboot succesfully using the
> > keyboard controller, but needs to use ACPI instead.
> > To not cause problems with older hardware, only hardware with a BIOS
> > date 2006 or newer is considered for this choice. Broken BIOSes
> > reporting a BIOS date of 0 are not specially considered, and therefore
> > get the KBD reboot behaviour.
> >
> > Also unifiy reboot_type selection code.
>
> Please split the patch in two patches:
>
> 1. cleanup w/o policy change
> 2. policy change w/o cleanup
>
> better if the policy change is #2, so if we need to revert it
> we don't have to revert the cleanup too.
Please find the splitted patch in reply to your mail.
> > Signed-off-by: Christian Hofstaedtler <ch@zeha.at>
> > ---
> > arch/x86/include/asm/emergency-restart.h | 1 +
> > arch/x86/kernel/reboot.c | 65 ++++++++++++++++++++++++------
> > 2 files changed, 53 insertions(+), 13 deletions(-)
>
>
> > +/* See if the Hardware is new enough to support ACPI reboots. */
> > +static int __init reboot_acpi_likey_supported(void)
> > +{
> > + int year;
> > +
> > + /* Doesn't exist? Likely an old system */
> > + if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
> > + return 0;
> > + }
>
> I think it may be better to simply return 1 in this case.
>
> While we have seen dmi_get_date() fail in practice on "modern" machines,
> if CONFIG_ACPI_BLACKLIST_YEAR is set, we will already punish users by
> disabling ACPI and making them invoke acpi=force.
>
> So the effect of this check is to disable ACPI-reset
> on systems where the user has likely already invoked acpi=force --
> which seems somewhat counter-intuitive.
Okay; I've also re-added the check for year==0, so these machines
get the same behaviour.
> > + /* 2006 was decided as the cut-off year. */
> > + if (year < 2006) {
> > + return 0;
> > + }
>
> I'd rather see 2003.
> If we run into trouble, it is a 1-liner to move it forward.
> But I think we'll probably do fine with anything newer than 2001.
Made this 2003.
> thanks,
> Len Brown, Intel Open Source Technolgy Center
Christian
--
christian hofstaedtler
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] x86: Unify reboot_type selection
2010-01-21 17:18 ` [PATCH 1/2] x86: Unify reboot_type selection Christian Hofstaedtler
2010-01-21 17:18 ` [PATCH 2/2] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
@ 2010-01-21 18:29 ` H. Peter Anvin
1 sibling, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2010-01-21 18:29 UTC (permalink / raw)
To: Christian Hofstaedtler
Cc: x86, lenb, tglx, linux-acpi, venkatesh.pallipadi, arjan,
bruce.w.allan, linux-kernel
On 01/21/2010 09:18 AM, Christian Hofstaedtler wrote:
> Unify x86_32-only and x86_32+x86_64 reboot quirks selection functions,
> so the code path is a bit easier to understand and gets a predefined
> execution order.
>
> -static struct dmi_system_id __initdata reboot_dmi_table[] = {
> +/*
> + * This table only gets used on x86_32, so only use with
> + * set_bios_reboot.
> + */
> +static struct dmi_system_id __initdata reboot_dmi_table_x86_32[] = {
> { /* Handle problems with rebooting on Dell E520's */
> .callback = set_bios_reboot,
> .ident = "Dell E520",
> @@ -270,13 +274,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
> { }
> };
>
I think it would make more sense to just #ifdef off a section of a
single table, instead of having an #ifdef for a separate table and an
#ifdef for a table entry.
I don't know how big these tables are -- this is initdata after all, so
unless the tables are really small, we could just make set_bios_reboot a
noop on x86-64.
-hpa
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Default to ACPI reboots on newish X86 hardware
2010-01-21 17:18 ` [PATCH 2/2] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
@ 2010-01-23 19:57 ` Len Brown
0 siblings, 0 replies; 5+ messages in thread
From: Len Brown @ 2010-01-23 19:57 UTC (permalink / raw)
To: Christian Hofstaedtler
Cc: x86, hpa, tglx, linux-acpi, venkatesh.pallipadi, arjan,
bruce.w.allan, linux-kernel
Hi Christian,
I've replaced your previous patch in the acpi-test tree with this
refreshed pair.
Note that the 2nd patch had some checkpatch issues.
Perhaps you can run checkpatch before sending future patches.
WARNING: braces {} are not necessary for single statement blocks
#35: FILE: arch/x86/kernel/reboot.c:464:
+ if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
+ return 1;
+ }
WARNING: braces {} are not necessary for single statement blocks
#38: FILE: arch/x86/kernel/reboot.c:467:
+ if (year == 0) {
+ return 1;
+ }
WARNING: braces {} are not necessary for single statement blocks
#43: FILE: arch/x86/kernel/reboot.c:472:
+ if (year < 2003) {
+ return 0;
+ }
ERROR: Missing Signed-off-by: line(s)
total: 1 errors, 3 warnings, 47 lines checked
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-23 19:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <alpine.LFD.2.00.1001061433260.4086@localhost.localdomain>
[not found] ` <1262894593-25563-1-git-send-email-ch@zeha.at>
[not found] ` <alpine.LFD.2.00.1001200007560.4265@localhost.localdomain>
2010-01-21 17:18 ` [PATCH 1/2] x86: Unify reboot_type selection Christian Hofstaedtler
2010-01-21 17:18 ` [PATCH 2/2] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
2010-01-23 19:57 ` Len Brown
2010-01-21 18:29 ` [PATCH 1/2] x86: Unify reboot_type selection H. Peter Anvin
2010-01-21 17:24 ` [PATCH] Default to ACPI reboots on newish X86 hardware Christian Hofstaedtler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox