[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Fix MSI cleanup.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1214988249 -3600 # Node ID 0076f6691b092d586615db830c25e01773c9fb81 # Parent 40e7329105fa47b2c2ee5d608e3061e527e07eeb x86: Fix MSI cleanup. Fixes bugzilla bug #1279. From: Haitao Shan <haitao.shan@xxxxxxxxx> Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/msi.c | 38 +++++++++++++++++++++++++++----------- xen/drivers/passthrough/io.c | 9 +++++++-- 2 files changed, 34 insertions(+), 13 deletions(-) diff -r 40e7329105fa -r 0076f6691b09 xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Wed Jul 02 09:42:37 2008 +0100 +++ b/xen/arch/x86/msi.c Wed Jul 02 09:44:09 2008 +0100 @@ -435,14 +435,6 @@ static void msi_free_vector(int vector) xfree(entry); } -void msi_free_vectors(struct pci_dev* dev) -{ - struct msi_desc *entry, *tmp; - - list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) - msi_free_vector(entry->vector); -} - static struct msi_desc *find_msi_entry(struct pci_dev *dev, int vector, int cap_id) { @@ -790,16 +782,40 @@ void pci_disable_msi(int vector) __pci_disable_msix(vector); } +extern struct hw_interrupt_type pci_msi_type; +static void msi_free_vectors(struct pci_dev* dev) +{ + struct msi_desc *entry, *tmp; + irq_desc_t *desc; + unsigned long flags; + + list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) + { + desc = &irq_desc[entry->vector]; + + spin_lock_irqsave(&desc->lock, flags); + if ( desc->handler == &pci_msi_type ) + { + /* MSI is not shared, so should be released already */ + BUG_ON(desc->status & IRQ_GUEST); + desc->handler = &no_irq_type; + } + spin_unlock_irqrestore(&desc->lock, flags); + + msi_free_vector(entry->vector); + } +} + void pci_cleanup_msi(u8 bus, u8 devfn) { struct pci_dev *dev = get_msi_pdev(bus, devfn); if ( !dev ) return; - msi_free_vectors(dev); /* Disable MSI and/or MSI-X */ msi_set_enable(dev, 0); msix_set_enable(dev, 0); -} - + msi_free_vectors(dev); +} + diff -r 40e7329105fa -r 0076f6691b09 xen/drivers/passthrough/io.c --- a/xen/drivers/passthrough/io.c Wed Jul 02 09:42:37 2008 +0100 +++ b/xen/drivers/passthrough/io.c Wed Jul 02 09:44:09 2008 +0100 @@ -75,13 +75,18 @@ int pt_irq_create_bind_vtd( { int pirq = pt_irq_bind->machine_irq; + if ( !(hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_VALID ) ) + { + hvm_irq_dpci->mirq[pirq].flags |= HVM_IRQ_DPCI_VALID | + HVM_IRQ_DPCI_MSI ; + pirq_guest_bind(d->vcpu[0], pirq, 0); + } + hvm_irq_dpci->mirq[pirq].flags |= HVM_IRQ_DPCI_VALID |HVM_IRQ_DPCI_MSI ; 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; - pirq_guest_bind(d->vcpu[0], pirq, BIND_PIRQ__WILL_SHARE); } else { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |