Skip to contentSkip to conversation

PCIe IO space multiplexing: Linux part

PATCH In review Isaku Yamahata 1 participant 1 message Apr 2, 2009 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 PCIe IO space multiplexing: Linux part

PCI pass through: PCIe IO space multiplexing

This patch is for PCIe IO space multiplexing. This is required for more than 16 HVM domain to boot from PCIe pass through device.

Linux as dom0 exclusively assigns IO space to downstream PCI bridges and the assignment unit of PCI bridge IO space is 4K. So the only up to 16 PCIe device can be accessed via IO space within 64K IO ports. PCI expansion ROM BIOS often uses IO port access to boot from the device, so on virtualized environment, it means only up to 16 guest domain can boot from pass-through device.

This patch allows PCIe IO space sharing of pass-through device.
- reassign IO space of PCIe devices specified by "guestiomuldev=[<segment>:]<bus>:<dev>[,[<segment:><bus>:dev]][,...]" to be shared.
This is implemented as Linux PCI quirk fixup.

The sharing unit is PCIe switch. Ie IO space of the end point devices under the same switch will be shared.
If there are more than one switches, two areas of IO space will be used.

- And the driver which arbitrates the accesses to the multiplexed PCIe IO space. Later qemu-dm will use this.

Limitation:
IO port of IO shared devices can't be accessed from dom0 Linux device driver. But this wouldn't be a big issue because PCIe specification discourages the use of IO space and recommends that IO space should be used only for bootable device with ROM code. OS device driver should work without IO space access.

drivers/pci/Kconfig +6 -0
@@ -37,6 +37,12 @@ config PCI_GUESTDEV
 	help
 	  Say Y here if you want to reserve PCI device for passthrough.
 
+config PCI_IOMULTI
+	bool "PCI Device IO Multiplex for Passthrough"
+	depends on PCI && ACPI
+	default y
+	help
+	  Say Y here if you need io multiplexing.
 config PCI_IOV
 	bool "PCI IOV support"
 	depends on PCI
drivers/pci/Makefile +1 -0
@@ -4,6 +4,7 @@
 
 obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
 			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
+obj-$(CONFIG_PCI_IOMULTI) += iomulti.o
 obj-$(CONFIG_PCI_REASSIGN) += reassigndev.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_PCI_GUESTDEV) += guestdev.o
drivers/pci/iomulti.c new file +1121 -0

1,121 lines not on this page · raw message

drivers/pci/iomulti.h new file +51 -0

51 lines not on this page · raw message

PCI pass through: PCIe IO space multiplexing

This patch is for PCIe IO space multiplexing. This is required for more than 16 HVM domain to boot from PCIe pass through device.

Linux as dom0 exclusively assigns IO space to downstream PCI bridges and the assignment unit of PCI bridge IO space is 4K. So the only up to 16 PCIe device can be accessed via IO space within 64K IO ports. PCI expansion ROM BIOS often uses IO port access to boot from the device, so on virtualized environment, it means only up to 16 guest domain can boot from pass-through device.

This patch allows PCIe IO space sharing of pass-through device.
- reassign IO space of PCIe devices specified by "guestiomuldev=[<segment>:]<bus>:<dev>[,[<segment:><bus>:dev]][,...]" to be shared.
This is implemented as Linux PCI quirk fixup.

The sharing unit is PCIe switch. Ie IO space of the end point devices under the same switch will be shared.
If there are more than one switches, two areas of IO space will be used.

- And the driver which arbitrates the accesses to the multiplexed PCIe IO space. Later qemu-dm will use this.

Limitation:
IO port of IO shared devices can't be accessed from dom0 Linux device driver. But this wouldn't be a big issue because PCIe specification discourages the use of IO space and recommends that IO space should be used only for bootable device with ROM code. OS device driver should work without IO space access.

drivers/pci/Kconfig +6 -0
@@ -37,6 +37,12 @@ config PCI_GUESTDEV
 	help
 	  Say Y here if you want to reserve PCI device for passthrough.
 
+config PCI_IOMULTI
+	bool "PCI Device IO Multiplex for Passthrough"
+	depends on PCI && ACPI
+	default y
+	help
+	  Say Y here if you need io multiplexing.
 config PCI_IOV
 	bool "PCI IOV support"
 	depends on PCI
drivers/pci/Makefile +1 -0
@@ -4,6 +4,7 @@
 
 obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
 			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
+obj-$(CONFIG_PCI_IOMULTI) += iomulti.o
 obj-$(CONFIG_PCI_REASSIGN) += reassigndev.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_PCI_GUESTDEV) += guestdev.o
drivers/pci/iomulti.c new file +1121 -0

1,121 lines not on this page · raw message

drivers/pci/iomulti.h new file +51 -0

51 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel