Skip to contentSkip to conversation

pcie io space multiplex: Linux part: add kernel command line to reserve io/memory space for unused pci slot

PATCH In review Isaku Yamahata 1 participant 1 message May 28, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/6 pcie io space multiplex: Linux part: add kernel command line to reserve io/memory space for unused pci slot

linux/pci: reserve io/memory space for bridge

reserve io/memory space for bridge which will be used later by PCI hotplug.

Documentation/kernel-parameters.txt +7 -0
@@ -1259,6 +1259,13 @@ running once the system is up.
 				IXP2000 systems where the bus has to be
 				configured a certain way for adjunct CPUs.
 
+	pci_reserve=	[PCI]
+			Format: [<sbdf>[+IO<size>][+MEM<size>]][,<sbdf>...]
+			Format of sbdf: [<segment>:]<bus>:<dev>.<func>
+			Specifies the least reserved io size or memory size
+			which is assigned to PCI bridge even when no child
+			pci device exists. This is useful with PCI hotplug.
+
 	pcmv=		[HW,PCMCIA] BadgePAD 4
 
 	pd.		[PARIDE]
drivers/pci/Kconfig +8 -0
@@ -43,6 +43,14 @@ config PCI_IOMULTI
 	default y
 	help
 	  Say Y here if you need io multiplexing.
+
+config PCI_RESERVE
+	bool "PCI IO/MEMORY space reserve"
+	depends on PCI
+	default y
+	help
+	  Say Y here if you need PCI IO/MEMORY space reserve
+
 config PCI_IOV
 	bool "PCI IOV support"
 	depends on PCI
drivers/pci/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y		+= access.o bus.o probe.o remove.
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_PCI_GUESTDEV) += guestdev.o
 obj-$(CONFIG_PCI_IOMULTI) += iomulti.o
+obj-$(CONFIG_PCI_RESERVE) += reserve.o
 
 # Build PCI Express stuff if needed
 obj-$(CONFIG_PCIEPORTBUS) += pcie/
drivers/pci/pci.h +15 -0
@@ -189,3 +189,18 @@ static inline int pci_iov_bus_range(stru
 	return 0;
 }
 #endif /* CONFIG_PCI_IOV */
+
+#ifdef CONFIG_PCI_RESERVE
+unsigned long pci_reserve_size_io(struct pci_bus *bus);
+unsigned long pci_reserve_size_mem(struct pci_bus *bus);
+#else
+static inline unsigned long pci_reserve_size_io(struct pci_bus *bus)
+{
+	return 0;
+}
+
+static inline unsigned long pci_reserve_size_mem(struct pci_bus *bus)
+{
+	return 0;
+}
+#endif /* CONFIG_PCI_RESERVE */
drivers/pci/reserve.c new file +143 -0

143 lines not on this page · raw message

drivers/pci/setup-bus.c +2 -2
@@ -315,7 +315,7 @@ pbus_size_io(struct pci_bus *bus)
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
 	size = (size & 0xff) + ((size & ~0xffUL) << 2);
 #endif
-	size = ROUND_UP(size + size1, 4096);
+	size = ROUND_UP(max(size + size1, pci_reserve_size_io(bus)), 4096);
 	if (!size) {
 		b_res->flags = 0;
 		return;
@@ -393,7 +393,7 @@ pbus_size_mem(struct pci_bus *bus, unsig
 			min_align = align1 >> 1;
 		align += aligns[order];
 	}
-	size = ROUND_UP(size, min_align);
+	size = ROUND_UP(max(size, pci_reserve_size_mem(bus)), min_align);
 	if (!size) {
 		b_res->flags = 0;
 		return 1;

linux/pci: reserve io/memory space for bridge

reserve io/memory space for bridge which will be used later by PCI hotplug.

Documentation/kernel-parameters.txt +7 -0
@@ -1259,6 +1259,13 @@ running once the system is up.
 				IXP2000 systems where the bus has to be
 				configured a certain way for adjunct CPUs.
 
+	pci_reserve=	[PCI]
+			Format: [<sbdf>[+IO<size>][+MEM<size>]][,<sbdf>...]
+			Format of sbdf: [<segment>:]<bus>:<dev>.<func>
+			Specifies the least reserved io size or memory size
+			which is assigned to PCI bridge even when no child
+			pci device exists. This is useful with PCI hotplug.
+
 	pcmv=		[HW,PCMCIA] BadgePAD 4
 
 	pd.		[PARIDE]
drivers/pci/Kconfig +8 -0
@@ -43,6 +43,14 @@ config PCI_IOMULTI
 	default y
 	help
 	  Say Y here if you need io multiplexing.
+
+config PCI_RESERVE
+	bool "PCI IO/MEMORY space reserve"
+	depends on PCI
+	default y
+	help
+	  Say Y here if you need PCI IO/MEMORY space reserve
+
 config PCI_IOV
 	bool "PCI IOV support"
 	depends on PCI
drivers/pci/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y		+= access.o bus.o probe.o remove.
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_PCI_GUESTDEV) += guestdev.o
 obj-$(CONFIG_PCI_IOMULTI) += iomulti.o
+obj-$(CONFIG_PCI_RESERVE) += reserve.o
 
 # Build PCI Express stuff if needed
 obj-$(CONFIG_PCIEPORTBUS) += pcie/
drivers/pci/pci.h +15 -0
@@ -189,3 +189,18 @@ static inline int pci_iov_bus_range(stru
 	return 0;
 }
 #endif /* CONFIG_PCI_IOV */
+
+#ifdef CONFIG_PCI_RESERVE
+unsigned long pci_reserve_size_io(struct pci_bus *bus);
+unsigned long pci_reserve_size_mem(struct pci_bus *bus);
+#else
+static inline unsigned long pci_reserve_size_io(struct pci_bus *bus)
+{
+	return 0;
+}
+
+static inline unsigned long pci_reserve_size_mem(struct pci_bus *bus)
+{
+	return 0;
+}
+#endif /* CONFIG_PCI_RESERVE */
drivers/pci/reserve.c new file +143 -0

143 lines not on this page · raw message

drivers/pci/setup-bus.c +2 -2
@@ -315,7 +315,7 @@ pbus_size_io(struct pci_bus *bus)
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
 	size = (size & 0xff) + ((size & ~0xffUL) << 2);
 #endif
-	size = ROUND_UP(size + size1, 4096);
+	size = ROUND_UP(max(size + size1, pci_reserve_size_io(bus)), 4096);
 	if (!size) {
 		b_res->flags = 0;
 		return;
@@ -393,7 +393,7 @@ pbus_size_mem(struct pci_bus *bus, unsig
 			min_align = align1 >> 1;
 		align += aligns[order];
 	}
-	size = ROUND_UP(size, min_align);
+	size = ROUND_UP(max(size, pci_reserve_size_mem(bus)), min_align);
 	if (!size) {
 		b_res->flags = 0;
 		return 1;

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