Skip to content

Commit 9e6a00e

Browse files
mrutland-armAlex Shi
authored andcommitted
arm64: move {PAGE,CONT}_SHIFT into Kconfig
In some cases (e.g. the awk for CONFIG_RANDOMIZE_TEXT_OFFSET) we would like to make use of PAGE_SHIFT outside of code that can include the usual header files. Add a new CONFIG_ARM64_PAGE_SHIFT for this, likewise with ARM64_CONT_SHIFT for consistency. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit 030c4d24447cbf2bd612baea5695952e5f62c042) Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 0f0c7c1 commit 9e6a00e

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

arch/arm64/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ config ARCH_PHYS_ADDR_T_64BIT
107107
config MMU
108108
def_bool y
109109

110+
config ARM64_PAGE_SHIFT
111+
int
112+
default 16 if ARM64_64K_PAGES
113+
default 14 if ARM64_16K_PAGES
114+
default 12
115+
116+
config ARM64_CONT_SHIFT
117+
int
118+
default 5 if ARM64_64K_PAGES
119+
default 7 if ARM64_16K_PAGES
120+
default 4
121+
110122
config NO_IOPORT_MAP
111123
def_bool y if !PCI
112124

arch/arm64/include/asm/page.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,8 @@
2121

2222
/* PAGE_SHIFT determines the page size */
2323
/* CONT_SHIFT determines the number of pages which can be tracked together */
24-
#ifdef CONFIG_ARM64_64K_PAGES
25-
#define PAGE_SHIFT 16
26-
#define CONT_SHIFT 5
27-
#elif defined(CONFIG_ARM64_16K_PAGES)
28-
#define PAGE_SHIFT 14
29-
#define CONT_SHIFT 7
30-
#else
31-
#define PAGE_SHIFT 12
32-
#define CONT_SHIFT 4
33-
#endif
24+
#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT
25+
#define CONT_SHIFT CONFIG_ARM64_CONT_SHIFT
3426
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
3527
#define PAGE_MASK (~(PAGE_SIZE-1))
3628

0 commit comments

Comments
 (0)