aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r--drivers/iommu/amd_iommu_init.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 84b3e4445d46..3931c7de7c69 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -902,12 +902,22 @@ static bool copy_device_table(void)
902 } 902 }
903 } 903 }
904 904
905 old_devtb_phys = entry & PAGE_MASK; 905 /*
906 * When SME is enabled in the first kernel, the entry includes the
907 * memory encryption mask(sme_me_mask), we must remove the memory
908 * encryption mask to obtain the true physical address in kdump kernel.
909 */
910 old_devtb_phys = __sme_clr(entry) & PAGE_MASK;
911
906 if (old_devtb_phys >= 0x100000000ULL) { 912 if (old_devtb_phys >= 0x100000000ULL) {
907 pr_err("The address of old device table is above 4G, not trustworthy!\n"); 913 pr_err("The address of old device table is above 4G, not trustworthy!\n");
908 return false; 914 return false;
909 } 915 }
910 old_devtb = memremap(old_devtb_phys, dev_table_size, MEMREMAP_WB); 916 old_devtb = (sme_active() && is_kdump_kernel())
917 ? (__force void *)ioremap_encrypted(old_devtb_phys,
918 dev_table_size)
919 : memremap(old_devtb_phys, dev_table_size, MEMREMAP_WB);
920
911 if (!old_devtb) 921 if (!old_devtb)
912 return false; 922 return false;
913 923