WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 4/6] [pciback] Register the owner (domain) of the

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 4/6] [pciback] Register the owner (domain) of the PCI device.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 09 Dec 2009 13:13:00 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 09 Dec 2009 13:14:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1260391901-16685-5-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1260391901-16685-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1260391901-16685-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1260391901-16685-3-git-send-email-konrad.wilk@xxxxxxxxxx> <1260391901-16685-4-git-send-email-konrad.wilk@xxxxxxxxxx> <1260391901-16685-5-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091125 Fedora/3.0-3.12.rc1.fc12 Lightning/1.0pre Thunderbird/3.0
On 12/09/09 12:51, Konrad Rzeszutek Wilk wrote:
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.
  Please enter the commit message for your changes. Lines starting
Looks like a stray.

Signed-off-by: Konrad Rzeszutek Wilk<konrad.wilk@xxxxxxxxxx>
---
  drivers/xen/pciback/pci_stub.c |    3 +++
  drivers/xen/pciback/xenbus.c   |   12 ++++++++++++
  2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/pciback/pci_stub.c b/drivers/xen/pciback/pci_stub.c
index c65c7c1..00018c1 100644
--- a/drivers/xen/pciback/pci_stub.c
+++ b/drivers/xen/pciback/pci_stub.c
@@ -14,6 +14,7 @@
  #include<linux/wait.h>
  #include<asm/atomic.h>
  #include<xen/events.h>
+#include<asm/xen/pci.h>
  #include "pciback.h"
  #include "conf_space.h"
  #include "conf_space_quirks.h"
@@ -87,6 +88,8 @@ static void pcistub_device_release(struct kref *kref)

        dev_dbg(&psdev->dev->dev, "pcistub_device_release\n");

+       unregister_device_owner(psdev->dev);
+
        /* Clean-up the device */
        pciback_reset_device(psdev->dev);
        pciback_config_free_dyn_fields(psdev->dev);
diff --git a/drivers/xen/pciback/xenbus.c b/drivers/xen/pciback/xenbus.c
index efec585..e33a688 100644
--- a/drivers/xen/pciback/xenbus.c
+++ b/drivers/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,14 @@ static int pciback_export_device(struct pciback_device 
*pdev,
        if (err)
                goto out;

+       dev_info(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id);
_dbg, to match unregistering message?

+       if (register_device_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");
+               unregister_device_owner(dev);
+               register_device_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 +260,9 @@ static int pciback_remove_device(struct pciback_device 
*pdev,
                goto out;
        }

+       dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id);
+       unregister_device_owner(dev);
+
        pciback_release_pci_dev(pdev, dev);

  out:


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>