Skip to contentSkip to conversation

Linux options pci-mem-align vs. reassigndev=

DISCUSSION Jan Beulich 2 participants 2 messages Oct 21, 2008 – Oct 22, 2008 PCI

lore
Share & tools
lore
#0 lore raw

Isn't the latter superior to the former (as it works on individual devices rather than globally), and couldn't the former hence be removed again?

Thanks, Jan

#1 lore raw
Quoted 2 lines · On Tue, 21 Oct 2008 11:57:00 +0100 "Jan Beulich" <[email protected]> wrote:

Isn't the latter superior to the former (as it works on individual devices rather than globally), and couldn't the former hence be removed again?

This patch removes "pci-mem-align" option from dom0 linux.

Thanks,
--
Yuji Shimada

drivers/pci/bus.c +0 -7
diff -r 240657899772 drivers/pci/bus.c
@@ -16,8 +16,6 @@
 #include <linux/init.h>
 
 #include "pci.h"
-
-extern int pci_mem_align;
 
 /**
  * pci_bus_alloc_resource - allocate a resource from a parent bus
@@ -45,11 +43,6 @@ pci_bus_alloc_resource(struct pci_bus *b
 	int i, ret = -ENOMEM;
 
 	type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
-
-	/* If the boot parameter 'pci-mem-align' was specified then we need to 
-	   align the memory addresses, at page size alignment. */
-	if (pci_mem_align && (align < (PAGE_SIZE-1)))
-		align = PAGE_SIZE - 1;
 
 	for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
 		struct resource *r = bus->resource[i];
drivers/pci/quirks.c +7 -28
diff -r 240657899772 drivers/pci/quirks.c
@@ -23,25 +23,17 @@
 #include <linux/acpi.h>
 #include "pci.h"
 
-/* A global flag which signals if we should page-align PCI mem windows. */
-int pci_mem_align = 0;
 
-static int __init set_pci_mem_align(char *str)
-{
-	pci_mem_align = 1;
-	return 1;
-}
-__setup("pci-mem-align", set_pci_mem_align);
-
-
-/* This quirk function enables us to force all memory resources which are 
- * assigned to PCI devices, to be page-aligned.
+/*
+ * This quirk function disables the device and releases resources
+ * which is specified by kernel's boot parameter 'reassigndev'.
+ * Later on, kernel will assign page-aligned memory resource back
+ * to that device.
  */
-static void __devinit quirk_align_mem_resources(struct pci_dev *dev)
+static void __devinit quirk_release_resources(struct pci_dev *dev)
 {
 	int i;
 	struct resource *r;
-	resource_size_t old_start;
 
 	if (is_reassigndev(dev)) {
 		if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL &&
@@ -76,21 +68,8 @@ static void __devinit quirk_align_mem_re
 		}
 		return;
 	}
-
-	if (!pci_mem_align)
-		return;
-
-	for (i=0; i < DEVICE_COUNT_RESOURCE; i++) {
-		r = &dev->resource[i];
-		if ((r == NULL) || !(r->flags & IORESOURCE_MEM))
-			continue;
-
-		old_start = r->start;
-		r->start = (r->start + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
-		r->end = r->end - (old_start - r->start);
-	}
 }
-DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_align_mem_resources);
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_release_resources);
 
 /* The Mellanox Tavor device gives false positive parity errors
  * Mark this device with a broken_parity_status, to allow