ia64/linux-2.6.18-xen.hg

changeset 495:542209a3e7e9

pciback: Make PV PCI hotplug work with CONFIG_XEN_PCIDEV_BACKEND_PASS

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 26 11:08:08 2008 +0000 (2008-03-26)
parents 1327b9dcc63a
children bfc040135633
files drivers/xen/pciback/passthrough.c drivers/xen/pciback/xenbus.c
line diff
     1.1 --- a/drivers/xen/pciback/passthrough.c	Wed Mar 26 09:07:52 2008 +0000
     1.2 +++ b/drivers/xen/pciback/passthrough.c	Wed Mar 26 11:08:08 2008 +0000
     1.3 @@ -47,6 +47,8 @@ int pciback_add_pci_dev(struct pciback_d
     1.4  	struct passthrough_dev_data *dev_data = pdev->pci_dev_data;
     1.5  	struct pci_dev_entry *dev_entry;
     1.6  	unsigned long flags;
     1.7 +	unsigned int domain, bus, devfn;
     1.8 +	int err;
     1.9  
    1.10  	dev_entry = kmalloc(sizeof(*dev_entry), GFP_KERNEL);
    1.11  	if (!dev_entry)
    1.12 @@ -57,9 +59,13 @@ int pciback_add_pci_dev(struct pciback_d
    1.13  	list_add_tail(&dev_entry->list, &dev_data->dev_list);
    1.14  	spin_unlock_irqrestore(&dev_data->lock, flags);
    1.15  
    1.16 -	/* TODO: Publish virtual domain:bus:slot.func here. */
    1.17 +	/* Publish this device. */
    1.18 +	domain = (unsigned int)pci_domain_nr(dev->bus);
    1.19 +	bus = (unsigned int)dev->bus->number;
    1.20 +	devfn = dev->devfn;
    1.21 +	err = publish_cb(pdev, domain, bus, devfn, devid);
    1.22  
    1.23 -	return 0;
    1.24 +	return err;
    1.25  }
    1.26  
    1.27  void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev)
     2.1 --- a/drivers/xen/pciback/xenbus.c	Wed Mar 26 09:07:52 2008 +0000
     2.2 +++ b/drivers/xen/pciback/xenbus.c	Wed Mar 26 11:08:08 2008 +0000
     2.3 @@ -348,7 +348,6 @@ static int pciback_reconfigure(struct pc
     2.4  			substate = XenbusStateUnknown;
     2.5  
     2.6  		switch (substate) {
     2.7 -		/* case XenbusStateUnknown: */
     2.8  		case XenbusStateInitialising:
     2.9  			dev_dbg(&pdev->xdev->dev, "Attaching dev-%d ...\n", i);
    2.10  
    2.11 @@ -382,10 +381,14 @@ static int pciback_reconfigure(struct pc
    2.12  			if (err)
    2.13  				goto out;
    2.14  
    2.15 -			/* TODO: if we are to support multiple pci roots
    2.16 -			 * (CONFIG_XEN_PCIDEV_BACKEND_PASS), publish newly
    2.17 -			 * added root here.
    2.18 -			 */
    2.19 +			/* Publish pci roots. */
    2.20 +			err = pciback_publish_pci_roots(pdev, pciback_publish_pci_root);
    2.21 +			if (err) {
    2.22 +				xenbus_dev_fatal(pdev->xdev, err,
    2.23 +						 "Error while publish PCI root"
    2.24 +						 "buses for frontend");
    2.25 +				goto out;
    2.26 +			}
    2.27  
    2.28  			err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
    2.29  					    state_str, "%d",
    2.30 @@ -431,10 +434,11 @@ static int pciback_reconfigure(struct pc
    2.31  			if(err)
    2.32  				goto out;
    2.33  
    2.34 -			/* TODO: if we are to support multiple pci roots
    2.35 -			 * (CONFIG_XEN_PCIDEV_BACKEND_PASS), remove unnecessary
    2.36 -			 * root here.
    2.37 +			/* TODO: If at some point we implement support for pci
    2.38 +			 * root hot-remove on pcifront side, we'll need to
    2.39 +			 * remove unnecessary xenstore nodes of pci roots here.
    2.40  			 */
    2.41 +
    2.42  			break;
    2.43  
    2.44  		default: