[PATCH 4/4] iommu/vt-d: Make sure si_domain is allocated for kdump kernel

From: Joerg Roedel
Date: Thu Jun 11 2015 - 09:48:21 EST


From: Joerg Roedel <jroedel@xxxxxxx>

The si_domain needs to be allocated in the kdump kernel too.
Otherwise the iommu=pt case breaks with a panic of the kdump
kernel.

Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
---
drivers/iommu/intel-iommu.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index fcb9310..e5af94a 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2781,10 +2781,6 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
int i;
int ret = 0;

- ret = si_domain_init(hw);
- if (ret)
- return -EFAULT;
-
for_each_pci_dev(pdev) {
ret = dev_prepare_static_identity_mapping(&pdev->dev, hw);
if (ret)
@@ -2798,7 +2794,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)

if (dev->bus != &acpi_bus_type)
continue;
-
+
adev= to_acpi_device(dev);
mutex_lock(&adev->physical_node_lock);
list_for_each_entry(pn, &adev->physical_node_list, node) {
@@ -2979,9 +2975,20 @@ static int __init init_dmars(void)
check_tylersburg_isoch();

/*
- * In the second kernel: Skip setting-up new domains for
- * si, rmrr, and the isa bus on the expectation that these
- * translations were copied from the old kernel.
+ * Make sure the si_domain is allocated in the case we are in a
+ * kdump kernel.
+ */
+ if (iommu_identity_mapping) {
+ ret = si_domain_init(hw_pass_through);
+ if (ret)
+ goto free_iommu;
+ }
+
+ /*
+ * In the second kernel: Skip setting-up new domains for rmrr
+ * and the isa bus, they will be allocated and assigned on the
+ * first DMA-API call. This is to keep the old mappings alive
+ * until the device driver of the kdump kernel takes over.
*/
if (g_translation_pre_enabled)
goto skip_new_domains_for_si_rmrr_isa;
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/