]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/msixtbl: disable MSI-X intercepts for domains without an ioreq server
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 22 Sep 2016 14:52:42 +0000 (16:52 +0200)
committerRoger Pau Monne <roger.pau@citrix.com>
Wed, 2 Nov 2016 17:34:51 +0000 (18:34 +0100)
The current msixtbl intercepts only partially trap MSI-X accesses, but are
not complete, there's missing logic in order to setup PIRQs and bind them to
domains. Disable them for domains without at least an ioreq server (PVH).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Paul Durrant <paul.durrant@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
NB: this is a preparatory patch for introducing a complete MSI-X emulation
layer into Xen. Long term the current msixtbl code should be replaced with
the complete MSI-X emulation introduced in later patches.

xen/arch/x86/hvm/ioreq.c
xen/drivers/passthrough/io.c
xen/include/asm-x86/hvm/ioreq.h

index d2245e298299fe5f064ba1420f5a29ae36723bd2..b09fa96a54d42ce01d4d2cf8a09c9b7ee9930f4e 100644 (file)
@@ -772,6 +772,17 @@ int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id)
     return rc;
 }
 
+int hvm_has_ioreq_server(struct domain *d)
+{
+    int empty;
+
+    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+    empty = list_empty(&d->arch.hvm_domain.ioreq_server.list);
+    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
+
+    return !empty;
+}
+
 int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
                               unsigned long *ioreq_pfn,
                               unsigned long *bufioreq_pfn,
index edd8dbd0d5eb8d60ae670788017f3ee552449e6a..1e5e3655b986fc5e8eec910dc813b1770e92dd07 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/hvm/irq.h>
 #include <asm/hvm/support.h>
 #include <xen/hvm/irq.h>
+#include <asm/hvm/ioreq.h>
 #include <asm/io_apic.h>
 
 static DEFINE_PER_CPU(struct list_head, dpci_list);
@@ -384,7 +385,8 @@ int pt_irq_create_bind(
             pirq_dpci->dom = d;
             /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
             rc = pirq_guest_bind(d->vcpu[0], info, 0);
-            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
+            if ( rc == 0 && pt_irq_bind->u.msi.gtable &&
+                 hvm_has_ioreq_server(d) )
             {
                 rc = msixtbl_pt_register(d, info, pt_irq_bind->u.msi.gtable);
                 if ( unlikely(rc) )
index fbf2c749289af1651a9ce4bc6af17a0269658242..6456cd2a2ccc890572f91b5cb4533ad5ea22523f 100644 (file)
@@ -31,6 +31,7 @@ int hvm_get_ioreq_server_info(struct domain *d, ioservid_t id,
                               unsigned long *ioreq_pfn,
                               unsigned long *bufioreq_pfn,
                               evtchn_port_t *bufioreq_port);
+int hvm_has_ioreq_server(struct domain *d);
 int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
                                      uint32_t type, uint64_t start,
                                      uint64_t end);