aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-04-15 15:38:57 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-04-15 15:38:57 +0100
commit9c854741d6438425523253c4cdfc46320acc14f8 (patch)
tree6c33ba2a28854f557efa65065301c482ae6d89c4
parent19c624b57a2a6c1af0e466d6888317138052105f (diff)
downloadxen-9c854741d6438425523253c4cdfc46320acc14f8.tar.gz
xen-9c854741d6438425523253c4cdfc46320acc14f8.tar.bz2
xen-9c854741d6438425523253c4cdfc46320acc14f8.zip
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@intel.com>
-rw-r--r--xen/drivers/passthrough/io.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index bdb0d4606a..18b4a6c4d3 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -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)
-
+ else
{
- spin_unlock(&d->event_lock);
- return -EBUSY;
+ 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