Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / arch / x86 / mm / mem_encrypt_amd.c
index 9745268..9c4d8db 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/tlbflush.h>
 #include <asm/fixmap.h>
 #include <asm/setup.h>
+#include <asm/mem_encrypt.h>
 #include <asm/bootparam.h>
 #include <asm/set_memory.h>
 #include <asm/cacheflush.h>
@@ -486,8 +487,6 @@ void __init early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, boo
 
 void __init sme_early_init(void)
 {
-       unsigned int i;
-
        if (!sme_me_mask)
                return;
 
@@ -496,8 +495,7 @@ void __init sme_early_init(void)
        __supported_pte_mask = __sme_set(__supported_pte_mask);
 
        /* Update the protection map with memory encryption mask */
-       for (i = 0; i < ARRAY_SIZE(protection_map); i++)
-               protection_map[i] = pgprot_encrypted(protection_map[i]);
+       add_encrypt_protection_map();
 
        x86_platform.guest.enc_status_change_prepare = amd_enc_status_change_prepare;
        x86_platform.guest.enc_status_change_finish  = amd_enc_status_change_finish;