ia64/linux-2.6.18-xen.hg

changeset 701:16c549b3ba59

xen: conditionalize PCI reassign code by a config option, selected
only from privileged Xen configurations.

Also eliminate the pointless new macro ROUND_UP_TO_PAGESIZE().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Oct 14 14:58:08 2008 +0100 (2008-10-14)
parents 70fb735a8e28
children 8fbf8e2fd087
files drivers/pci/Kconfig drivers/pci/Makefile drivers/pci/pci.h drivers/pci/setup-bus.c drivers/pci/setup-res.c drivers/xen/Kconfig
line diff
     1.1 --- a/drivers/pci/Kconfig	Tue Oct 14 14:57:26 2008 +0100
     1.2 +++ b/drivers/pci/Kconfig	Tue Oct 14 14:58:08 2008 +0100
     1.3 @@ -17,6 +17,9 @@ config PCI_MSI
     1.4  
     1.5  	   If you don't know what to do here, say N.
     1.6  
     1.7 +config PCI_REASSIGN
     1.8 +	bool
     1.9 +
    1.10  config PCI_DEBUG
    1.11  	bool "PCI Debugging"
    1.12  	depends on PCI && DEBUG_KERNEL
     2.1 --- a/drivers/pci/Makefile	Tue Oct 14 14:57:26 2008 +0100
     2.2 +++ b/drivers/pci/Makefile	Tue Oct 14 14:58:08 2008 +0100
     2.3 @@ -3,8 +3,8 @@
     2.4  #
     2.5  
     2.6  obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
     2.7 -			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
     2.8 -			reassigndev.o
     2.9 +			pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
    2.10 +obj-$(CONFIG_PCI_REASSIGN) += reassigndev.o
    2.11  obj-$(CONFIG_PROC_FS) += proc.o
    2.12  
    2.13  # Build PCI Express stuff if needed
     3.1 --- a/drivers/pci/pci.h	Tue Oct 14 14:57:26 2008 +0100
     3.2 +++ b/drivers/pci/pci.h	Tue Oct 14 14:58:08 2008 +0100
     3.3 @@ -99,8 +99,11 @@ pci_match_one_device(const struct pci_de
     3.4  	return NULL;
     3.5  }
     3.6  
     3.7 -#define ROUND_UP_TO_PAGESIZE(size) ((size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
     3.8 -
     3.9 +#ifdef CONFIG_PCI_REASSIGN
    3.10  extern int reassign_resources;
    3.11  extern int is_reassigndev(struct pci_dev *dev);
    3.12  extern void pci_update_bridge(struct pci_dev *dev, int resno);
    3.13 +#else
    3.14 +#define reassign_resources 0
    3.15 +#define is_reassigndev(dev) 0
    3.16 +#endif
     4.1 --- a/drivers/pci/setup-bus.c	Tue Oct 14 14:57:26 2008 +0100
     4.2 +++ b/drivers/pci/setup-bus.c	Tue Oct 14 14:58:08 2008 +0100
     4.3 @@ -355,9 +355,8 @@ pbus_size_mem(struct pci_bus *bus, unsig
     4.4  				continue;
     4.5  			r_size = r->end - r->start + 1;
     4.6  
     4.7 -			if (reassign) {
     4.8 -				r_size = ROUND_UP_TO_PAGESIZE(r_size);
     4.9 -			}
    4.10 +			if (reassign)
    4.11 +				r_size = ALIGN(r_size, PAGE_SIZE);
    4.12  
    4.13  			/* For bridges size != alignment */
    4.14  			align = (i < PCI_BRIDGE_RESOURCES) ? r_size : r->start;
     5.1 --- a/drivers/pci/setup-res.c	Tue Oct 14 14:57:26 2008 +0100
     5.2 +++ b/drivers/pci/setup-res.c	Tue Oct 14 14:58:08 2008 +0100
     5.3 @@ -117,7 +117,8 @@ pci_claim_resource(struct pci_dev *dev, 
     5.4  }
     5.5  EXPORT_SYMBOL_GPL(pci_claim_resource);
     5.6  
     5.7 -void 
     5.8 +#ifdef CONFIG_PCI_REASSIGN
     5.9 +void
    5.10  pci_update_bridge(struct pci_dev *dev, int resno)
    5.11  {
    5.12  	struct resource *res = &dev->resource[resno]; 
    5.13 @@ -184,6 +185,7 @@ pci_update_bridge(struct pci_dev *dev, i
    5.14  		break;
    5.15  	}
    5.16  }
    5.17 +#endif
    5.18  
    5.19  int pci_assign_resource(struct pci_dev *dev, int resno)
    5.20  {
    5.21 @@ -202,7 +204,7 @@ int pci_assign_resource(struct pci_dev *
    5.22  		align = size;
    5.23  		if ((reassigndev) &&
    5.24  		    (res->flags & IORESOURCE_MEM)) {
    5.25 -			align = ROUND_UP_TO_PAGESIZE(align);
    5.26 +			align = ALIGN(align, PAGE_SIZE);
    5.27  		}
    5.28  	} else {
    5.29  		align = res->start;
    5.30 @@ -231,9 +233,11 @@ int pci_assign_resource(struct pci_dev *
    5.31  			resno, (unsigned long long)size,
    5.32  			(unsigned long long)res->start, pci_name(dev));
    5.33  	} else if (resno < PCI_BRIDGE_RESOURCES) {
    5.34 -		printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
    5.35 -			"%016llx - %016llx\n", resno, pci_name(dev),
    5.36 -			(u64)res->start, (u64)res->end);
    5.37 +		if (reassign_resources && is_reassigndev(dev))
    5.38 +			printk(KERN_DEBUG "PCI: Assign resource(%d) on %s "
    5.39 +				"%016llx - %016llx\n", resno, pci_name(dev),
    5.40 +				 (unsigned long long)res->start,
    5.41 +				 (unsigned long long)res->end);
    5.42  		pci_update_resource(dev, res, resno);
    5.43  	}
    5.44  
     6.1 --- a/drivers/xen/Kconfig	Tue Oct 14 14:57:26 2008 +0100
     6.2 +++ b/drivers/xen/Kconfig	Tue Oct 14 14:58:08 2008 +0100
     6.3 @@ -16,6 +16,7 @@ menu "XEN"
     6.4  
     6.5  config XEN_PRIVILEGED_GUEST
     6.6  	bool "Privileged Guest (domain 0)"
     6.7 +	select PCI_REASSIGN if PCI
     6.8  	help
     6.9  	  Support for privileged operation (domain 0)
    6.10