aboutsummaryrefslogtreecommitdiff
path: root/hw/xen_pt.c
diff options
context:
space:
mode:
authorJiang Yunhong <yunhong.jiang@intel.com>2012-06-21 15:42:35 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-06-21 16:06:11 +0000
commit3854ca577dad92c4fe97b4a6ebce360e25407af7 (patch)
tree9d8f63d97e6dd0b139ea83d401d3fd968a0dcf79 /hw/xen_pt.c
parent9886c23aed27ceaa6d04ad2d72a21633d014eb2e (diff)
Introduce Xen PCI Passthrough, MSI
A more complete history can be found here: git://xenbits.xensource.com/qemu-xen-unstable.git Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Shan Haitao <haitao.shan@intel.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'hw/xen_pt.c')
-rw-r--r--hw/xen_pt.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/hw/xen_pt.c b/hw/xen_pt.c
index 92ad0fa518..3b6d1867ab 100644
--- a/hw/xen_pt.c
+++ b/hw/xen_pt.c
@@ -36,6 +36,20 @@
*
* Write '1'
* - Set real bit to '1'.
+ *
+ * MSI interrupt:
+ * Initialize MSI register(xen_pt_msi_setup, xen_pt_msi_update)
+ * Bind MSI(xc_domain_update_msi_irq)
+ * <fail>
+ * - Unmap MSI.
+ * - Set dev->msi->pirq to '-1'.
+ *
+ * MSI-X interrupt:
+ * Initialize MSI-X register(xen_pt_msix_update_one)
+ * Bind MSI-X(xc_domain_update_msi_irq)
+ * <fail>
+ * - Unmap MSI-X.
+ * - Set entry->pirq to '-1'.
*/
#include <sys/ioctl.h>
@@ -534,7 +548,15 @@ static void xen_pt_region_update(XenPCIPassthroughState *s,
};
bar = xen_pt_bar_from_region(s, mr);
- if (bar == -1) {
+ if (bar == -1 && (!s->msix || &s->msix->mmio != mr)) {
+ return;
+ }
+
+ if (s->msix && &s->msix->mmio == mr) {
+ if (adding) {
+ s->msix->mmio_base_addr = sec->offset_within_address_space;
+ rc = xen_pt_msix_update_remap(s, s->msix->bar_index);
+ }
return;
}
@@ -764,6 +786,13 @@ static int xen_pt_unregister_device(PCIDevice *d)
}
}
+ if (s->msi) {
+ xen_pt_msi_disable(s);
+ }
+ if (s->msix) {
+ xen_pt_msix_disable(s);
+ }
+
if (machine_irq) {
xen_pt_mapped_machine_irq[machine_irq]--;