Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / arch / x86 / include / asm / pgtable_32_types.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_PGTABLE_32_DEFS_H
3 #define _ASM_X86_PGTABLE_32_DEFS_H
4
5 /*
6  * The Linux x86 paging architecture is 'compile-time dual-mode', it
7  * implements both the traditional 2-level x86 page tables and the
8  * newer 3-level PAE-mode page tables.
9  */
10 #ifdef CONFIG_X86_PAE
11 # include <asm/pgtable-3level_types.h>
12 # define PMD_SIZE       (1UL << PMD_SHIFT)
13 # define PMD_MASK       (~(PMD_SIZE - 1))
14 #else
15 # include <asm/pgtable-2level_types.h>
16 #endif
17
18 #define pgtable_l5_enabled() 0
19
20 #define PGDIR_SIZE      (1UL << PGDIR_SHIFT)
21 #define PGDIR_MASK      (~(PGDIR_SIZE - 1))
22
23 /* Just any arbitrary offset to the start of the vmalloc VM area: the
24  * current 8MB value just means that there will be a 8MB "hole" after the
25  * physical memory until the kernel virtual memory starts.  That means that
26  * any out-of-bounds memory accesses will hopefully be caught.
27  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
28  * area for the same reason. ;)
29  */
30 #define VMALLOC_OFFSET  (8 * 1024 * 1024)
31
32 #ifndef __ASSEMBLY__
33 extern bool __vmalloc_start_set; /* set once high_memory is set */
34 #endif
35
36 #define VMALLOC_START   ((unsigned long)high_memory + VMALLOC_OFFSET)
37 #ifdef CONFIG_X86_PAE
38 #define LAST_PKMAP 512
39 #else
40 #define LAST_PKMAP 1024
41 #endif
42
43 /*
44  * Define this here and validate with BUILD_BUG_ON() in pgtable_32.c
45  * to avoid include recursion hell
46  */
47 #define CPU_ENTRY_AREA_PAGES    (NR_CPUS * 40)
48
49 #define CPU_ENTRY_AREA_BASE                                             \
50         ((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1))   \
51          & PMD_MASK)
52
53 #define LDT_BASE_ADDR           \
54         ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
55
56 #define LDT_END_ADDR            (LDT_BASE_ADDR + PMD_SIZE)
57
58 #define PKMAP_BASE              \
59         ((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK)
60
61 #ifdef CONFIG_HIGHMEM
62 # define VMALLOC_END    (PKMAP_BASE - 2 * PAGE_SIZE)
63 #else
64 # define VMALLOC_END    (LDT_BASE_ADDR - 2 * PAGE_SIZE)
65 #endif
66
67 #define MODULES_VADDR   VMALLOC_START
68 #define MODULES_END     VMALLOC_END
69 #define MODULES_LEN     (MODULES_VADDR - MODULES_END)
70
71 #define MAXMEM  (VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
72
73 #endif /* _ASM_X86_PGTABLE_32_DEFS_H */