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

[Xen-changelog] [xen-unstable] passthrough: allow pt_bind_irq for msi update



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1239806337 -3600
# Node ID 3e64dfebabd7340f5852ad112c858efcebc9cae5
# Parent  b2c43b0fba713912d8ced348b5d628743e52d8be
passthrough: allow pt_bind_irq for msi update

Extend pt_bind_irq to handle the update of msi guest
vector and flag.

Unbind and rebind using separate hypercalls may not be viable
sometime.
For example, the guest may update MSI address/data on fly without
disabling it first (e.g. change delivery/destination), implement these
updates in such a way may result in interrupt loss.

Signed-off-by: Qing He <qing.he@xxxxxxxxx>
---
 xen/drivers/passthrough/io.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff -r b2c43b0fba71 -r 3e64dfebabd7 xen/drivers/passthrough/io.c
--- a/xen/drivers/passthrough/io.c      Wed Apr 15 11:25:07 2009 +0100
+++ b/xen/drivers/passthrough/io.c      Wed Apr 15 15:38:57 2009 +0100
@@ -148,12 +148,23 @@ int pt_irq_create_bind_vtd(
                 return rc;
             }
         }
-        else if (hvm_irq_dpci->mirq[pirq].gmsi.gvec != pt_irq_bind->u.msi.gvec
-                ||hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] != pirq)
-
-        {
-            spin_unlock(&d->event_lock);
-            return -EBUSY;
+        else
+        {
+            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
+            uint32_t old_gvec;
+
+            if ( (hvm_irq_dpci->mirq[pirq].flags & mask) != mask)
+            {
+                   spin_unlock(&d->event_lock);
+                   return -EBUSY;
+            }
+ 
+            /* if pirq is already mapped as vmsi, update the guest data/addr */
+            old_gvec = hvm_irq_dpci->mirq[pirq].gmsi.gvec;
+            hvm_irq_dpci->msi_gvec_pirq[old_gvec] = 0;
+            hvm_irq_dpci->mirq[pirq].gmsi.gvec = pt_irq_bind->u.msi.gvec;
+            hvm_irq_dpci->mirq[pirq].gmsi.gflags = pt_irq_bind->u.msi.gflags;
+            hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = pirq;
         }
     }
     else

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.