]> xenbits.xen.org Git - xenclient/ioemu.git/commitdiff
passthrough: guest MSI config on disable
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 16 Apr 2009 10:47:04 +0000 (11:47 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 16 Apr 2009 10:47:04 +0000 (11:47 +0100)
It's possible for a guest to change the MSI vector or flags
when MSI is disabled, after it's first initialized. This patch
handles the address and data update when it's disabled.

Signed-off-by: Qing He <qing.he@intel.com>
hw/pass-through.c
hw/pt-msi.c

index 11382fd490ffa00243a3af566cc54a3f4f5ddfee..710acbfa41c60284466708fb6390d94bc870c318 100644 (file)
@@ -3436,7 +3436,7 @@ static int pt_msgaddr32_reg_write(struct pt_dev *ptdev,
     /* update MSI */
     if (cfg_entry->data != old_addr)
     {
-        if (ptdev->msi->flags & PCI_MSI_FLAGS_ENABLE)
+        if (ptdev->msi->flags & PT_MSI_MAPPED)
             pt_msi_update(ptdev);
     }
 
@@ -3474,7 +3474,7 @@ static int pt_msgaddr64_reg_write(struct pt_dev *ptdev,
     /* update MSI */
     if (cfg_entry->data != old_addr)
     {
-        if (ptdev->msi->flags & PCI_MSI_FLAGS_ENABLE)
+        if (ptdev->msi->flags & PT_MSI_MAPPED)
             pt_msi_update(ptdev);
     }
 
@@ -3516,7 +3516,7 @@ static int pt_msgdata_reg_write(struct pt_dev *ptdev,
     /* update MSI */
     if (cfg_entry->data != old_data)
     {
-        if (flags & PCI_MSI_FLAGS_ENABLE)
+        if (flags & PT_MSI_MAPPED)
             pt_msi_update(ptdev);
     }
 
index 4a54ba3378a72b6f40d98d4dc6dc792190f11086..9f4a3b3ec9f93c7f0ed78fa79226bd6c62ce3e4f 100644 (file)
@@ -110,10 +110,6 @@ uint32_t __get_msi_gflags(uint32_t data, uint64_t addr)
     return result;
 }
 
-/*
- * Update msi mapping, usually called when MSI enabled,
- * except the first time
- */
 int pt_msi_update(struct pt_dev *d)
 {
     uint8_t gvec = 0;
@@ -126,7 +122,8 @@ int pt_msi_update(struct pt_dev *d)
     addr = (uint64_t)d->msi->addr_hi << 32 | d->msi->addr_lo;
     gflags = __get_msi_gflags(d->msi->data, addr);
 
-    PT_LOG("Update msi with pirq %x gvec %x\n", d->msi->pirq, gvec);
+    PT_LOG("Update msi with pirq %x gvec %x gflags %x\n",
+           d->msi->pirq, gvec, gflags);
 
     ret = xc_domain_update_msi_irq(xc_handle, domid, gvec,
                                      d->msi->pirq, gflags, 0);