From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com
Cc: Jan Beulich <JBeulich@novell.com>,
linux-kernel@vger.kernel.org,
Jeremy Fitzhardinge <jeremy@goop.org>,
Konrad Rzeszutek Wilk <konrad@kernel.org>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: [PATCH 3/9] xen: Check if the PCI device is owned by a domain different than DOMID_SELF.
Date: Mon, 13 Dec 2010 13:01:37 -0500 [thread overview]
Message-ID: <1292263303-31680-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1292263303-31680-1-git-send-email-konrad.wilk@oracle.com>
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.
[v2: deal with rebasing on v2.6.37-1]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
drivers/xen/events.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index a04da4b..96c93e7 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -40,6 +40,7 @@
#include <asm/xen/pci.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
+#include <asm/xen/pci.h>
#include <xen/xen.h>
#include <xen/hvm.h>
@@ -97,6 +98,7 @@ struct irq_info
unsigned short gsi;
unsigned char vector;
unsigned char flags;
+ uint16_t domid;
} pirq;
} u;
};
@@ -158,7 +160,8 @@ static struct irq_info mk_pirq_info(unsigned short evtchn, unsigned short pirq,
{
return (struct irq_info) { .type = IRQT_PIRQ, .evtchn = evtchn,
.cpu = 0,
- .u.pirq = { .pirq = pirq, .gsi = gsi, .vector = vector } };
+ .u.pirq = { .pirq = pirq, .gsi = gsi,
+ .vector = vector, .domid = DOMID_SELF } };
}
/*
@@ -688,11 +691,16 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
int irq = -1;
struct physdev_map_pirq map_irq;
int rc;
+ domid_t domid;
int pos;
u32 table_offset, bir;
+ domid = rc = xen_find_device_domain_owner(dev);
+ if (rc < 0)
+ domid = DOMID_SELF;
+
memset(&map_irq, 0, sizeof(map_irq));
- map_irq.domid = DOMID_SELF;
+ map_irq.domid = domid;
map_irq.type = MAP_PIRQ_TYPE_MSI;
map_irq.index = -1;
map_irq.pirq = -1;
@@ -727,6 +735,8 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
goto out;
}
irq_info[irq] = mk_pirq_info(0, map_irq.pirq, 0, map_irq.index);
+ if (domid)
+ irq_info[irq].u.pirq.domid = domid;
set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
handle_level_irq,
@@ -753,7 +763,7 @@ int xen_destroy_irq(int irq)
if (xen_initial_domain()) {
unmap_irq.pirq = info->u.pirq.gsi;
- unmap_irq.domid = DOMID_SELF;
+ unmap_irq.domid = info->u.pirq.domid;
rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap_irq);
if (rc) {
printk(KERN_WARNING "unmap irq failed %d\n", rc);
--
1.7.1
next prev parent reply other threads:[~2010-12-13 18:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 18:01 [PATCH v2] Xen PCI backend driver Konrad Rzeszutek Wilk
2010-12-13 18:01 ` [PATCH 1/9] xen: export xen_gsi_from_irq, it is required by modular pciback Konrad Rzeszutek Wilk
2010-12-13 18:01 ` [PATCH 2/9] xen/pci: Add xen_[find|register|unregister]_device_domain_owner functions Konrad Rzeszutek Wilk
2010-12-13 19:28 ` Jeremy Fitzhardinge
2010-12-13 18:01 ` Konrad Rzeszutek Wilk [this message]
2010-12-13 18:01 ` [PATCH 4/9] xen: Add support to check if IRQ line is shared with other domains Konrad Rzeszutek Wilk
2010-12-13 19:34 ` Jeremy Fitzhardinge
2010-12-13 18:01 ` [PATCH 5/9] xen: implement bind_interdomain_evtchn_to_irqhandler for backend drivers Konrad Rzeszutek Wilk
2010-12-13 18:01 ` [PATCH 6/9] pci/xen: Make xen_[find|register|unregister]_domain_owner be _GPL Konrad Rzeszutek Wilk
2010-12-13 19:18 ` Jeremy Fitzhardinge
2010-12-13 18:01 ` [PATCH 7/9] xen-pciback: Backend driver for Xen pci-front Konrad Rzeszutek Wilk
2010-12-13 18:01 ` [PATCH 8/9] xen/pciback: Fix checkpatch warnings and errors Konrad Rzeszutek Wilk
2010-12-13 18:01 ` [PATCH 9/9] xen/xen-pciback: Swap over to DEFINE_PCI_DEVICE_TABLE Konrad Rzeszutek Wilk
2010-12-14 10:08 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1292263303-31680-4-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@novell.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=jeremy@goop.org \
--cc=konrad@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).