public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Alex Williamson <alex.williamson@hp.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Grant Grundler <grundler@parisc-linux.org>,
	Bjorn Helgaas <bjorn.helgaas@hp.com>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Alex Chiang <achiang@hp.com>
Subject: [PATCH] pci: fix bridge 64bit flag setting
Date: Mon, 30 Nov 2009 23:03:57 -0800	[thread overview]
Message-ID: <4B14BFDD.3020802@kernel.org> (raw)
In-Reply-To: <4B14B928.2000108@kernel.org>


Alex found one system that one pci bridge pref mmio 64 is not set correctly.
aka, the upper32 base/limit is not cleaned.
he found that bridge is supporting 64 bit pref mmio, but device under that
does not support that. so that IORESOURCE_MEM_64 get cleared in pbus_size_mem()

the fix will be:
make pci_bridge_check_ranges() to store the PCI_PREF_RANGE_TYPE_64 in addition
to IORESOURCE_MEM_64. just like pci_read_bridge_bases()
and later will use that bit in  pci_setup_bridge_mmio_pref instead of
IORESOURCE_MEM_64.
also avoid touching upper32 regs if the bridge does not support 64bit pref.

Reported-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/setup-bus.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/pci/setup-bus.c
===================================================================
--- linux-2.6.orig/drivers/pci/setup-bus.c
+++ linux-2.6/drivers/pci/setup-bus.c
@@ -289,7 +289,6 @@ static void pci_setup_bridge_mmio_pref(s
 	struct resource *res;
 	struct pci_bus_region region;
 	u32 l, bu, lu;
-	int pref_mem64;
 
 	/* Clear out the upper 32 bits of PREF limit.
 	   If PCI_PREF_BASE_UPPER32 was non-zero, this temporarily
@@ -297,7 +296,6 @@ static void pci_setup_bridge_mmio_pref(s
 	pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, 0);
 
 	/* Set up PREF base/limit. */
-	pref_mem64 = 0;
 	bu = lu = 0;
 	res = bus->resource[2];
 	pcibios_resource_to_bus(bridge, &region, res);
@@ -305,7 +303,6 @@ static void pci_setup_bridge_mmio_pref(s
 		l = (region.start >> 16) & 0xfff0;
 		l |= region.end & 0xfff00000;
 		if (res->flags & IORESOURCE_MEM_64) {
-			pref_mem64 = 1;
 			bu = upper_32_bits(region.start);
 			lu = upper_32_bits(region.end);
 		}
@@ -317,7 +314,7 @@ static void pci_setup_bridge_mmio_pref(s
 	}
 	pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
 
-	if (pref_mem64) {
+	if (res->flags & PCI_PREF_RANGE_TYPE_64) {
 		/* Set the upper 32 bits of PREF base & limit. */
 		pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, bu);
 		pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, lu);
@@ -385,8 +382,10 @@ static void pci_bridge_check_ranges(stru
 	}
 	if (pmem) {
 		b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
-		if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64)
+		if ((pmem & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
 			b_res[2].flags |= IORESOURCE_MEM_64;
+			b_res[2].flags |= PCI_PREF_RANGE_TYPE_64;
+		}
 	}
 
 	/* double check if bridge does support 64 bit pref */

  parent reply	other threads:[~2009-12-01  7:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 21:22 [PATCH] PCI: Always set prefetchable base/limit upper32 registers Alex Williamson
2009-11-30 21:36 ` Yinghai Lu
2009-11-30 21:43   ` Alex Williamson
2009-11-30 21:52     ` Yinghai Lu
2009-11-30 22:01       ` Alex Williamson
2009-11-30 22:12         ` Yinghai Lu
2009-11-30 22:19           ` Alex Williamson
2009-11-30 23:32             ` Yinghai Lu
2009-11-30 23:53               ` Alex Williamson
2009-12-01  0:00                 ` Yinghai Lu
2009-12-01  1:56                   ` Alex Williamson
2009-12-01  2:26                     ` Yinghai Lu
2009-12-01  2:50                       ` Yinghai Lu
2009-12-01  3:23                         ` Alex Williamson
2009-12-01  6:35                           ` Yinghai Lu
2009-12-01  6:55                             ` Alex Williamson
2009-12-01  7:03                             ` Yinghai Lu [this message]
2009-12-01 15:38                               ` [PATCH] pci: fix bridge 64bit flag setting Bjorn Helgaas
2009-12-01 18:28                                 ` Yinghai Lu
2009-12-01 19:15                                   ` Yinghai Lu
2009-12-01  0:22                 ` [PATCH] PCI: Always set prefetchable base/limit upper32 registers Yinghai Lu
2009-12-01  0:00               ` Grant Grundler
2009-12-01  0:09                 ` Yinghai Lu
2009-12-01  0:15                   ` Grant Grundler
2009-11-30 23:58       ` Grant Grundler
2009-11-30 21:42 ` Grant Grundler
2009-11-30 21:43   ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B14BFDD.3020802@kernel.org \
    --to=yinghai@kernel.org \
    --cc=achiang@hp.com \
    --cc=alex.williamson@hp.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=grundler@parisc-linux.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox