mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1
@ 2010-03-25 15:28 Bjorn Helgaas
  2010-03-25 15:28 ` [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource Bjorn Helgaas
  2010-03-25 15:28 ` [PATCH 2/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2010-03-25 15:28 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: linux-pci, linux-kernel, Rafael J. Wysocki, Yanko Kaneti,
	Linus Torvalds, Thomas Renninger, maciej.rutecki

These patches fix a "pci=use_crs" regression and print a little more
debug information for resource allocation conflicts.

---

Bjorn Helgaas (2):
      x86/PCI: for host bridge address space collisions, show conflicting resource
      x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1


 arch/x86/pci/acpi.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

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

* [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource
  2010-03-25 15:28 [PATCH 0/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas
@ 2010-03-25 15:28 ` Bjorn Helgaas
  2010-03-25 18:20   ` Jesse Barnes
  2010-03-25 15:28 ` [PATCH 2/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2010-03-25 15:28 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: linux-pci, linux-kernel, Rafael J. Wysocki, Yanko Kaneti,
	Linus Torvalds, Thomas Renninger, maciej.rutecki


With insert_resource_conflict(), we can learn what the actual conflict is,
so print that info for debugging purposes.

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

 arch/x86/pci/acpi.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 6e22454..75ac3f8 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -122,7 +122,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
 	struct acpi_resource_address64 addr;
 	acpi_status status;
 	unsigned long flags;
-	struct resource *root;
+	struct resource *root, *conflict;
 	u64 start, end;
 
 	status = resource_to_addr(acpi_res, &addr);
@@ -157,9 +157,12 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
 		return AE_OK;
 	}
 
-	if (insert_resource(root, res)) {
+	conflict = insert_resource_conflict(root, res);
+	if (conflict) {
 		dev_err(&info->bridge->dev,
-			"can't allocate host bridge window %pR\n", res);
+			"address space collision: host bridge window %pR "
+			"conflicts with %s %pR\n",
+			res, conflict->name, conflict);
 	} else {
 		pci_bus_add_resource(info->bus, res, 0);
 		info->res_num++;


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

* [PATCH 2/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1
  2010-03-25 15:28 [PATCH 0/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas
  2010-03-25 15:28 ` [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource Bjorn Helgaas
@ 2010-03-25 15:28 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2010-03-25 15:28 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: linux-pci, linux-kernel, Rafael J. Wysocki, Yanko Kaneti,
	Linus Torvalds, Thomas Renninger, maciej.rutecki


Yanko's GA-MA78GM-S2H (BIOS F11) reports the following resource in a PCI
host bridge _CRS:

    [07] 32-Bit DWORD Address Space Resource
         Min Relocatability : MinFixed
         Max Relocatability : MaxFixed
            Address Minimum : CFF00000  (_MIN)
            Address Maximum : FEBFFFFF  (_MAX)
             Address Length : 3EE10000  (_LEN)

This is invalid per spec (ACPI 4.0, 6.4.3.5) because it's a fixed size,
fixed location descriptor, but _LEN != _MAX - _MIN + 1.

Based on https://bugzilla.kernel.org/show_bug.cgi?id=15480#c15, I think
Windows handles this by truncating the window so it fits between _MIN and
_MAX.  I also verified this by modifying the SeaBIOS DSDT and booting
Windows 2008 R2 with qemu.

This patch makes Linux truncate the window, too, which fixes:
    http://bugzilla.kernel.org/show_bug.cgi?id=15480

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Tested-by: Yanko Kaneti <yaneti@declera.com>
---

 arch/x86/pci/acpi.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)


diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 75ac3f8..e311602 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -123,7 +123,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
 	acpi_status status;
 	unsigned long flags;
 	struct resource *root, *conflict;
-	u64 start, end;
+	u64 start, end, max_len;
 
 	status = resource_to_addr(acpi_res, &addr);
 	if (!ACPI_SUCCESS(status))
@@ -140,6 +140,17 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
 	} else
 		return AE_OK;
 
+	max_len = addr.maximum - addr.minimum + 1;
+	if (addr.address_length > max_len) {
+		dev_printk(KERN_DEBUG, &info->bridge->dev,
+			   "host bridge window length %#llx doesn't fit in "
+			   "%#llx-%#llx, trimming\n",
+			   (unsigned long long) addr.address_length,
+			   (unsigned long long) addr.minimum,
+			   (unsigned long long) addr.maximum);
+		addr.address_length = max_len;
+	}
+
 	start = addr.minimum + addr.translation_offset;
 	end = start + addr.address_length - 1;
 


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

* Re: [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource
  2010-03-25 15:28 ` [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource Bjorn Helgaas
@ 2010-03-25 18:20   ` Jesse Barnes
  0 siblings, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2010-03-25 18:20 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-kernel, Rafael J. Wysocki, Yanko Kaneti,
	Linus Torvalds, Thomas Renninger, maciej.rutecki

On Thu, 25 Mar 2010 09:28:24 -0600
Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:

> 
> With insert_resource_conflict(), we can learn what the actual conflict is,
> so print that info for debugging purposes.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> ---

Pushed these two to my for-linus branch, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

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

end of thread, other threads:[~2010-03-25 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-25 15:28 [PATCH 0/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas
2010-03-25 15:28 ` [PATCH 1/2] x86/PCI: for host bridge address space collisions, show conflicting resource Bjorn Helgaas
2010-03-25 18:20   ` Jesse Barnes
2010-03-25 15:28 ` [PATCH 2/2] x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1 Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®