[PATCH 4/5 V5] Adjust some permanent mappings in unencrypted ways for kdump when SME is enabled.

From: Lianbo Jiang
Date: Mon Jul 02 2018 - 03:27:28 EST


For kdump, the acpi table and dmi table will need to be remapped in
unencrypted ways during early init, they have just a simple wrapper
around early_memremap(), but the early_memremap() remaps the memory
in encrypted ways by default when SME is enabled, so we put some logic
into the early_memremap_pgprot_adjust(), which will have an opportunity
to adjust it.

Signed-off-by: Lianbo Jiang <lijiang@xxxxxxxxxx>
---
arch/x86/mm/ioremap.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index e01e6c6..3c1c8c4 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -689,8 +689,17 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr,
encrypted_prot = true;

if (sme_active()) {
+ /*
+ * In kdump mode, the acpi table and dmi table will need to
+ * be remapped in unencrypted ways during early init when
+ * SME is enabled. They have just a simple wrapper around
+ * early_memremap(), but the early_memremap() remaps the
+ * memory in encrypted ways by default when SME is enabled,
+ * so we must adjust it.
+ */
if (early_memremap_is_setup_data(phys_addr, size) ||
- memremap_is_efi_data(phys_addr, size))
+ memremap_is_efi_data(phys_addr, size) ||
+ is_kdump_kernel())
encrypted_prot = false;
}

--
2.9.5