Skip to contentSkip to conversation

Controller PCI backend and frontend extensions

PATCH New Alex Williamson 1 participant 1 message Jun 11, 2007 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Controller PCI backend and frontend extensions

This is largely the same as the RFC patch I sent out yesterday. I've moved the enormous inline function into c-code and cleaned things up a bit. For a full description of this new driver domain PCI backend and enhancements to the frontend, see this descriptions:

http://lists.xensource.com/archives/html/xen-devel/2007-06/msg00400.html

This patch should have no impact on architectures other than ia64. I'm submitting it here because it lives in common code. Keir, please apply. Thanks,

Alex

---

arch/ia64/pci/pci.c +28 -0
diff -r c09686d2bbff arch/ia64/pci/pci.c
@@ -834,3 +834,31 @@ int pci_vector_resources(int last, int n
 
 	return count;
 }
+
+#ifdef CONFIG_XEN
+void __devinit xen_add_resource(struct pci_controller *controller,
+				unsigned int domain, unsigned int bus,
+				struct acpi_resource *resource)
+{
+	struct pci_root_info info;
+	char *name;
+
+	name = kmalloc(16, GFP_KERNEL);
+	if (!name)
+		return;
+
+	sprintf(name, "PCI Bus %04x:%02x", domain, bus);
+	info.controller = controller;
+	info.name = name;
+
+	add_window(resource, &info);
+}
+EXPORT_SYMBOL(xen_add_resource);
+
+void __devinit xen_pcibios_setup_root_windows(struct pci_bus *bus,
+					      struct pci_controller *controller)
+{
+	pcibios_setup_root_windows(bus, controller);
+}
+EXPORT_SYMBOL(xen_pcibios_setup_root_windows);
+#endif
drivers/xen/Kconfig +17 -1
diff -r c09686d2bbff drivers/xen/Kconfig
@@ -109,7 +109,8 @@ choice
 choice
 	prompt "PCI Backend Mode"
 	depends on XEN_PCIDEV_BACKEND
-	default XEN_PCIDEV_BACKEND_VPCI
+	default XEN_PCIDEV_BACKEND_VPCI if !IA64
+	default XEN_PCIDEV_BACKEND_CONTROLLER if IA64
 
 config XEN_PCIDEV_BACKEND_VPCI
 	bool "Virtual PCI"
@@ -138,6 +139,21 @@ config XEN_PCIDEV_BACKEND_SLOT
 	  For example, a device at 03:05.2 will be re-assigned to 00:00.0. A
 	  second device at 02:1a.1 will be re-assigned to 00:01.0.
 
+config XEN_PCIDEV_BACKEND_CONTROLLER
+	bool "Controller"
+	depends on IA64
+	---help---
+	  This PCI backend virtualizes the PCI bus topology by providing a
+	  virtual bus per PCI root device.  Devices which are physically under
+	  the same root bus will appear on the same virtual bus.  For systems
+	  with complex I/O addressing, this is the only backend which supports
+	  extended I/O port spaces and MMIO translation offsets.  This backend
+	  also supports slot virtualization.  For example, a device at
+	  0000:01:02.1 will be re-assigned to 0000:00:00.0.  A second device
+	  at 0000:02:05.0 (behind a P2P bridge on bus 0000:01) will be
+	  re-assigned to 0000:00:01.0.  A third device at 0000:16:05.0 (under
+	  a different PCI root bus) will be re-assigned to 0000:01:00.0.
+
 endchoice
 
 config XEN_PCIDEV_BE_DEBUG
drivers/xen/pciback/Makefile +1 -0
diff -r c09686d2bbff drivers/xen/pciback/Makefile
@@ -9,6 +9,7 @@ pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI
 pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI) += vpci.o
 pciback-$(CONFIG_XEN_PCIDEV_BACKEND_SLOT) += slot.o
 pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o
+pciback-$(CONFIG_XEN_PCIDEV_BACKEND_CONTROLLER) += controller.o
 
 ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
drivers/xen/pcifront/pci_op.c +119 -1

138 lines not on this page · raw message

include/xen/pcifront.h +16 -10
diff -r c09686d2bbff include/xen/pcifront.h
@@ -26,7 +26,8 @@ pcifront_get_pdev(struct pcifront_sd *sd
 	return sd->pdev;
 }
 
-static inline void pcifront_init_sd(struct pcifront_sd *sd, int domain,
+static inline void pcifront_init_sd(struct pcifront_sd *sd,
+				    unsigned int domain, unsigned int bus,
 				    struct pcifront_device *pdev)
 {
 	sd->domain = domain;
@@ -45,10 +46,21 @@ static inline int pci_proc_domain(struct
 }
 #endif /* CONFIG_PCI_DOMAINS */
 
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
+{
+}
+
 #else /* __ia64__ */
 
+#include <linux/acpi.h>
 #include <asm/pci.h>
 #define pcifront_sd pci_controller
+
+extern void xen_add_resource(struct pci_controller *, unsigned int,
+			     unsigned int, struct acpi_resource *);
+extern void xen_pcibios_setup_root_windows(struct pci_bus *,
+					   struct pci_controller *);
 
 static inline struct pcifront_device *
 pcifront_get_pdev(struct pcifront_sd *sd)
@@ -56,16 +68,10 @@ pcifront_get_pdev(struct pcifront_sd *sd
 	return (struct pcifront_device *)sd->platform_data;
 }
 
-static inline void pcifront_init_sd(struct pcifront_sd *sd, int domain,
-				    struct pcifront_device *pdev)
+static inline void pcifront_setup_root_resources(struct pci_bus *bus,
+						 struct pcifront_sd *sd)
 {
-	sd->segment = domain;
-	sd->acpi_handle = NULL;
-	sd->iommu = NULL;
-	sd->node = -1;
-	sd->windows = 0;
-	sd->window = NULL;
-	sd->platform_data = pdev;
+	xen_pcibios_setup_root_windows(bus, sd);
 }
 
 #endif /* __ia64__ */
drivers/xen/pciback/controller.c new file +404 -0

404 lines not on this page · raw message