Yuji Shimada
2008-Oct-17 08:58 UTC
[Xen-devel] [PATCH] dom0 linux: remove "reassign_resources" option.
This patch removes "reassign_resources" option from dom0 linux. To reassign page-aligned resources to device, please add boot parameters of dom0 linux as follows. reassigndev=00:1d.7,01:00.0 reassigndev= Specifies device to reassign page-aligned resources. PCI-PCI bridge can be specified, if resource windows need to be expanded. Thanks, -- Yuji Shimada Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp> diff -r c57acb662c09 drivers/pci/pci.h --- a/drivers/pci/pci.h Fri Oct 17 14:15:40 2008 +0900 +++ b/drivers/pci/pci.h Fri Oct 17 14:32:02 2008 +0900 @@ -100,10 +100,8 @@ pci_match_one_device(const struct pci_de } #ifdef CONFIG_PCI_REASSIGN -extern int reassign_resources; extern int is_reassigndev(struct pci_dev *dev); extern void pci_disable_bridge_window(struct pci_dev *dev); #else -#define reassign_resources 0 #define is_reassigndev(dev) 0 #endif diff -r c57acb662c09 drivers/pci/quirks.c --- a/drivers/pci/quirks.c Fri Oct 17 14:15:40 2008 +0900 +++ b/drivers/pci/quirks.c Fri Oct 17 14:32:02 2008 +0900 @@ -34,18 +34,6 @@ __setup("pci-mem-align", set_pci_mem_ali __setup("pci-mem-align", set_pci_mem_align); -int reassign_resources = 0; - -static int __init set_reassign_resources(char *str) -{ - /* resources reassign on */ - reassign_resources = 1; - printk(KERN_DEBUG "PCI: resource reassign ON.\n"); - - return 1; -} -__setup("reassign_resources", set_reassign_resources); - /* This quirk function enables us to force all memory resources which are * assigned to PCI devices, to be page-aligned. */ @@ -55,38 +43,36 @@ static void __devinit quirk_align_mem_re struct resource *r; resource_size_t old_start; - if (reassign_resources) { + if (is_reassigndev(dev)) { if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL && (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) { /* PCI Host Bridge isn''t a target device */ return; } - if (is_reassigndev(dev)) { - printk(KERN_INFO - "PCI: Disable device and release resources" - " [%s].\n", pci_name(dev)); - pci_disable_device(dev); + printk(KERN_INFO + "PCI: Disable device and release resources [%s].\n", + pci_name(dev)); + pci_disable_device(dev); - for (i=0; i < PCI_NUM_RESOURCES; i++) { - r = &dev->resource[i]; - if (!(r->flags & IORESOURCE_MEM)) - continue; + for (i=0; i < PCI_NUM_RESOURCES; i++) { + r = &dev->resource[i]; + if (!(r->flags & IORESOURCE_MEM)) + continue; - r->end = r->end - r->start; - r->start = 0; + r->end = r->end - r->start; + r->start = 0; - if (i < PCI_BRIDGE_RESOURCES) { - pci_update_resource(dev, r, i); - } + if (i < PCI_BRIDGE_RESOURCES) { + pci_update_resource(dev, r, i); } - /* need to disable bridge''s resource window, - * to make kernel enable to reassign new resource - * window later on. - */ - if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && - (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { - pci_disable_bridge_window(dev); - } + } + /* need to disable bridge''s resource window, + * to make kernel enable to reassign new resource + * window later on. + */ + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && + (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { + pci_disable_bridge_window(dev); } return; } diff -r c57acb662c09 drivers/pci/setup-bus.c --- a/drivers/pci/setup-bus.c Fri Oct 17 14:15:40 2008 +0900 +++ b/drivers/pci/setup-bus.c Fri Oct 17 14:32:02 2008 +0900 @@ -345,7 +345,7 @@ pbus_size_mem(struct pci_bus *bus, unsig list_for_each_entry(dev, &bus->devices, bus_list) { int i; - int reassign = reassign_resources ? is_reassigndev(dev) : 0; + int reassign = is_reassigndev(dev); for (i = 0; i < PCI_NUM_RESOURCES; i++) { struct resource *r = &dev->resource[i]; diff -r c57acb662c09 drivers/pci/setup-res.c --- a/drivers/pci/setup-res.c Fri Oct 17 14:15:40 2008 +0900 +++ b/drivers/pci/setup-res.c Fri Oct 17 14:32:02 2008 +0900 @@ -138,7 +138,7 @@ int pci_assign_resource(struct pci_dev * struct resource *res = dev->resource + resno; resource_size_t size, min, align; int ret; - int reassigndev = reassign_resources ? is_reassigndev(dev) : 0; + int reassigndev = is_reassigndev(dev); size = res->end - res->start + 1; min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; @@ -178,7 +178,7 @@ int pci_assign_resource(struct pci_dev * resno, (unsigned long long)size, (unsigned long long)res->start, pci_name(dev)); } else if (resno < PCI_BRIDGE_RESOURCES) { - if (reassign_resources && is_reassigndev(dev)) + if (reassigndev) printk(KERN_DEBUG "PCI: Assign resource(%d) on %s " "%016llx - %016llx\n", resno, pci_name(dev), (unsigned long long)res->start, _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel