All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32
@ 2010-04-07 21:06 Bjorn Helgaas
  2010-04-07 22:45 ` Yinghai
  2010-04-08 21:40 ` Andy Isaacson
  0 siblings, 2 replies; 125+ messages in thread
From: Bjorn Helgaas @ 2010-04-07 21:06 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-pci, x86, linux-kernel, Andy Isaacson, Yinghai Lu,
	Thomas Renninger


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@hp.com>
---

 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 */


^ permalink raw reply related	[flat|nested] 125+ messages in thread
* Re: [PATCH] x86/PCI: never allocate PCI MMIO resources below   BIOS_END
@ 2010-04-26 23:02 H. Peter Anvin
  2010-04-26 23:25 ` Jesse Barnes
  0 siblings, 1 reply; 125+ messages in thread
From: H. Peter Anvin @ 2010-04-26 23:02 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: Bjorn Helgaas, Andy Isaacson, R. Andrew Bailey, Yinghai,
	Thomas Gleixner, Ingo Molnar, guenter.roeck, Linus Torvalds,
	linux-pci, x86, linux-kernel, Thomas Renninger, yaneti

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

I don't think it's sufficient, actually.  We regularly see machines where devices point into e820_reserved memory above 1 MB - because it's a platform device or because firmware (e.g. smm) is touching the device.  I think Bjorn's fix is great for .34, but longer term I think we need to structure the code to actually handle reserved regions differently from occupied/forbidden regions.

"Jesse Barnes" <jbarnes@virtuousgeek.org> wrote:

>On Mon, 26 Apr 2010 14:44:50 -0700
>"H. Peter Anvin" <hpa@zytor.com> wrote:
>
>> >
>> > Agreed.  The trickier part is handling any platform devices that
>> > request_resource against that space.  But maybe we don't need to do
>> > anything special; just making sure we avoid it in the PCI "BIOS" code
>> > as Bjorn did may be sufficient.
>> >
>> 
>> Why is that hard?  If a platform device does a request_resource against
>> that space, it's a request for specific address space and it should be
>> granted.
>
>I was thinking if we made it a special resource type we'd have to
>change any platform drivers to use it; i.e. it wouldn't be
>IORESOURCE_MEM or IORESOURCE_IO but IORESOURCE_DRAGONS.  That way it
>wouldn't be part of the normal resource space.
>
>But that's definitely overkill.  I think Bjorn's fix is sufficient.
>
>-- 
>Jesse Barnes, Intel Open Source Technology Center

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 125+ messages in thread
* Re: [PATCH] x86/PCI: never allocate PCI MMIO resources below    BIOS_END
@ 2010-04-27  2:02 H. Peter Anvin
  0 siblings, 0 replies; 125+ messages in thread
From: H. Peter Anvin @ 2010-04-27  2:02 UTC (permalink / raw)
  To: Jesse Barnes, Linus Torvalds
  Cc: Bjorn Helgaas, Andy Isaacson, R. Andrew Bailey, Yinghai,
	Thomas Gleixner, Ingo Molnar, guenter.roeck, linux-pci, x86,
	linux-kernel, Thomas Renninger, yaneti

[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]

The 1 MB range is only one case of a prereserved space.  It's special only in the sense that it is *always* reserved, even if the map doesn't mark it as such.  Fixed (or SMM-used) resources in reserved space above 1 MB are exactly the same issue.

"Jesse Barnes" <jbarnes@virtuousgeek.org> wrote:

>On Mon, 26 Apr 2010 18:27:27 -0700 (PDT)
>Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>> 
>> 
>> On Mon, 26 Apr 2010, Jesse Barnes wrote:
>> > 
>> > Glad we agree.  As I said (and echoing Bjorn), I think it would be best
>> > to reserve this space in a way that doesn't just use IORESOURCE_BUSY.
>> > We want and need to do allocations from the special region, so we
>> > should mark it as such.
>> 
>> I think Bjorn's patch to pcibios_align_resource() is really good and 
>> clever, and I think it should take care of the need for IORESOURCE_BUSY, 
>> no? We do want to let devices that are _already_ allocated there insert 
>> their resources, it's just that we never want to allocate new ones in the 
>> low 1M region.
>> 
>> Do we actually have a regression left with Bjorn's patch?
>
>No, I think we're covered.  But it sounded like Peter was also
>concerned about making new allocations from the 1M space, which would
>mean we'd need something other than the IORESOURCE_BUSY bit.  But maybe
>Bjorn's patch plus simply removing the IORESOURCE_BUSY line is
>sufficient for that.  The downside there is that it doesn't clearly
>communicate the special nature of the 1M region.
>
>-- 
>Jesse Barnes, Intel Open Source Technology Center

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 125+ messages in thread

end of thread, other threads:[~2010-04-28 19:23 UTC | newest]

Thread overview: 125+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07 21:06 [PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32 Bjorn Helgaas
2010-04-07 22:45 ` Yinghai
2010-04-07 23:05   ` Bjorn Helgaas
2010-04-07 23:22     ` Yinghai
2010-04-08  3:24       ` Bjorn Helgaas
2010-04-08  4:42         ` H. Peter Anvin
2010-04-08 13:04           ` Bjorn Helgaas
2010-04-09 16:04       ` Bjorn Helgaas
2010-04-09 16:44         ` H. Peter Anvin
2010-04-09 17:22           ` Yinghai
2010-04-09 18:23             ` H. Peter Anvin
2010-04-09 18:55               ` Guenter Roeck
2010-04-09 19:55                 ` Yinghai
2010-04-09 22:21                   ` Andy Isaacson
2010-04-09 22:27                     ` Yinghai Lu
2010-04-09 22:35                       ` Andy Isaacson
2010-04-09 22:44                         ` H. Peter Anvin
2010-04-09 22:54                           ` Yinghai
2010-04-09 23:01                         ` Yinghai
2010-04-10  0:00                           ` Andy Isaacson
2010-04-10  1:10                             ` Yinghai
2010-04-10  1:43                               ` Andy Isaacson
2010-04-10  1:48                                 ` Yinghai
2010-04-10  1:57                                   ` Andy Isaacson
2010-04-10  2:46                                     ` Yinghai
2010-04-12 18:54                                       ` Andy Isaacson
2010-04-12 19:34                                         ` Yinghai
2010-04-12 19:48                                           ` Andy Isaacson
2010-04-12 19:55                                             ` yinghai.lu
2010-04-12 20:02                                           ` Andy Isaacson
2010-04-12 22:32                                             ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-13 21:02                                               ` Bjorn Helgaas
2010-04-13 21:08                                                 ` Yinghai
2010-04-13 21:09                                                 ` H. Peter Anvin
2010-04-13 21:11                                                   ` Yinghai
2010-04-13 21:18                                                     ` H. Peter Anvin
2010-04-13 21:22                                                       ` [PATCH -v3 1/3] " Yinghai
2010-04-23 23:30                                                         ` H. Peter Anvin
2010-04-26 15:35                                                           ` Jesse Barnes
2010-04-13 21:23                                                       ` [PATCH -v3 2/3] x86,pci, acpi: host bridge windows inherit BUSY flag from parent Yinghai
2010-04-13 21:24                                                       ` [PATCH -v3 3/3] pci: don't allocate from a BUSY bus resource Yinghai
2010-04-13 21:42                                                       ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-13 21:58                                                         ` H. Peter Anvin
2010-04-13 22:29                                                           ` Yinghai
2010-04-13 22:39                                                             ` Yinghai
2010-04-13 22:41                                                             ` H. Peter Anvin
2010-04-13 22:58                                                               ` Yinghai
2010-04-13 23:02                                                                 ` H. Peter Anvin
2010-04-13 23:03                                                                   ` Yinghai
2010-04-13 23:07                                                                     ` H. Peter Anvin
2010-04-13 23:09                                                                       ` Yinghai
2010-04-21  5:33                                                                         ` [PATCH -v4 1/3] " Yinghai
2010-04-21  5:34                                                                           ` [PATCH 2/3] x86, resource: Add reserve_region_with_split_check_child() Yinghai
2010-04-21  5:35                                                                           ` [PATCH 3/3] x86,pci,acpi: Handle invalid _CRS Yinghai
2010-04-21 15:21                                                                             ` Bjorn Helgaas
2010-04-21 16:45                                                                               ` Yinghai Lu
2010-04-21 16:59                                                                                 ` Bjorn Helgaas
2010-04-21 22:33                                                                                   ` H. Peter Anvin
2010-04-21 23:04                                                                                     ` Bjorn Helgaas
2010-04-21 23:10                                                                                       ` H. Peter Anvin
2010-04-21 23:43                                                                                         ` Yinghai
2010-04-22  0:02                                                                                           ` H. Peter Anvin
2010-04-22  0:06                                                                                             ` Yinghai
2010-04-21 19:31                                                                           ` [PATCH -v4 1/3] x86: Reserve [0xa0000, 0x100000] in e820 map Andy Isaacson
2010-04-23 23:05                                                                             ` [PATCH] x86/PCI: never allocate PCI MMIO resources below BIOS_END Bjorn Helgaas
2010-04-23 23:44                                                                               ` H. Peter Anvin
2010-04-24  0:36                                                                                 ` Yinghai Lu
2010-04-26 12:50                                                                               ` R. Andrew Bailey
2010-04-26 15:40                                                                                 ` Bjorn Helgaas
2010-04-26 18:34                                                                               ` Andy Isaacson
2010-04-26 19:31                                                                                 ` Jesse Barnes
2010-04-26 20:27                                                                                   ` Bjorn Helgaas
2010-04-26 20:37                                                                                     ` Jesse Barnes
2010-04-26 21:07                                                                                       ` Yinghai
2010-04-26 21:19                                                                                         ` H. Peter Anvin
2010-04-26 21:12                                                                                       ` H. Peter Anvin
2010-04-26 21:25                                                                                         ` Jesse Barnes
2010-04-26 21:44                                                                                           ` H. Peter Anvin
2010-04-26 21:53                                                                                             ` Jesse Barnes
2010-04-26 21:59                                                                                           ` Yinghai Lu
2010-04-26 22:04                                                                                             ` [PATCH -v5] reserve a0000 - 0x10000 Yinghai
     [not found]                                                                                             ` <4BD60CD4.9020708@oracle.com>
