]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/vMSI-X: also snoop qword writes
authorJan Beulich <jbeulich@suse.com>
Thu, 28 Apr 2016 13:10:45 +0000 (15:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 28 Apr 2016 13:10:45 +0000 (15:10 +0200)
... the high half of which may be a write to the Vector Control field.
This gets things in sync again with msixtbl_write().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/hvm/vmsi.c

index d07f0c45c43cd6af2c9226ddbd1d4a6a7d944c13..d72c568f5cba8330e5987fe900a7f1ec9e6abe21 100644 (file)
@@ -336,6 +336,7 @@ out:
 static int msixtbl_range(struct vcpu *v, unsigned long addr)
 {
     const struct msi_desc *desc;
+    const ioreq_t *r;
 
     rcu_read_lock(&msixtbl_rcu_lock);
     desc = msixtbl_addr_to_desc(msixtbl_find_entry(v, addr), addr);
@@ -344,17 +345,29 @@ static int msixtbl_range(struct vcpu *v, unsigned long addr)
     if ( desc )
         return 1;
 
-    if ( (addr & (PCI_MSIX_ENTRY_SIZE - 1)) ==
-         PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET )
+    r = &v->arch.hvm_vcpu.hvm_io.io_req;
+    if ( r->state != STATE_IOREQ_READY || r->addr != addr )
+        return 0;
+    ASSERT(r->type == IOREQ_TYPE_COPY);
+    if ( r->dir == IOREQ_WRITE )
     {
-        const ioreq_t *r = &v->arch.hvm_vcpu.hvm_io.io_req;
-
-        if ( r->state != STATE_IOREQ_READY || r->addr != addr )
-            return 0;
-        ASSERT(r->type == IOREQ_TYPE_COPY);
-        if ( r->dir == IOREQ_WRITE && r->size == 4 && !r->data_is_ptr
-             && !(r->data & PCI_MSIX_VECTOR_BITMASK) )
-            v->arch.hvm_vcpu.hvm_io.msix_snoop_address = addr;
+        if ( !r->data_is_ptr )
+        {
+            unsigned int size = r->size;
+            uint64_t data = r->data;
+
+            if ( size == 8 )
+            {
+                BUILD_BUG_ON(!(PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET & 4));
+                data >>= 32;
+                addr += size = 4;
+            }
+            if ( size == 4 &&
+                 ((addr & (PCI_MSIX_ENTRY_SIZE - 1)) ==
+                  PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET) &&
+                 !(data & PCI_MSIX_VECTOR_BITMASK) )
+                v->arch.hvm_vcpu.hvm_io.msix_snoop_address = addr;
+        }
     }
 
     return 0;