]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/include/asm/pgtable_32_types.h
Merge tag 'trace-v4.15-rc4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rosted...
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / include / asm / pgtable_32_types.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
f402a65f
JF
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 PGDIR_SIZE (1UL << PGDIR_SHIFT)
19#define PGDIR_MASK (~(PGDIR_SIZE - 1))
20
21/* Just any arbitrary offset to the start of the vmalloc VM area: the
22 * current 8MB value just means that there will be a 8MB "hole" after the
23 * physical memory until the kernel virtual memory starts. That means that
24 * any out-of-bounds memory accesses will hopefully be caught.
25 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
26 * area for the same reason. ;)
27 */
28#define VMALLOC_OFFSET (8 * 1024 * 1024)
dc16ecf7 29
fc4ac7a5 30#ifndef __ASSEMBLY__
dc16ecf7
JF
31extern bool __vmalloc_start_set; /* set once high_memory is set */
32#endif
33
f402a65f
JF
34#define VMALLOC_START ((unsigned long)high_memory + VMALLOC_OFFSET)
35#ifdef CONFIG_X86_PAE
36#define LAST_PKMAP 512
37#else
38#define LAST_PKMAP 1024
39#endif
40
92a0f81d
TG
41/*
42 * Define this here and validate with BUILD_BUG_ON() in pgtable_32.c
43 * to avoid include recursion hell
44 */
45#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40)
46
47#define CPU_ENTRY_AREA_BASE \
48 ((FIXADDR_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) & PMD_MASK)
49
50#define PKMAP_BASE \
51 ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
f402a65f
JF
52
53#ifdef CONFIG_HIGHMEM
54# define VMALLOC_END (PKMAP_BASE - 2 * PAGE_SIZE)
55#else
92a0f81d 56# define VMALLOC_END (CPU_ENTRY_AREA_BASE - 2 * PAGE_SIZE)
f402a65f
JF
57#endif
58
c398df30
AW
59#define MODULES_VADDR VMALLOC_START
60#define MODULES_END VMALLOC_END
61#define MODULES_LEN (MODULES_VADDR - MODULES_END)
62
f402a65f
JF
63#define MAXMEM (VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
64
65#endif /* _ASM_X86_PGTABLE_32_DEFS_H */