2010-04-26 22:04                                                                                               ` [PATCH -v5 1/3] x86: Reserve [0xa0000, 0x100000] in e820 map Yinghai
2010-04-26 22:04                                                                                               ` [PATCH -v5 2/3] x86: Remove probe_roms for 32bit Yinghai
2010-04-26 22:04                                                                                               ` [PATCH -v5 3/3] x86, resource: Add reserve_region_with_split_check_child() Yinghai
2010-04-26 21:44                                                                                         ` [PATCH] x86/PCI: never allocate PCI MMIO resources below BIOS_END jacob pan
2010-04-13 23:03                                                                 ` [PATCH -v2 1/2] x86: Reserve [0xa0000, 0x100000] in e820 map H. Peter Anvin
2010-04-14  0:57                                                           ` Yinghai
2010-04-14 16:55                                                             ` Bjorn Helgaas
2010-04-14 17:21                                                               ` Yinghai Lu
2010-04-14 19:25                                                             ` Andy Isaacson
2010-04-14 19:27                                                               ` Yinghai
2010-04-14 19:43                                                                 ` Andy Isaacson
2010-04-14 19:49                                                                   ` Yinghai
2010-04-12 22:33                                             ` [PATCH -v2 2/2] x86,pci, acpi: Inherent BUSY flag when setup_resource for root bus Yinghai
2010-04-12 22:44                                               ` Jesse Barnes
2010-04-13 21:02                                               ` Bjorn Helgaas
2010-04-09 20:11                 ` [PATCH] x86: Reserve legacy VGA MMIO area for x86_64 as well as x86_32 H. Peter Anvin
2010-04-09 20:31                   ` Guenter Roeck
2010-04-09 20:44                     ` H. Peter Anvin
2010-04-09 21:01                       ` Guenter Roeck
2010-04-09 22:42                       ` Alan Cox
2010-04-09 22:42                         ` H. Peter Anvin
2010-04-09 22:54                           ` Alan Cox
2010-04-09 22:55                             ` H. Peter Anvin
2010-04-09 22:51         ` Alan Cox
2010-04-09 22:55           ` H. Peter Anvin
2010-04-07 23:43   ` H. Peter Anvin
2010-04-08  0:19     ` Andy Isaacson
2010-04-08  5:00       ` H. Peter Anvin
2010-04-08 21:40 ` Andy Isaacson
2010-04-26 23:02 [PATCH] x86/PCI: never allocate PCI MMIO resources below BIOS_END H. Peter Anvin
2010-04-26 23:25 ` Jesse Barnes
2010-04-26 23:49   ` H. Peter Anvin
2010-04-26 23:49   ` H. Peter Anvin
2010-04-27  0:05     ` Jesse Barnes
2010-04-27  1:27       ` Linus Torvalds
2010-04-27  1:40         ` Jesse Barnes
2010-04-27  1:41         ` Yinghai
2010-04-27 15:11           ` Bjorn Helgaas
2010-04-28 16:07             ` Bjorn Helgaas
2010-04-28 17:14               ` Yinghai Lu
2010-04-28 19:06                 ` Bjorn Helgaas
2010-04-28 19:10                   ` Yinghai
2010-04-28 19:23                     ` Bjorn Helgaas
2010-04-27  2:02 H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.