Skip to contentSkip to conversation

fix DMI for EFI

PATCH Brian Maly 4 participants 14 messages Mar 1, 2009 – Mar 5, 2009 x86

lore
Share & tools
lore

Brian Maly

author
#0 lore raw

Updated patch. Might be good for someone who runs VMware to verify things still work though. Looks right now I think.

Brian

Quoted 5 lines

This init_hypervisor comment looks important, no? Possibly it needs to be moved after the new placement? Doesn't look like the probe_roms will be an issue.

regards, Kyle

arch/x86/kernel/setup.c +10 -10
@@ -770,16 +770,6 @@ void __init setup_arch(char **cmdline_p)
 
 	finish_e820_parsing();
 
-	dmi_scan_machine();
-
-	dmi_check_system(bad_bios_dmi_table);
-
-	/*
-	 * VMware detection requires dmi to be available, so this
-	 * needs to be done after dmi_scan_machine, for the BP.
-	 */
-	init_hypervisor(&boot_cpu_data);
-
 #ifdef CONFIG_X86_32
 	probe_roms();
 #endif
@@ -792,6 +782,16 @@ void __init setup_arch(char **cmdline_p)
 	if (efi_enabled)
 		efi_init();
 
+	dmi_scan_machine();
+	
+	dmi_check_system(bad_bios_dmi_table);
+
+	/*
+	 * VMware detection requires dmi to be available, so this
+	 * needs to be done after dmi_scan_machine, for the BP.
+	 */
+	init_hypervisor(&boot_cpu_data);
+
 #ifdef CONFIG_X86_32
 	if (ppro_with_ram_bug()) {
 		e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
#1 lore raw

it will break dmi check for 64k ram corruption...

YH

author
#2 lore raw

probe_roms() needs to be after dmi?

Brian

Quoted 5 lines · Yinghai Lu

it will break dmi check for 64k ram corruption...

YH

#3 lore raw

please use git log -p arch/x86/kernel/setup.c to check the history...

YH

commit 2216d199b1430d1c0affb1498a9ebdbd9c0de439

Author: Yinghai Lu <[email protected]>
Date:   Mon Sep 22 02:52:26 2008 -0700

x86: fix CONFIG_X86_RESERVE_LOW_64K=y

The bad_bios_dmi_table() quirk never triggered because we do DMI setup too late. Move it a bit earlier.

Also change the CONFIG_X86_RESERVE_LOW_64K quirk to operate on the e820 table directly instead of messing with early reservations - this handles overlaps (which do occur in this low range of RAM) more gracefully.

arch/x86/kernel/setup.c +0 -0
index 161f1b3..d29951c 100644
@@ -735,7 +735,8 @@ static int __init dmi_low_memory_corruption(const

struct dmi_system_id *d)
"%s detected: BIOS may corrupt low RAM, working it around.\n", d->ident);

-       reserve_early_overlap_ok(0x0, 0x10000, "BIOS quirk");
+       e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
+       sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
        return 0;
 }
@@ -784,8 +785,6 @@ void __init setup_arch(char **cmdline_p)
        printk(KERN_INFO "Command line: %s\n", boot_command_line);

#endif

- dmi_check_system(bad_bios_dmi_table);
-

        early_cpu_init();
        early_ioremap_init();

@@ -880,6 +879,10 @@ void __init setup_arch(char **cmdline_p)

        finish_e820_parsing();

+ dmi_scan_machine();
+
+ dmi_check_system(bad_bios_dmi_table);
+

 #ifdef CONFIG_X86_32
        probe_roms();
 #endif
@@ -967,8 +970,6 @@ void __init setup_arch(char **cmdline_p)
        vsmp_init();

#endif

- dmi_scan_machine();
-

        io_delay_init();
author
#4 lore raw

Thanks. At this point maybe its easier just to move efi_init instead. Ill re-work, test and post a followup...

Brian

Quoted 63 lines · Yinghai Lu

please use git log -p arch/x86/kernel/setup.c to check the history...

YH

commit 2216d199b1430d1c0affb1498a9ebdbd9c0de439

Author: Yinghai Lu <[email protected]>
Date:   Mon Sep 22 02:52:26 2008 -0700

x86: fix CONFIG_X86_RESERVE_LOW_64K=y

The bad_bios_dmi_table() quirk never triggered because we do DMI setup too late. Move it a bit earlier.

Also change the CONFIG_X86_RESERVE_LOW_64K quirk to operate on the e820 table directly instead of messing with early reservations - this handles overlaps (which do occur in this low range of RAM) more gracefully.

