From: Jeff Garzik <jgarzik@pobox.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@suse.de, ak@suse.de
Subject: [PATCH 3/3] x86 PCI domain support: the meat
Date: Fri, 2 Dec 2005 20:40:33 -0500 [thread overview]
Message-ID: <20051203014033.GC2663@havoc.gtf.org> (raw)
In-Reply-To: <20051203013904.GA2560@havoc.gtf.org>
commit 31c93c154ca9a86a865b4ef28b7ba5d8e48f7b13
Author: Jeff Garzik <jgarzik@pobox.com>
Date: Fri Dec 2 20:30:48 2005 -0500
[x86, PCI] add PCI domain support
* Store PCI domain in struct pci_sysdata
* Add magic inlines to pass PCI domain to read/write config hooks
* Support ACPI's notion of PCI domains (PCI segments)
arch/i386/pci/acpi.c | 20 ++++++++++++++++++--
include/asm-i386/pci.h | 14 ++++++++++++++
include/asm-x86_64/pci.h | 14 ++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
31c93c154ca9a86a865b4ef28b7ba5d8e48f7b13
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index 107b18d..38a752d 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -8,18 +8,34 @@
struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
{
struct pci_bus *bus;
+ struct pci_sysdata *sd;
+ /* Allocate per-root-bus (not per bus) arch-specific data.
+ * TODO: leak; this memory is never freed.
+ * It's arguable whether it's worth the trouble to care.
+ */
+ sd = kzalloc(sizeof(*sd), GFP_KERNEL);
+ if (!sd) {
+ printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
+ return NULL;
+ }
+
+#ifdef CONFIG_PCI_DOMAINS
+ sd->domain = domain;
+#else
if (domain != 0) {
printk(KERN_WARNING "PCI: Multiple domains not supported\n");
return NULL;
}
+#endif /* CONFIG_PCI_DOMAINS */
- bus = pcibios_scan_root(busnum);
+ bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
+ if (!bus)
+ kfree(sd);
#ifdef CONFIG_ACPI_NUMA
if (bus != NULL) {
int pxm = acpi_get_pxm(device->handle);
if (pxm >= 0) {
- struct pci_sysdata *sd = bus->sysdata;
sd->node = pxm_to_node(pxm);
printk("bus %d -> pxm %d -> node %d\n",
busnum, pxm, sd->node);
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index f56a158..4068d1c 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -6,9 +6,23 @@
#ifdef __KERNEL__
struct pci_sysdata {
+ int domain; /* PCI domain */
int node; /* NUMA node */
};
+#ifdef CONFIG_PCI_DOMAINS
+static inline int pci_domain_nr(struct pci_bus *bus)
+{
+ struct pci_sysdata *sd = bus->sysdata;
+ return sd->domain;
+}
+
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+ return pci_domain_nr(bus);
+}
+#endif /* CONFIG_PCI_DOMAINS */
+
#include <linux/mm.h> /* for struct page */
/* Can be used to override the logic in pci_scan_bus for skipping
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 424c1ee..bcbf9aa 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -7,9 +7,23 @@
#ifdef __KERNEL__
struct pci_sysdata {
+ int domain; /* PCI domain */
int node; /* NUMA node */
};
+#ifdef CONFIG_PCI_DOMAINS
+static inline int pci_domain_nr(struct pci_bus *bus)
+{
+ struct pci_sysdata *sd = bus->sysdata;
+ return sd->domain;
+}
+
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+ return pci_domain_nr(bus);
+}
+#endif /* CONFIG_PCI_DOMAINS */
+
#include <linux/mm.h> /* for struct page */
/* Can be used to override the logic in pci_scan_bus for skipping
next prev parent reply other threads:[~2005-12-03 1:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-03 1:39 [PATCH 0/3] x86 PCI domain support Jeff Garzik
2005-12-03 1:39 ` [PATCH 1/3] x86 PCI domain support: a humble fix Jeff Garzik
2005-12-03 1:40 ` [PATCH 2/3] x86 PCI domain support: struct pci_sysdata Jeff Garzik
2005-12-03 1:40 ` Jeff Garzik [this message]
2005-12-03 1:42 ` [PATCH 0/3] x86 PCI domain support Jeff Garzik
2005-12-03 3:15 ` Andi Kleen
2005-12-03 20:11 ` Jeff Garzik
2005-12-03 21:03 ` Greg KH
2005-12-07 0:39 ` Greg KH
2005-12-07 1:32 ` Andi Kleen
2005-12-07 1:41 ` Greg KH
2005-12-07 2:14 ` Jeff Garzik
2005-12-07 2:33 ` Greg KH
2005-12-07 4:12 ` Jeff Garzik
2005-12-07 5:23 ` Greg KH
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=20051203014033.GC2663@havoc.gtf.org \
--to=jgarzik@pobox.com \
--cc=ak@suse.de \
--cc=gregkh@suse.de \
--cc=linux-kernel@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
Powered by JetHome