summaryrefslogtreecommitdiffstats
path: root/drivers/xen/xen-pciback/xenbus.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2009-12-09 17:43:15 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-07-19 20:58:29 -0400
commit6221a9b2a11acfb54e7b41da425e961b31e88553 (patch)
treecea7181fabd0f3baacb50cbc67c87d58ff17e7ec /drivers/xen/xen-pciback/xenbus.c
parent8bfd4e023f5fb5793d7d7483b6e17e04933c53e9 (diff)
downloadtalos-op-linux-6221a9b2a11acfb54e7b41da425e961b31e88553.tar.gz
talos-op-linux-6221a9b2a11acfb54e7b41da425e961b31e88553.zip
xen/pciback: Register the owner (domain) of the PCI device.
When the front-end and back-end start negotiating we register the domain that will use the PCI device. Furthermore during shutdown of guest or unbinding of the PCI device (and unloading of module) from pciback we unregister the domain owner. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/xen-pciback/xenbus.c')
-rw-r--r--drivers/xen/xen-pciback/xenbus.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index c0984cb442ca..a0cf7285d320 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -10,6 +10,7 @@
#include <linux/workqueue.h>
#include <xen/xenbus.h>
#include <xen/events.h>
+#include <asm/xen/pci.h>
#include <linux/workqueue.h>
#include "pciback.h"
@@ -221,6 +222,15 @@ static int pciback_export_device(struct pciback_device *pdev,
if (err)
goto out;
+ dev_dbg(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id);
+ if (xen_register_device_domain_owner(dev,
+ pdev->xdev->otherend_id) != 0) {
+ dev_err(&dev->dev, "device has been assigned to another " \
+ "domain! Over-writting the ownership, but beware.\n");
+ xen_unregister_device_domain_owner(dev);
+ xen_register_device_domain_owner(dev, pdev->xdev->otherend_id);
+ }
+
/* TODO: It'd be nice to export a bridge and have all of its children
* get exported with it. This may be best done in xend (which will
* have to calculate resource usage anyway) but we probably want to
@@ -251,6 +261,9 @@ static int pciback_remove_device(struct pciback_device *pdev,
goto out;
}
+ dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id);
+ xen_unregister_device_domain_owner(dev);
+
pciback_release_pci_dev(pdev, dev);
out:
OpenPOWER on IntegriCloud