]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
pciback: Make PV PCI hotplug work with CONFIG_XEN_PCIDEV_BACKEND_PASS
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 26 Mar 2008 11:08:08 +0000 (11:08 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 26 Mar 2008 11:08:08 +0000 (11:08 +0000)
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
drivers/xen/pciback/passthrough.c
drivers/xen/pciback/xenbus.c

index c10b1f14a802739461c544df1c74ffed224849e3..73b539063948bc11b5bcd6fece2c91ac25edaf05 100644 (file)
@@ -47,6 +47,8 @@ int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev,
        struct passthrough_dev_data *dev_data = pdev->pci_dev_data;
        struct pci_dev_entry *dev_entry;
        unsigned long flags;
+       unsigned int domain, bus, devfn;
+       int err;
 
        dev_entry = kmalloc(sizeof(*dev_entry), GFP_KERNEL);
        if (!dev_entry)
@@ -57,9 +59,13 @@ int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev,
        list_add_tail(&dev_entry->list, &dev_data->dev_list);
        spin_unlock_irqrestore(&dev_data->lock, flags);
 
-       /* TODO: Publish virtual domain:bus:slot.func here. */
+       /* Publish this device. */
+       domain = (unsigned int)pci_domain_nr(dev->bus);
+       bus = (unsigned int)dev->bus->number;
+       devfn = dev->devfn;
+       err = publish_cb(pdev, domain, bus, devfn, devid);
 
-       return 0;
+       return err;
 }
 
 void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev)
index 98ffa52be9cb57608178200cea8665a78766cbc9..344a0835be7e88d376fac610a0afd5046e98df6e 100644 (file)
@@ -348,7 +348,6 @@ static int pciback_reconfigure(struct pciback_device *pdev)
                        substate = XenbusStateUnknown;
 
                switch (substate) {
-               /* case XenbusStateUnknown: */
                case XenbusStateInitialising:
                        dev_dbg(&pdev->xdev->dev, "Attaching dev-%d ...\n", i);
 
@@ -382,10 +381,14 @@ static int pciback_reconfigure(struct pciback_device *pdev)
                        if (err)
                                goto out;
 
-                       /* TODO: if we are to support multiple pci roots
-                        * (CONFIG_XEN_PCIDEV_BACKEND_PASS), publish newly
-                        * added root here.
-                        */
+                       /* Publish pci roots. */
+                       err = pciback_publish_pci_roots(pdev, pciback_publish_pci_root);
+                       if (err) {
+                               xenbus_dev_fatal(pdev->xdev, err,
+                                                "Error while publish PCI root"
+                                                "buses for frontend");
+                               goto out;
+                       }
 
                        err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
                                            state_str, "%d",
@@ -431,10 +434,11 @@ static int pciback_reconfigure(struct pciback_device *pdev)
                        if(err)
                                goto out;
 
-                       /* TODO: if we are to support multiple pci roots
-                        * (CONFIG_XEN_PCIDEV_BACKEND_PASS), remove unnecessary
-                        * root here.
+                       /* TODO: If at some point we implement support for pci
+                        * root hot-remove on pcifront side, we'll need to
+                        * remove unnecessary xenstore nodes of pci roots here.
                         */
+
                        break;
 
                default: