Skip to content

Commit d3e5bab

Browse files
committed
arch: simplify architecture specific page size configuration
arc, arm64, parisc and powerpc all have their own Kconfig symbols in place of the common CONFIG_PAGE_SIZE_4KB symbols. Change these so the common symbols are the ones that are actually used, while leaving the arhcitecture specific ones as the user visible place for configuring it, to avoid breaking user configs. Reviewed-by: Christophe Leroy <[email protected]> (powerpc32) Acked-by: Catalin Marinas <[email protected]> Acked-by: Helge Deller <[email protected]> # parisc Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent ba89f9c commit d3e5bab

File tree

10 files changed

+32
-58
lines changed

10 files changed

+32
-58
lines changed

arch/arc/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,17 @@ choice
284284

285285
config ARC_PAGE_SIZE_8K
286286
bool "8KB"
287+
select HAVE_PAGE_SIZE_8KB
287288
help
288289
Choose between 8k vs 16k
289290

290291
config ARC_PAGE_SIZE_16K
292+
select HAVE_PAGE_SIZE_16KB
291293
bool "16KB"
292294

293295
config ARC_PAGE_SIZE_4K
294296
bool "4KB"
297+
select HAVE_PAGE_SIZE_4KB
295298
depends on ARC_MMU_V3 || ARC_MMU_V4
296299

297300
endchoice

arch/arc/include/uapi/asm/page.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
#include <linux/const.h>
1414

1515
/* PAGE_SHIFT determines the page size */
16-
#if defined(CONFIG_ARC_PAGE_SIZE_16K)
17-
#define PAGE_SHIFT 14
18-
#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
19-
#define PAGE_SHIFT 12
16+
#ifdef __KERNEL__
17+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
2018
#else
2119
/*
2220
* Default 8k

arch/arm64/Kconfig

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,27 +277,21 @@ config 64BIT
277277
config MMU
278278
def_bool y
279279

280-
config ARM64_PAGE_SHIFT
281-
int
282-
default 16 if ARM64_64K_PAGES
283-
default 14 if ARM64_16K_PAGES
284-
default 12
285-
286280
config ARM64_CONT_PTE_SHIFT
287281
int
288-
default 5 if ARM64_64K_PAGES
289-
default 7 if ARM64_16K_PAGES
282+
default 5 if PAGE_SIZE_64KB
283+
default 7 if PAGE_SIZE_16KB
290284
default 4
291285

292286
config ARM64_CONT_PMD_SHIFT
293287
int
294-
default 5 if ARM64_64K_PAGES
295-
default 5 if ARM64_16K_PAGES
288+
default 5 if PAGE_SIZE_64KB
289+
default 5 if PAGE_SIZE_16KB
296290
default 4
297291

298292
config ARCH_MMAP_RND_BITS_MIN
299-
default 14 if ARM64_64K_PAGES
300-
default 16 if ARM64_16K_PAGES
293+
default 14 if PAGE_SIZE_64KB
294+
default 16 if PAGE_SIZE_16KB
301295
default 18
302296

303297
# max bits determined by the following formula:
@@ -1259,18 +1253,21 @@ choice
12591253

12601254
config ARM64_4K_PAGES
12611255
bool "4KB"
1256+
select HAVE_PAGE_SIZE_4KB
12621257
help
12631258
This feature enables 4KB pages support.
12641259

12651260
config ARM64_16K_PAGES
12661261
bool "16KB"
1262+
select HAVE_PAGE_SIZE_16KB
12671263
help
12681264
The system will use 16KB pages support. AArch32 emulation
12691265
requires applications compiled with 16K (or a multiple of 16K)
12701266
aligned segments.
12711267

12721268
config ARM64_64K_PAGES
12731269
bool "64KB"
1270+
select HAVE_PAGE_SIZE_64KB
12741271
help
12751272
This feature enables 64KB pages support (4KB by default)
12761273
allowing only two levels of page tables and faster TLB
@@ -1291,19 +1288,19 @@ choice
12911288

12921289
config ARM64_VA_BITS_36
12931290
bool "36-bit" if EXPERT
1294-
depends on ARM64_16K_PAGES
1291+
depends on PAGE_SIZE_16KB
12951292

12961293
config ARM64_VA_BITS_39
12971294
bool "39-bit"
1298-
depends on ARM64_4K_PAGES
1295+
depends on PAGE_SIZE_4KB
12991296

13001297
config ARM64_VA_BITS_42
13011298
bool "42-bit"
1302-
depends on ARM64_64K_PAGES
1299+
depends on PAGE_SIZE_64KB
13031300

13041301
config ARM64_VA_BITS_47
13051302
bool "47-bit"
1306-
depends on ARM64_16K_PAGES
1303+
depends on PAGE_SIZE_16KB
13071304

13081305
config ARM64_VA_BITS_48
13091306
bool "48-bit"

arch/arm64/include/asm/page-def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/const.h>
1212

1313
/* PAGE_SHIFT determines the page size */
14-
#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT
14+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
1515
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
1616
#define PAGE_MASK (~(PAGE_SIZE-1))
1717

arch/parisc/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ choice
273273

274274
config PARISC_PAGE_SIZE_4KB
275275
bool "4KB"
276+
select HAVE_PAGE_SIZE_4KB
276277
help
277278
This lets you select the page size of the kernel. For best
278279
performance, a page size of 16KB is recommended. For best
@@ -288,10 +289,12 @@ config PARISC_PAGE_SIZE_4KB
288289

289290
config PARISC_PAGE_SIZE_16KB
290291
bool "16KB"
292+
select HAVE_PAGE_SIZE_16KB
291293
depends on PA8X00 && BROKEN && !KFENCE
292294

293295
config PARISC_PAGE_SIZE_64KB
294296
bool "64KB"
297+
select HAVE_PAGE_SIZE_64KB
295298
depends on PA8X00 && BROKEN && !KFENCE
296299

297300
endchoice

arch/parisc/include/asm/page.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44

55
#include <linux/const.h>
66

7-
#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
8-
# define PAGE_SHIFT 12
9-
#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
10-
# define PAGE_SHIFT 14
11-
#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
12-
# define PAGE_SHIFT 16
13-
#else
14-
# error "unknown default kernel page size"
15-
#endif
7+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
168
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
179
#define PAGE_MASK (~(PAGE_SIZE-1))
1810

arch/powerpc/Kconfig

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ config PPC
212212
select HAVE_ARCH_HUGE_VMAP if PPC_RADIX_MMU || PPC_8xx
213213
select HAVE_ARCH_JUMP_LABEL
214214
select HAVE_ARCH_JUMP_LABEL_RELATIVE
215-
select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14
215+
select HAVE_ARCH_KASAN if PPC32 && PAGE_SHIFT <= 14
216216
select HAVE_ARCH_KASAN if PPC_RADIX_MMU
217217
select HAVE_ARCH_KASAN if PPC_BOOK3E_64
218218
select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
@@ -809,19 +809,23 @@ choice
809809
config PPC_4K_PAGES
810810
bool "4k page size"
811811
select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64
812+
select HAVE_PAGE_SIZE_4KB
812813

813814
config PPC_16K_PAGES
814815
bool "16k page size"
815816
depends on 44x || PPC_8xx
817+
select HAVE_PAGE_SIZE_16KB
816818

817819
config PPC_64K_PAGES
818820
bool "64k page size"
819821
depends on 44x || PPC_BOOK3S_64
820822
select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64
823+
select HAVE_PAGE_SIZE_64KB
821824

822825
config PPC_256K_PAGES
823826
bool "256k page size (Requires non-standard binutils settings)"
824827
depends on 44x && !PPC_47x
828+
select HAVE_PAGE_SIZE_256KB
825829
help
826830
Make the page size 256k.
827831

@@ -832,29 +836,6 @@ config PPC_256K_PAGES
832836

833837
endchoice
834838

835-
config PAGE_SIZE_4KB
836-
def_bool y
837-
depends on PPC_4K_PAGES
838-
839-
config PAGE_SIZE_16KB
840-
def_bool y
841-
depends on PPC_16K_PAGES
842-
843-
config PAGE_SIZE_64KB
844-
def_bool y
845-
depends on PPC_64K_PAGES
846-
847-
config PAGE_SIZE_256KB
848-
def_bool y
849-
depends on PPC_256K_PAGES
850-
851-
config PPC_PAGE_SHIFT
852-
int
853-
default 18 if PPC_256K_PAGES
854-
default 16 if PPC_64K_PAGES
855-
default 14 if PPC_16K_PAGES
856-
default 12
857-
858839
config THREAD_SHIFT
859840
int "Thread shift" if EXPERT
860841
range 13 15
@@ -891,7 +872,7 @@ config DATA_SHIFT
891872
default 23 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx && PIN_TLB_DATA
892873
default 19 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx
893874
default 24 if STRICT_KERNEL_RWX && PPC_85xx
894-
default PPC_PAGE_SHIFT
875+
default PAGE_SHIFT
895876
help
896877
On Book3S 32 (603+), DBATs are used to map kernel text and rodata RO.
897878
Smaller is the alignment, greater is the number of necessary DBATs.

arch/powerpc/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* page size. When using 64K pages however, whether we are really supporting
2222
* 64K pages in HW or not is irrelevant to those definitions.
2323
*/
24-
#define PAGE_SHIFT CONFIG_PPC_PAGE_SHIFT
24+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
2525
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
2626

2727
#ifndef __ASSEMBLY__

scripts/gdb/linux/constants.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ LX_CONFIG(CONFIG_ARM64_64K_PAGES)
139139
if IS_BUILTIN(CONFIG_ARM64):
140140
LX_VALUE(CONFIG_ARM64_PA_BITS)
141141
LX_VALUE(CONFIG_ARM64_VA_BITS)
142-
LX_VALUE(CONFIG_ARM64_PAGE_SHIFT)
142+
LX_VALUE(CONFIG_PAGE_SHIFT)
143143
LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER)
144144
LX_CONFIG(CONFIG_SPARSEMEM)
145145
LX_CONFIG(CONFIG_SPARSEMEM_EXTREME)

scripts/gdb/linux/mm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self):
4141
self.SECTION_SIZE_BITS = 27
4242
self.MAX_PHYSMEM_BITS = constants.LX_CONFIG_ARM64_VA_BITS
4343

44-
self.PAGE_SHIFT = constants.LX_CONFIG_ARM64_PAGE_SHIFT
44+
self.PAGE_SHIFT = constants.LX_CONFIG_PAGE_SHIFT
4545
self.PAGE_SIZE = 1 << self.PAGE_SHIFT
4646
self.PAGE_MASK = (~(self.PAGE_SIZE - 1)) & ((1 << 64) - 1)
4747

0 commit comments

Comments
 (0)