From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org
Cc: bhelgaas@google.com, yinghai@kernel.org,
Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [PATCH 1/3] PCI: PCI_BUS_FLAGS_NO_IO flag for PCI bus
Date: Mon, 6 May 2013 21:44:16 +0800 [thread overview]
Message-ID: <1367847858-6506-1-git-send-email-shangw@linux.vnet.ibm.com> (raw)
There has some PCI hosts (e.g. PHB3) that don't support IO. So the
patch intends to introduce the flag to indicate the special case.
In turn, we won't do IO resource assignment and enable that.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
drivers/pci/pci.c | 3 +++
drivers/pci/setup-bus.c | 25 ++++++++++++++++---------
include/linux/pci.h | 1 +
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a899d8b..2548bad 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1218,6 +1218,9 @@ int pci_enable_device_mem(struct pci_dev *dev)
*/
int pci_enable_device(struct pci_dev *dev)
{
+ if (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_IO)
+ return pci_enable_device_flags(dev, IORESOURCE_MEM);
+
return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
}
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 16abaaa..c8293e90 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -133,6 +133,10 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
r = &dev->resource[i];
+ if ((dev->bus->bus_flags & PCI_BUS_FLAGS_NO_IO) &&
+ (r->flags & IORESOURCE_IO))
+ continue;
+
if (r->flags & IORESOURCE_PCI_FIXED)
continue;
@@ -1083,17 +1087,20 @@ static void __ref __pci_bus_size_bridges(struct pci_bus *bus,
additional_io_size = pci_hotplug_io_size;
additional_mem_size = pci_hotplug_mem_size;
}
+
+ /* Follow thru */
+ default:
+ if (!(bus->bus_flags & PCI_BUS_FLAGS_NO_IO))
+ pbus_size_io(bus,
+ realloc_head ? 0 : additional_io_size,
+ additional_io_size, realloc_head);
/*
- * Follow thru
+ * If the bridge supports prefetchable range, size it
+ * separately. If it doesn't, or its prefetchable window
+ * has already been allocated by arch code, try
+ * non-prefetchable range for both types of PCI memory
+ * resources.
*/
- default:
- pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
- additional_io_size, realloc_head);
- /* If the bridge supports prefetchable range, size it
- separately. If it doesn't, or its prefetchable window
- has already been allocated by arch code, try
- non-prefetchable range for both types of PCI memory
- resources. */
mask = IORESOURCE_MEM;
prefmask = IORESOURCE_MEM | IORESOURCE_PREFETCH;
if (pbus_size_mem(bus, prefmask, prefmask,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3a24e4f..53b595a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -181,6 +181,7 @@ typedef unsigned short __bitwise pci_bus_flags_t;
enum pci_bus_flags {
PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
+ PCI_BUS_FLAGS_NO_IO = (__force pci_bus_flags_t) 4
};
/* Based on the PCI Hotplug Spec, but some values are made up by us */
--
1.7.5.4
next reply other threads:[~2013-05-06 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 13:44 Gavin Shan [this message]
2013-05-06 13:44 ` [PATCH 2/3] powerpc/powernv: Disable IO space for PCI buses Gavin Shan
2013-05-06 21:33 ` Benjamin Herrenschmidt
2013-05-07 5:11 ` Gavin Shan
2013-05-06 13:44 ` [PATCH 3/3] powerpc/powernv: Don't configure IO window on PHB3 Gavin Shan
2013-05-06 21:34 ` Benjamin Herrenschmidt
2013-05-07 5:12 ` Gavin Shan
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=1367847858-6506-1-git-send-email-shangw@linux.vnet.ibm.com \
--to=shangw@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=yinghai@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).