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/
Home Products Support Community News


[Xen-devel] [PATCH 3/6] [events] Check if the PCI device is owner by a d

To: xen-devel@xxxxxxxxxxxxxxxxxxx, Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: [Xen-devel] [PATCH 3/6] [events] Check if the PCI device is owner by a domain different than DOMID_SELF.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Wed, 9 Dec 2009 11:29:30 -0500
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Wed, 09 Dec 2009 08:42:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1260376173-16973-3-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: <1260376173-16973-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1260376173-16973-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1260376173-16973-3-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
We check if there is a domain owner for the PCI device. In case of failure
(meaning no domain has registered for this device) we make
DOMID_SELF the owner.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
 drivers/xen/events.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index f8bbf4c..d122022 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -39,6 +39,7 @@
 #include <asm/sync_bitops.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
+#include <asm/xen/pci.h>
 #include <xen/xen-ops.h>
 #include <xen/events.h>
@@ -633,10 +634,14 @@ int xen_create_msi_irq(struct pci_dev *dev, struct 
msi_desc *msidesc,
        int irq = 0;
        struct physdev_map_pirq map_irq;
        int rc;
-       domid_t domid = DOMID_SELF;
+       domid_t domid;
        int pos;
        u32 table_offset, bir;
+       domid = rc = find_device_owner(dev);
+       if (rc < 0)
+               domid = DOMID_SELF;
        memset(&map_irq, 0, sizeof(map_irq));
        map_irq.domid = domid;
        map_irq.type = MAP_PIRQ_TYPE_MSI;

Xen-devel mailing list