# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1210583200 -3600
# Node ID 5c00188dd159825e47547da59f691b2a3c59ac44
# Parent 14d362d5fa5913a2e917cdd0ca90cf3b898a45d7
x86 hvm: Clean MSI related data when destroy domain.
Signed-off-by: Shan Haitao <Haitao.shan@xxxxxxxxx>
---
xen/arch/x86/msi.c | 16 ++++++++++++----
xen/drivers/passthrough/vtd/iommu.c | 1 +
xen/include/asm-x86/msi.h | 1 +
3 files changed, 14 insertions(+), 4 deletions(-)
diff -r 14d362d5fa59 -r 5c00188dd159 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c Mon May 12 10:01:01 2008 +0100
+++ b/xen/arch/x86/msi.c Mon May 12 10:06:40 2008 +0100
@@ -780,8 +780,16 @@ void pci_disable_msi(int vector)
__pci_disable_msix(vector);
}
-void pci_cleanup_msi(struct pci_dev *dev)
-{
+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);
+}
+
diff -r 14d362d5fa59 -r 5c00188dd159 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Mon May 12 10:01:01 2008 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c Mon May 12 10:06:40 2008 +0100
@@ -1434,6 +1434,7 @@ void return_devices_to_dom0(struct domai
while ( !list_empty(&hd->pdev_list) )
{
pdev = list_entry(hd->pdev_list.next, typeof(*pdev), list);
+ pci_cleanup_msi(pdev->bus, pdev->devfn);
reassign_device_ownership(d, dom0, pdev->bus, pdev->devfn);
}
diff -r 14d362d5fa59 -r 5c00188dd159 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h Mon May 12 10:01:01 2008 +0100
+++ b/xen/include/asm-x86/msi.h Mon May 12 10:06:40 2008 +0100
@@ -68,6 +68,7 @@ extern void set_msi_irq_affinity(unsigne
extern void set_msi_irq_affinity(unsigned int irq, cpumask_t mask);
extern int pci_enable_msi(u8 bus, u8 devfn, int vector, int entry_nr, int msi);
extern void pci_disable_msi(int vector);
+extern void pci_cleanup_msi(u8 bus, u8 devfn);
struct msi_desc {
struct {
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|