qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Xen: enabling emulated MSI injection


From: Wei Liu
Subject: [Qemu-devel] Xen: enabling emulated MSI injection
Date: Thu, 26 May 2011 12:57:41 +0800

commit 0ad7c9289253b9fd496ac695ce5bf1f23027d97a
Author: Wei Liu <address@hidden>
Date:   Thu May 26 10:16:18 2011 +0800

    MSI injection for Xen.

    This is supposed to be used in conjunction with Xen's
    new hypercall interface for emualted MSI injection.

    Signed-off-by: Wei Liu <address@hidden>

diff --git a/hw/msix.c b/hw/msix.c
index af40e26..1057eff 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -15,6 +15,7 @@
 #include "msix.h"
 #include "pci.h"
 #include "range.h"
+#include "xen.h"

 /* MSI-X capability structure */
 #define MSIX_TABLE_OFFSET 4
@@ -369,7 +370,12 @@ void msix_notify(PCIDevice *dev, unsigned vector)
     address = pci_get_long(table_entry + MSIX_MSG_UPPER_ADDR);
     address = (address << 32) | pci_get_long(table_entry + MSIX_MSG_ADDR);
     data = pci_get_long(table_entry + MSIX_MSG_DATA);
-    stl_phys(address, data);
+
+    if (xen_enabled()) {
+        xen_hvm_inj_msi(address, data);
+    } else {
+        stl_phys(address, data);
+    }
 }

 void msix_reset(PCIDevice *dev)
diff --git a/hw/xen.h b/hw/xen.h
index d435ca0..11a3c4a 100644
--- a/hw/xen.h
+++ b/hw/xen.h
@@ -43,6 +43,7 @@ static inline int xen_mapcache_enabled(void)
 int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num);
 void xen_piix3_set_irq(void *opaque, int irq_num, int level);
 void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len);
+void xen_hvm_inj_msi(uint64_t addr, uint32_t data);
 void xen_cmos_set_s3_resume(void *opaque, int irq, int level);

 qemu_irq *xen_interrupt_controller_init(void);
diff --git a/xen-all.c b/xen-all.c
index 0944673..a553992 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -100,6 +100,11 @@ void xen_piix_pci_write_config_client(uint32_t
address, uint32_t val, int len)
     }
 }

+void xen_hvm_inj_msi(uint64_t addr, uint32_t data)
+{
+    xc_hvm_inj_msi(xen_xc, xen_domid, addr, data);
+}
+
 void xen_cmos_set_s3_resume(void *opaque, int irq, int level)
 {
     pc_cmos_set_s3_resume(opaque, irq, level);
diff --git a/xen-stub.c b/xen-stub.c
index a4f35a1..c18c62f 100644
--- a/xen-stub.c
+++ b/xen-stub.c
@@ -39,3 +39,7 @@ int xen_init(void)
 {
     return -ENOSYS;
 }
+
+void xen_hvm_inj_msi(uint64_t addr, uint32_t data)
+{
+}

-- 
Best regards
Wei Liu
Twitter: @iliuw
Site: http://liuw.name



reply via email to

[Prev in Thread] Current Thread [Next in Thread]