aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-03-28 11:04:52 -0400
committerJoerg Roedel <jroedel@suse.de>2017-03-29 11:02:00 -0400
commit161b28aae1651aa7ad63ec14753aa8a751154340 (patch)
treedc2c8bc17bf9c15d575762bf5fcb0b415ab0cbc1
parent61012985eb132a2fa5e4a3eddbc33528334fa377 (diff)
iommu/vt-d: Make sure IOMMUs are off when intel_iommu=off
When booting into a kexec kernel with intel_iommu=off, and the previous kernel had intel_iommu=on, the IOMMU hardware is still enabled and gets not disabled by the new kernel. This causes the boot to fail because DMA is blocked by the hardware. Disable the IOMMUs when we find it enabled in the kexec kernel and boot with intel_iommu=off. Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/intel-iommu.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 238ad3447712..5f08ba13972b 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4730,6 +4730,15 @@ static int intel_iommu_cpu_dead(unsigned int cpu)
4730 return 0; 4730 return 0;
4731} 4731}
4732 4732
4733static void intel_disable_iommus(void)
4734{
4735 struct intel_iommu *iommu = NULL;
4736 struct dmar_drhd_unit *drhd;
4737
4738 for_each_iommu(iommu, drhd)
4739 iommu_disable_translation(iommu);
4740}
4741
4733static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev) 4742static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)
4734{ 4743{
4735 return container_of(dev, struct intel_iommu, iommu.dev); 4744 return container_of(dev, struct intel_iommu, iommu.dev);
@@ -4840,8 +4849,15 @@ int __init intel_iommu_init(void)
4840 goto out_free_dmar; 4849 goto out_free_dmar;
4841 } 4850 }
4842 4851
4843 if (no_iommu || dmar_disabled) 4852 if (no_iommu || dmar_disabled) {
4853 /*
4854 * Make sure the IOMMUs are switched off, even when we
4855 * boot into a kexec kernel and the previous kernel left
4856 * them enabled
4857 */
4858 intel_disable_iommus();
4844 goto out_free_dmar; 4859 goto out_free_dmar;
4860 }
4845 4861
4846 if (list_empty(&dmar_rmrr_units)) 4862 if (list_empty(&dmar_rmrr_units))
4847 pr_info("No RMRR found\n"); 4863 pr_info("No RMRR found\n");