]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/x86/include/asm/page_types.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_PAGE_DEFS_H
3 #define _ASM_X86_PAGE_DEFS_H
5 #include <linux/const.h>
6 #include <linux/types.h>
7 #include <linux/mem_encrypt.h>
9 /* PAGE_SHIFT determines the page size */
11 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
12 #define PAGE_MASK (~(PAGE_SIZE-1))
14 #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
15 #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
17 #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
18 #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
20 #define __PHYSICAL_MASK ((phys_addr_t)(__sme_clr((1ULL << __PHYSICAL_MASK_SHIFT) - 1)))
21 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
23 /* Cast *PAGE_MASK to a signed type so that it is sign-extended if
24 virtual addresses are 32-bits but physical addresses are larger
26 #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
27 #define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
28 #define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
30 #define HPAGE_SHIFT PMD_SHIFT
31 #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
32 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
33 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
35 #define HUGE_MAX_HSTATE 2
37 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
39 #define VM_DATA_DEFAULT_FLAGS \
40 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
41 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
43 #define __PHYSICAL_START ALIGN(CONFIG_PHYSICAL_START, \
44 CONFIG_PHYSICAL_ALIGN)
46 #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
49 #include <asm/page_64_types.h>
50 #define IOREMAP_MAX_ORDER (PUD_SHIFT)
52 #include <asm/page_32_types.h>
53 #define IOREMAP_MAX_ORDER (PMD_SHIFT)
54 #endif /* CONFIG_X86_64 */
58 extern int devmem_is_allowed(unsigned long pagenr
);
60 extern unsigned long max_low_pfn_mapped
;
61 extern unsigned long max_pfn_mapped
;
63 static inline phys_addr_t
get_max_mapped(void)
65 return (phys_addr_t
)max_pfn_mapped
<< PAGE_SHIFT
;
68 bool pfn_range_is_mapped(unsigned long start_pfn
, unsigned long end_pfn
);
70 extern unsigned long init_memory_mapping(unsigned long start
,
73 extern void initmem_init(void);
75 #endif /* !__ASSEMBLY__ */
77 #endif /* _ASM_X86_PAGE_DEFS_H */