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

[Xen-changelog] [xen staging-4.11] iommu: leave IOMMU enabled by default during kexec crash transition



commit 793d669fc1ec682d875514a7f0c2af0e1e21d75e
Author:     Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
AuthorDate: Mon Mar 18 17:06:37 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Mar 18 17:06:37 2019 +0100

    iommu: leave IOMMU enabled by default during kexec crash transition
    
    It's unsafe to disable IOMMU on a live system which is the case
    if we're crashing since remapping hardware doesn't usually know what
    to do with ongoing bus transactions and frequently raises NMI/MCE/SMI,
    etc. (depends on the firmware configuration) to signal these abnormalities.
    This, in turn, doesn't play well with kexec transition process as there is
    no handling available at the moment for this kind of events resulting
    in failures to enter the kernel.
    
    Modern Linux kernels taught to copy all the necessary DMAR/IR tables
    following kexec from the previous kernel (Xen in our case) - so it's
    currently normal to keep IOMMU enabled. It might require minor changes to
    kdump command line that enables IOMMU drivers (e.g. intel_iommu=on /
    intremap=on) but recent kernels don't require any additional changes for
    the transition to be transparent.
    
    A fallback option is still left for compatibility with ancient crash
    kernels which didn't like to have IOMMU active under their feet on boot.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 12c36f577d454996c882ecdc5da8113ca2613646
    master date: 2019-03-12 14:38:12 +0100
---
 docs/misc/xen-command-line.markdown | 12 +++++++++++-
 xen/arch/x86/crash.c                |  7 +++++--
 xen/drivers/passthrough/iommu.c     |  8 ++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.markdown 
b/docs/misc/xen-command-line.markdown
index 0886706368..8046cc8333 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1096,7 +1096,7 @@ detection of systems known to misbehave upon accesses to 
that port.
 > Default: `new` unless directed-EOI is supported
 
 ### iommu
-> `= List of [ <boolean> | force | required | intremap | intpost | qinval | 
snoop | sharept | dom0-passthrough | dom0-strict | amd-iommu-perdev-intremap | 
workaround_bios_bug | igfx | verbose | debug ]`
+> `= List of [ <boolean> | force | required | intremap | intpost | qinval | 
snoop | sharept | dom0-passthrough | dom0-strict | amd-iommu-perdev-intremap | 
workaround_bios_bug | igfx | crash-disable | verbose | debug ]`
 
 > Sub-options:
 
@@ -1186,6 +1186,16 @@ detection of systems known to misbehave upon accesses to 
that port.
 >> to workaround graphics issues. If adding `no-igfx` fixes anything, you
 >> should file a bug reporting the problem.
 
+>  `crash-disable`
+
+> Default: `false`
+
+>> This option controls disabling IOMMU functionality (DMAR/IR/QI) before
+>> switching to a crash kernel. This option is inactive by default and
+>> is for compatibility with older kdump kernels only. Modern kernels copy
+>> all the necessary tables from the previous one following kexec which makes
+>>  the transition transparent for them with IOMMU functions still on.
+
 > `verbose`
 
 > Default: `false`
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 8d742582af..c9e483a9e5 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -165,8 +165,11 @@ static void nmi_shootdown_cpus(void)
         printk("Failed to shoot down CPUs {%s}\n", keyhandler_scratch);
     }
 
-    /* Crash shutdown any IOMMU functionality as the crashdump kernel is not
-     * happy when booting if interrupt/dma remapping is still enabled */
+    /*
+     * Try to crash shutdown IOMMU functionality as some old crashdump
+     * kernels are not happy when booting if interrupt/dma remapping
+     * is still enabled.
+     */
     iommu_crash_shutdown();
 
     __stop_this_cpu();
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index f9b13b018c..04b0be37d3 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -60,6 +60,7 @@ bool_t __read_mostly iommu_passthrough;
 bool_t __read_mostly iommu_snoop = 1;
 bool_t __read_mostly iommu_qinval = 1;
 bool_t __read_mostly iommu_intremap = 1;
+bool_t __read_mostly iommu_crash_disable;
 
 /*
  * In the current implementation of VT-d posted interrupts, in some extreme
@@ -112,6 +113,10 @@ static int __init parse_iommu_param(const char *s)
             iommu_intremap = val;
         else if ( !cmdline_strcmp(s, "intpost") )
             iommu_intpost = val;
+#ifdef CONFIG_KEXEC
+        else if ( !cmdline_strcmp(s, "crash-disable") )
+            iommu_crash_disable = val;
+#endif
         else if ( !cmdline_strcmp(s, "debug") )
         {
             iommu_debug = val;
@@ -452,6 +457,9 @@ void iommu_share_p2m_table(struct domain* d)
 
 void iommu_crash_shutdown(void)
 {
+    if ( !iommu_crash_disable )
+        return;
+
     if ( iommu_enabled )
         iommu_get_ops()->crash_shutdown();
     iommu_enabled = iommu_intremap = iommu_intpost = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.