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

[Xen-changelog] [xen-unstable] IOMMU: add crash_shutdown iommu_op



# HG changeset patch
# User Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
# Date 1308150611 -3600
# Node ID c6307ddd3ab18432a495ac261be8ad6708d7b665
# Parent  96f53d2b966ec86979d0080f15b8d86b2856c736
IOMMU: add crash_shutdown iommu_op

The kdump kernel has problems booting with interrupt/dma
remapping enabled, so we need a new iommu_ops called
crash_shutdown which is basically suspend but doesn't
need to bother saving state.

Make sure that crash_shutdown is called on the kexec
path.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---


diff -r 96f53d2b966e -r c6307ddd3ab1 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c      Wed Jun 15 16:07:45 2011 +0100
+++ b/xen/arch/x86/crash.c      Wed Jun 15 16:10:11 2011 +0100
@@ -77,6 +77,10 @@
         msecs--;
     }
 
+    /* Crash shutdown any IOMMU functionality as the crashdump kernel is not
+     * happy when booting if interrupt/dma remapping is still enabled */
+    iommu_crash_shutdown();
+
     __stop_this_cpu();
     disable_IO_APIC();
 }
diff -r 96f53d2b966e -r c6307ddd3ab1 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Jun 15 16:07:45 
2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Jun 15 16:10:11 
2011 +0100
@@ -456,4 +456,5 @@
     .suspend = amd_iommu_suspend,
     .resume = amd_iommu_resume,
     .share_p2m = amd_iommu_share_p2m,
+    .crash_shutdown = amd_iommu_suspend,
 };
diff -r 96f53d2b966e -r c6307ddd3ab1 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c   Wed Jun 15 16:07:45 2011 +0100
+++ b/xen/drivers/passthrough/iommu.c   Wed Jun 15 16:10:11 2011 +0100
@@ -432,6 +432,14 @@
         ops->share_p2m(d);
 }
 
+void iommu_crash_shutdown(void)
+{
+    const struct iommu_ops *ops = iommu_get_ops();
+    if ( iommu_enabled )
+        ops->crash_shutdown();
+    iommu_enabled = 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 96f53d2b966e -r c6307ddd3ab1 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Wed Jun 15 16:07:45 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Wed Jun 15 16:10:11 2011 +0100
@@ -2235,6 +2235,25 @@
     }
 }
 
+static void vtd_crash_shutdown(void)
+{
+    struct acpi_drhd_unit *drhd;
+    struct iommu *iommu;
+
+    if ( !iommu_enabled )
+        return;
+
+    iommu_flush_all();
+
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        iommu_disable_translation(iommu);
+        disable_intremap(drhd->iommu);
+        disable_qinval(drhd->iommu);
+    }
+}
+
 static void vtd_resume(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -2286,6 +2305,7 @@
     .suspend = vtd_suspend,
     .resume = vtd_resume,
     .share_p2m = iommu_set_pgd,
+    .crash_shutdown = vtd_crash_shutdown,
 };
 
 /*
diff -r 96f53d2b966e -r c6307ddd3ab1 
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Wed Jun 15 16:07:45 
2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Wed Jun 15 16:10:11 
2011 +0100
@@ -102,6 +102,7 @@
 /* power management support */
 void amd_iommu_resume(void);
 void amd_iommu_suspend(void);
+void amd_iommu_crash_shutdown(void);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff -r 96f53d2b966e -r c6307ddd3ab1 xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h   Wed Jun 15 16:07:45 2011 +0100
+++ b/xen/include/xen/iommu.h   Wed Jun 15 16:10:11 2011 +0100
@@ -133,6 +133,7 @@
     void (*suspend)(void);
     void (*resume)(void);
     void (*share_p2m)(struct domain *d);
+    void (*crash_shutdown)(void);
 };
 
 void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned 
int value);
@@ -142,6 +143,7 @@
 
 void iommu_suspend(void);
 void iommu_resume(void);
+void iommu_crash_shutdown(void);
 
 void iommu_set_dom0_mapping(struct domain *d);
 void iommu_share_p2m_table(struct domain *d);

_______________________________________________
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®.