From 3854ca577dad92c4fe97b4a6ebce360e25407af7 Mon Sep 17 00:00:00 2001 From: Jiang Yunhong Date: Thu, 21 Jun 2012 15:42:35 +0000 Subject: 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 Signed-off-by: Shan Haitao Signed-off-by: Anthony PERARD Acked-by: Stefano Stabellini --- hw/xen_pt.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'hw/xen_pt.c') 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) + * + * - 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) + * + * - Unmap MSI-X. + * - Set entry->pirq to '-1'. */ #include @@ -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]--; -- cgit 1.4.1