arch/x86/kernel/setup.c +2 -1
index 161f1b3..d29951c 100644
@@ -735,7 +735,8 @@ static int __init dmi_low_memory_corruption(const
 struct dmi_system_id *d)
                "%s detected: BIOS may corrupt low RAM, working it around.\n",
                d->ident);
 
-       reserve_early_overlap_ok(0x0, 0x10000, "BIOS quirk");
+       e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
+       sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 
        return 0;

}

arch/x86/kernel/setup.c +4 -4
@@ -784,8 +785,6 @@ void __init setup_arch(char **cmdline_p)
        printk(KERN_INFO "Command line: %s\n", boot_command_line);
 #endif
 
-       dmi_check_system(bad_bios_dmi_table);
-
        early_cpu_init();
        early_ioremap_init();
 
@@ -880,6 +879,10 @@ void __init setup_arch(char **cmdline_p)
 
        finish_e820_parsing();
 
+       dmi_scan_machine();
+
+       dmi_check_system(bad_bios_dmi_table);
+
 #ifdef CONFIG_X86_32
        probe_roms();
 #endif
@@ -967,8 +970,6 @@ void __init setup_arch(char **cmdline_p)
        vsmp_init();
 #endif
 
-       dmi_scan_machine();
-
        io_delay_init();
 
author
#5 lore raw
In reply to Yinghai Lu

New patch. Its easier I think to just move efi_init() earlier. Seems less risky and less drawbacks.

setup.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/setup.c +3 -2
@@ -770,6 +770,9 @@ void __init setup_arch(char **cmdline_p)
 
 	finish_e820_parsing();
 
+	if (efi_enabled)
+		efi_init();
+
 	dmi_scan_machine();
 
 	dmi_check_system(bad_bios_dmi_table);
@@ -789,8 +792,6 @@ void __init setup_arch(char **cmdline_p)
 	insert_resource(&iomem_resource, &data_resource);
 	insert_resource(&iomem_resource, &bss_resource);
 
