WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2/2] ioemu: guest MSI config on disable

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2/2] ioemu: guest MSI config on disable
From: Qing He <qing.he@xxxxxxxxx>
Date: Wed, 15 Apr 2009 21:41:17 +0800
Delivery-date: Wed, 15 Apr 2009 06:41:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1239802877-8510-1-git-send-email-qing.he@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <> <1239802877-8510-1-git-send-email-qing.he@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxx>
---
diff --git a/hw/pass-through.c b/hw/pass-through.c
index 95b4a47..030102d 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -3354,7 +3354,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);
     }
 
@@ -3392,7 +3392,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);
     }
 
@@ -3434,7 +3434,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);
     }
 
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index d28038a..118f3c5 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -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;
@@ -125,7 +121,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, gflag %x\n",
+           d->msi->pirq, gvec, gflags);
     return xc_domain_update_msi_irq(xc_handle, domid, gvec,
                                      d->msi->pirq, gflags, 0);
 }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel