]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - arch/x86/mm/ioremap.c
mm: introduce include/linux/pgtable.h
[mirror_ubuntu-jammy-kernel.git] / arch / x86 / mm / ioremap.c
index 935a91e1fd7744a6af7e5e3bd1206ad4d197b067..0dbd3737110755d78a0b2d7105375417f5f8d9e7 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/e820/api.h>
 #include <asm/efi.h>
 #include <asm/fixmap.h>
-#include <asm/pgtable.h>
+#include <linux/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 #include <asm/memtype.h>
@@ -115,6 +115,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des
        if (!sev_active())
                return;
 
+       if (!IS_ENABLED(CONFIG_EFI))
+               return;
+
        if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
                desc->flags |= IORES_MAP_ENCRYPTED;
 }
@@ -775,10 +778,8 @@ void __init *early_memremap_encrypted(resource_size_t phys_addr,
 void __init *early_memremap_encrypted_wp(resource_size_t phys_addr,
                                         unsigned long size)
 {
-       /* Be sure the write-protect PAT entry is set for write-protect */
-       if (__pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] != _PAGE_CACHE_MODE_WP)
+       if (!x86_has_pat_wp())
                return NULL;
-
        return early_memremap_prot(phys_addr, size, __PAGE_KERNEL_ENC_WP);
 }
 
@@ -796,10 +797,8 @@ void __init *early_memremap_decrypted(resource_size_t phys_addr,
 void __init *early_memremap_decrypted_wp(resource_size_t phys_addr,
                                         unsigned long size)
 {
-       /* Be sure the write-protect PAT entry is set for write-protect */
-       if (__pte2cachemode_tbl[_PAGE_CACHE_MODE_WP] != _PAGE_CACHE_MODE_WP)
+       if (!x86_has_pat_wp())
                return NULL;
-
        return early_memremap_prot(phys_addr, size, __PAGE_KERNEL_NOENC_WP);
 }
 #endif /* CONFIG_AMD_MEM_ENCRYPT */
@@ -886,5 +885,5 @@ void __init __early_set_fixmap(enum fixed_addresses idx,
                set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
        else
                pte_clear(&init_mm, addr, pte);
-       __flush_tlb_one_kernel(addr);
+       flush_tlb_one_kernel(addr);
 }