-	if (efi_enabled)
-		efi_init();
 
 #ifdef CONFIG_X86_32
 	if (ppro_with_ram_bug()) {
#6 lore raw
Quoted 14 lines · Brian Maly

New patch. Its easier I think to just move efi_init() earlier. Seems less risky and less drawbacks.

setup.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 776

Quoted 7 lines
arch/x86/kernel/setup.c +3 -0
@@ -770,6 +770,9 @@ void __init setup_arch(char **cmdline_p)
 
 	finish_e820_parsing();
 
+	if (efi_enabled)
+		efi_init();
+
 	dmi_scan_machine();

Hm, could we ever find ourselves in the positition of having to access the DMI strings table in the EFI init code, to implement a quirk? I think that's quite plausible.

OTOH, with some DMI quirks in EFI tables it's a bit of a chicken and egg problem. Can DMI strings ever be outside of EFI tables on EFI systems?

Ingo

author
#7 lore raw
Quoted 7 lines

Hm, could we ever find ourselves in the positition of having to access the DMI strings table in the EFI init code, to implement a quirk? I think that's quite plausible.

OTOH, with some DMI quirks in EFI tables it's a bit of a chicken and egg problem. Can DMI strings ever be outside of EFI tables on EFI systems?

Ingo

Right now it is EFI that loads the dmi tables (and all other tables such as ACPI), so it is a chicken and the egg. I think that if dmi is ever needed by EFI, the dmi scan will have to be moved inside efi_init. We could move the dmi scan into efi_init and do the dmi scan the moment we have the dmi table. Thats really the soonest point we could scan on EFI systems. Im OK with moving dmi to efi_init if you prefer.

Brian

#8 lore raw
Quoted 12 lines · Brian Maly
Quoted 11 lines

Hm, could we ever find ourselves in the positition of having to access the DMI strings table in the EFI init code, to implement a quirk? I think that's quite plausible.

OTOH, with some DMI quirks in EFI tables it's a bit of a chicken and egg problem. Can DMI strings ever be outside of EFI tables on EFI systems?

Ingo

Quoted 7 lines

Right now it is EFI that loads the dmi tables (and all other tables such as ACPI), so it is a chicken and the egg. I think that if dmi is ever needed by EFI, the dmi scan will have to be moved inside efi_init. We could move the dmi scan into efi_init and do the dmi scan the moment we have the dmi table. Thats really the soonest point we could scan on EFI systems. Im OK with moving dmi to efi_init if you prefer.

Your patch looks fine, but i'd like to hear the opinion of Ying Huang as well.

Ingo

author
#9 lore raw
Quoted 1 line

Your patch looks fine, but i'd like to hear the opinion of Ying Huang as well.

I had asked him to look at this before I posted and he had no objections. He may have an opinion on moving dmi scan into efi_init, though this can certainly be done later if and when needed.

Brian

#10 lore raw
Quoted 8 lines · Brian Maly
Quoted 2 lines

Your patch looks fine, but i'd like to hear the opinion of Ying Huang as well.

I had asked him to look at this before I posted and he had no objections. He may have an opinion on moving dmi scan into efi_init, though this can certainly be done later if and when needed.

No, i think your patch is fine as-is - moving the dmi scan to EFI init just makes EFI bootstrap a bit less standard - hence a bit more fragile - and that's never good.

Since your patch fixes real issues on Apple hardware i also queued it up in tip:x86/urgent for .29-rc8.

Ingo

#11 lore raw
In reply to Ingo Molnar
Quoted 22 lines · Ingo Molnar
Quoted 12 lines · Brian Maly
Quoted 11 lines

Hm, could we ever find ourselves in the positition of having to access the DMI strings table in the EFI init code, to implement a quirk? I think that's quite plausible.

OTOH, with some DMI quirks in EFI tables it's a bit of a chicken and egg problem. Can DMI strings ever be outside of EFI tables on EFI systems?

Ingo

Quoted 7 lines

Right now it is EFI that loads the dmi tables (and all other tables such as ACPI), so it is a chicken and the egg. I think that if dmi is ever needed by EFI, the dmi scan will have to be moved inside efi_init. We could move the dmi scan into efi_init and do the dmi scan the moment we have the dmi table. Thats really the soonest point we could scan on EFI systems. Im OK with moving dmi to efi_init if you prefer.

Quoted 2 lines

Your patch looks fine, but i'd like to hear the opinion of Ying Huang as well.

This patch is OK for me.

Thanks,
Huang Ying

#12 lore raw
Quoted 23 lines · Huang Ying
Quoted 22 lines · Ingo Molnar
Quoted 19 lines · Brian Maly
Quoted 11 lines

Hm, could we ever find ourselves in the positition of having to access the DMI strings table in the EFI init code, to implement a quirk? I think that's quite plausible.

OTOH, with some DMI quirks in EFI tables it's a bit of a chicken and egg problem. Can DMI strings ever be outside of EFI tables on EFI systems?

Ingo

Right now it is EFI that loads the dmi tables (and all other tables such as ACPI), so it is a chicken and the egg. I think that if dmi is ever needed by EFI, the dmi scan will have to be moved inside efi_init. We could move the dmi scan into efi_init and do the dmi scan the moment we have the dmi table. Thats really the soonest point we could scan on EFI systems. Im OK with moving dmi to efi_init if you prefer.

Quoted 4 lines
Quoted 2 lines

Your patch looks fine, but i'd like to hear the opinion of Ying Huang as well.

This patch is OK for me.

thanks. There are two EFI patches queued up for .29:

dd39ecf: x86: EFI: Back efi_ioremap with init_memory_mapping instead of FIX_MAP
ff0c087: x86: fix DMI on EFI

Ingo

author
#13 lore raw

[tip:x86/urgent] x86: fix DMI on EFI

In reply to Brian Maly
Commit-ID:  ff0c0874905fb312ca1491bbdac2653b0b48c20b
Gitweb:     http://git.kernel.org/tip/ff0c0874905fb312ca1491bbdac2653b0b48c20b
Author:     "Brian Maly" <[email protected]>
AuthorDate: Tue, 3 Mar 2009 21:55:31 -0500
Commit:     Ingo Molnar <[email protected]>
CommitDate: Wed, 4 Mar 2009 18:55:56 +0100

x86: fix DMI on EFI

Impact: reactivate DMI quirks on EFI hardware

DMI tables are loaded by EFI, so the dmi calls must happen after efi_init() and not before.

Currently Apple hardware uses DMI to determine the framebuffer mappings for efifb. Without DMI working you also have no video on MacBook Pro.

This patch resolves the DMI issue for EFI hardware (DMI is now properly detected at boot), and additionally efifb now loads on Apple hardware (i.e. video works).

LKML-Reference: <[email protected]>

 arch/x86/kernel/setup.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
 arch/x86/kernel/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/setup.c +3 -2
index c461f6d..6a8811a 100644
@@ -770,6 +770,9 @@ void __init setup_arch(char **cmdline_p)
 
 	finish_e820_parsing();
 
+	if (efi_enabled)
+		efi_init();
+
 	dmi_scan_machine();
 
 	dmi_check_system(bad_bios_dmi_table);
@@ -789,8 +792,6 @@ void __init setup_arch(char **cmdline_p)
 	insert_resource(&iomem_resource, &data_resource);
 	insert_resource(&iomem_resource, &bss_resource);
 
-	if (efi_enabled)
-		efi_init();
 
 #ifdef CONFIG_X86_32
 	if (ppro_with_ram_bug()) {