linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH v6 3/7] PCI: Check pci bus address for unassigned res
Date: Mon, 22 Jul 2013 14:37:14 -0700	[thread overview]
Message-ID: <1374529038-14311-4-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1374529038-14311-1-git-send-email-yinghai@kernel.org>

We should compare res->start with root bus window offset.
Otherwise will have problem with arch that support hostbridge
resource offset.

BenH pointed out that during reviewing patchset that separate
assign unassigned to per root buses.

According to Bjorn, have it in separated patch.

Use pcibios_resource_to_bus to get region at first, and check
region.start instead.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/pci/setup-bus.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ec93aa0..87687a5 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1367,9 +1367,14 @@ static int __init check_unassigned_resources(struct pci_dev *dev, void *data)
 
 	for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) {
 		struct resource *r = &dev->resource[i];
+		struct pci_bus_region region;
 
 		/* Not assigned, or rejected by kernel ? */
-		if (r->flags && !r->start) {
+		if (!r->flags)
+			continue;
+
+		pcibios_resource_to_bus(dev, &region, r);
+		if (!region.start) {
 			(*unassigned)++;
 			return 1; /* return early from pci_walk_bus */
 		}
-- 
1.8.1.4


  parent reply	other threads:[~2013-07-22 21:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 21:37 [PATCH v6 0/7] PCI: Change assign unassigned resources per root bus bassis Yinghai Lu
2013-07-22 21:37 ` [PATCH v6 1/7] PCI: Don't use temp bus for pci_bus_release_bridge_resources Yinghai Lu
2013-07-22 21:37 ` [PATCH v6 2/7] PCI: Use pci_walk_bus to detect unassigned resources Yinghai Lu
2013-07-22 21:37 ` Yinghai Lu [this message]
2013-07-22 21:37 ` [PATCH v6 4/7] PCI: Introduce enable_local to prepare per root bus handling Yinghai Lu
2013-07-22 21:37 ` [PATCH v6 5/7] PCI: Split pci_assign_unassigned_resources to per root bus Yinghai Lu
2013-07-22 21:37 ` [PATCH v6 6/7] PCI: Enable pci bridge when it is needed Yinghai Lu
2013-07-22 21:37 ` [PATCH v6 7/7] PCI: Retry assign unassigned resources for hotadd root bus Yinghai Lu
2013-07-24 22:03 ` [PATCH v6 0/7] PCI: Change assign unassigned resources per root bus bassis Bjorn Helgaas
2013-07-24 23:12   ` Rafael J. Wysocki
2013-07-25 13:38   ` Yinghai Lu

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=1374529038-14311-4-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --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;
as well as URLs for NNTP newsgroup(s).