|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH 1/2] passthrough: allow pt_bind_irq for msi update
This patch extends 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>
---
diff -r accf139b2eb9 xen/drivers/passthrough/io.c
--- a/xen/drivers/passthrough/io.c Mon Apr 06 21:12:33 2009 +0100
+++ b/xen/drivers/passthrough/io.c Wed Apr 15 17:22:11 2009 +0800
@@ -148,12 +148,23 @@
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)
+ else
+ {
+ uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
+ uint32_t old_gvec;
- {
- spin_unlock(&d->event_lock);
- return -EBUSY;
+ 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|