[PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32

From: Bjorn Helgaas
Date: Wed Apr 07 2010 - 17:06:40 EST



Currently, we only reserve the legacy VGA area [mem 0xa0000-0xbffff] on
x86_32. But this legacy area is also used on x86_64, so this patch
reserves it there, too.

If we don't reserve it, we may mistakenly move a PCI device to that area,
as we did here:

pci_root PNP0A03:00: host bridge window [mem 0xff980800-0xff980bff]
pci_root PNP0A03:00: host bridge window [mem 0xff97c000-0xff97ffff]
pci 0000:00:1f.2: no compatible bridge window for [mem 0xff970000-0xff9707ff]
pci 0000:00:1f.2: BAR 5: assigned [mem 0x000a0000-0x000a07ff]

as reported by Andy Isaacson at http://lkml.org/lkml/2010/4/6/375

I think the fact that the BAR is not within a host bridge window is a
BIOS defect, and it's now more visible because we have "pci=use_crs" as
the default. Using "pci=nocrs" is a workaround, because then we won't
attempt to move the device.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
---

arch/x86/include/asm/setup.h | 1 -
arch/x86/kernel/head32.c | 3 +--
arch/x86/kernel/setup.c | 25 ++++++++-----------------
3 files changed, 9 insertions(+), 20 deletions(-)


diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 86b1506..f4c0fe4 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -44,7 +44,6 @@ static inline void visws_early_detect(void) { }
extern unsigned long saved_video_mode;

extern void reserve_standard_io_resources(void);
-extern void i386_reserve_resources(void);
extern void setup_default_timer_irq(void);

#ifdef CONFIG_X86_MRST
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index b2e2460..b6de8f8 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -20,9 +20,8 @@

static void __init i386_default_early_setup(void)
{
- /* Initilize 32bit specific setup functions */
+ /* Initialize 32bit specific setup functions */
x86_init.resources.probe_roms = probe_roms;
- x86_init.resources.reserve_resources = i386_reserve_resources;
x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;

reserve_ebda_region();
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 9570541..24d9113 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -575,6 +575,13 @@ static struct resource standard_io_resources[] = {
.flags = IORESOURCE_BUSY | IORESOURCE_IO }
};

+static struct resource video_ram_resource = {
+ .name = "Video RAM area",
+ .start = 0xa0000,
+ .end = 0xbffff,
+ .flags = IORESOURCE_BUSY | IORESOURCE_MEM
+};
+
void __init reserve_standard_io_resources(void)
{
int i;
@@ -583,6 +590,7 @@ void __init reserve_standard_io_resources(void)
for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
request_resource(&ioport_resource, &standard_io_resources[i]);

+ request_resource(&iomem_resource, &video_ram_resource);
}

/*
@@ -1042,20 +1050,3 @@ void __init setup_arch(char **cmdline_p)

mcheck_init();
}
-
-#ifdef CONFIG_X86_32
-
-static struct resource video_ram_resource = {
- .name = "Video RAM area",
- .start = 0xa0000,
- .end = 0xbffff,
- .flags = IORESOURCE_BUSY | IORESOURCE_MEM
-};
-
-void __init i386_reserve_resources(void)
-{
- request_resource(&iomem_resource, &video_ram_resource);
- reserve_standard_io_resources();
-}
-
-#endif /* CONFIG_X86_32 */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/