Commit d3e5bab9 authored by Arnd Bergmann's avatar Arnd Bergmann

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 <christophe.leroy@csgroup.eu> (powerpc32)
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: Helge Deller <deller@gmx.de> # parisc
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent ba89f9c8
...@@ -284,14 +284,17 @@ choice ...@@ -284,14 +284,17 @@ choice
config ARC_PAGE_SIZE_8K config ARC_PAGE_SIZE_8K
bool "8KB" bool "8KB"
select HAVE_PAGE_SIZE_8KB
help help
Choose between 8k vs 16k Choose between 8k vs 16k
config ARC_PAGE_SIZE_16K config ARC_PAGE_SIZE_16K
select HAVE_PAGE_SIZE_16KB
bool "16KB" bool "16KB"
config ARC_PAGE_SIZE_4K config ARC_PAGE_SIZE_4K
bool "4KB" bool "4KB"
select HAVE_PAGE_SIZE_4KB
depends on ARC_MMU_V3 || ARC_MMU_V4 depends on ARC_MMU_V3 || ARC_MMU_V4
endchoice endchoice
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
#include <linux/const.h> #include <linux/const.h>
/* PAGE_SHIFT determines the page size */ /* PAGE_SHIFT determines the page size */
#if defined(CONFIG_ARC_PAGE_SIZE_16K) #ifdef __KERNEL__
#define PAGE_SHIFT 14 #define PAGE_SHIFT CONFIG_PAGE_SHIFT
#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
#define PAGE_SHIFT 12
#else #else
/* /*
* Default 8k * Default 8k
......
...@@ -277,27 +277,21 @@ config 64BIT ...@@ -277,27 +277,21 @@ config 64BIT
config MMU config MMU
def_bool y def_bool y
config ARM64_PAGE_SHIFT
int
default 16 if ARM64_64K_PAGES
default 14 if ARM64_16K_PAGES
default 12
config ARM64_CONT_PTE_SHIFT config ARM64_CONT_PTE_SHIFT
int int
default 5 if ARM64_64K_PAGES default 5 if PAGE_SIZE_64KB
default 7 if ARM64_16K_PAGES default 7 if PAGE_SIZE_16KB
default 4 default 4
config ARM64_CONT_PMD_SHIFT config ARM64_CONT_PMD_SHIFT
int int
default 5 if ARM64_64K_PAGES default 5 if PAGE_SIZE_64KB
default 5 if ARM64_16K_PAGES default 5 if PAGE_SIZE_16KB
default 4 default 4
config ARCH_MMAP_RND_BITS_MIN config ARCH_MMAP_RND_BITS_MIN
default 14 if ARM64_64K_PAGES default 14 if PAGE_SIZE_64KB
default 16 if ARM64_16K_PAGES default 16 if PAGE_SIZE_16KB
default 18 default 18
# max bits determined by the following formula: # max bits determined by the following formula:
...@@ -1259,11 +1253,13 @@ choice ...@@ -1259,11 +1253,13 @@ choice
config ARM64_4K_PAGES config ARM64_4K_PAGES
bool "4KB" bool "4KB"
select HAVE_PAGE_SIZE_4KB
help help
This feature enables 4KB pages support. This feature enables 4KB pages support.
config ARM64_16K_PAGES config ARM64_16K_PAGES
bool "16KB" bool "16KB"
select HAVE_PAGE_SIZE_16KB
help help
The system will use 16KB pages support. AArch32 emulation The system will use 16KB pages support. AArch32 emulation
requires applications compiled with 16K (or a multiple of 16K) requires applications compiled with 16K (or a multiple of 16K)
...@@ -1271,6 +1267,7 @@ config ARM64_16K_PAGES ...@@ -1271,6 +1267,7 @@ config ARM64_16K_PAGES
config ARM64_64K_PAGES config ARM64_64K_PAGES
bool "64KB" bool "64KB"
select HAVE_PAGE_SIZE_64KB
help help
This feature enables 64KB pages support (4KB by default) This feature enables 64KB pages support (4KB by default)
allowing only two levels of page tables and faster TLB allowing only two levels of page tables and faster TLB
...@@ -1291,19 +1288,19 @@ choice ...@@ -1291,19 +1288,19 @@ choice
config ARM64_VA_BITS_36 config ARM64_VA_BITS_36
bool "36-bit" if EXPERT bool "36-bit" if EXPERT
depends on ARM64_16K_PAGES depends on PAGE_SIZE_16KB
config ARM64_VA_BITS_39 config ARM64_VA_BITS_39
bool "39-bit" bool "39-bit"
depends on ARM64_4K_PAGES depends on PAGE_SIZE_4KB
config ARM64_VA_BITS_42 config ARM64_VA_BITS_42
bool "42-bit" bool "42-bit"
depends on ARM64_64K_PAGES depends on PAGE_SIZE_64KB
config ARM64_VA_BITS_47 config ARM64_VA_BITS_47
bool "47-bit" bool "47-bit"
depends on ARM64_16K_PAGES depends on PAGE_SIZE_16KB
config ARM64_VA_BITS_48 config ARM64_VA_BITS_48
bool "48-bit" bool "48-bit"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/const.h> #include <linux/const.h>
/* PAGE_SHIFT determines the page size */ /* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT #define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_MASK (~(PAGE_SIZE-1))
......
...@@ -273,6 +273,7 @@ choice ...@@ -273,6 +273,7 @@ choice
config PARISC_PAGE_SIZE_4KB config PARISC_PAGE_SIZE_4KB
bool "4KB" bool "4KB"
select HAVE_PAGE_SIZE_4KB
help help
This lets you select the page size of the kernel. For best This lets you select the page size of the kernel. For best
performance, a page size of 16KB is recommended. For best performance, a page size of 16KB is recommended. For best
...@@ -288,10 +289,12 @@ config PARISC_PAGE_SIZE_4KB ...@@ -288,10 +289,12 @@ config PARISC_PAGE_SIZE_4KB
config PARISC_PAGE_SIZE_16KB config PARISC_PAGE_SIZE_16KB
bool "16KB" bool "16KB"
select HAVE_PAGE_SIZE_16KB
depends on PA8X00 && BROKEN && !KFENCE depends on PA8X00 && BROKEN && !KFENCE
config PARISC_PAGE_SIZE_64KB config PARISC_PAGE_SIZE_64KB
bool "64KB" bool "64KB"
select HAVE_PAGE_SIZE_64KB
depends on PA8X00 && BROKEN && !KFENCE depends on PA8X00 && BROKEN && !KFENCE
endchoice endchoice
......
...@@ -4,15 +4,7 @@ ...@@ -4,15 +4,7 @@
#include <linux/const.h> #include <linux/const.h>
#if defined(CONFIG_PARISC_PAGE_SIZE_4KB) #define PAGE_SHIFT CONFIG_PAGE_SHIFT
# define PAGE_SHIFT 12
#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
# define PAGE_SHIFT 14
#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
# define PAGE_SHIFT 16
#else
# error "unknown default kernel page size"
#endif
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_MASK (~(PAGE_SIZE-1))
......
...@@ -212,7 +212,7 @@ config PPC ...@@ -212,7 +212,7 @@ config PPC
select HAVE_ARCH_HUGE_VMAP if PPC_RADIX_MMU || PPC_8xx select HAVE_ARCH_HUGE_VMAP if PPC_RADIX_MMU || PPC_8xx
select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_JUMP_LABEL
select HAVE_ARCH_JUMP_LABEL_RELATIVE select HAVE_ARCH_JUMP_LABEL_RELATIVE
select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KASAN if PPC32 && PAGE_SHIFT <= 14
select HAVE_ARCH_KASAN if PPC_RADIX_MMU select HAVE_ARCH_KASAN if PPC_RADIX_MMU
select HAVE_ARCH_KASAN if PPC_BOOK3E_64 select HAVE_ARCH_KASAN if PPC_BOOK3E_64
select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
...@@ -809,19 +809,23 @@ choice ...@@ -809,19 +809,23 @@ choice
config PPC_4K_PAGES config PPC_4K_PAGES
bool "4k page size" bool "4k page size"
select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64 select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64
select HAVE_PAGE_SIZE_4KB
config PPC_16K_PAGES config PPC_16K_PAGES
bool "16k page size" bool "16k page size"
depends on 44x || PPC_8xx depends on 44x || PPC_8xx
select HAVE_PAGE_SIZE_16KB
config PPC_64K_PAGES config PPC_64K_PAGES
bool "64k page size" bool "64k page size"
depends on 44x || PPC_BOOK3S_64 depends on 44x || PPC_BOOK3S_64
select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64 select HAVE_ARCH_SOFT_DIRTY if PPC_BOOK3S_64
select HAVE_PAGE_SIZE_64KB
config PPC_256K_PAGES config PPC_256K_PAGES
bool "256k page size (Requires non-standard binutils settings)" bool "256k page size (Requires non-standard binutils settings)"
depends on 44x && !PPC_47x depends on 44x && !PPC_47x
select HAVE_PAGE_SIZE_256KB
help help
Make the page size 256k. Make the page size 256k.
...@@ -832,29 +836,6 @@ config PPC_256K_PAGES ...@@ -832,29 +836,6 @@ config PPC_256K_PAGES
endchoice endchoice
config PAGE_SIZE_4KB
def_bool y
depends on PPC_4K_PAGES
config PAGE_SIZE_16KB
def_bool y
depends on PPC_16K_PAGES
config PAGE_SIZE_64KB
def_bool y
depends on PPC_64K_PAGES
config PAGE_SIZE_256KB
def_bool y
depends on PPC_256K_PAGES
config PPC_PAGE_SHIFT
int
default 18 if PPC_256K_PAGES
default 16 if PPC_64K_PAGES
default 14 if PPC_16K_PAGES
default 12
config THREAD_SHIFT config THREAD_SHIFT
int "Thread shift" if EXPERT int "Thread shift" if EXPERT
range 13 15 range 13 15
...@@ -891,7 +872,7 @@ config DATA_SHIFT ...@@ -891,7 +872,7 @@ config DATA_SHIFT
default 23 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx && PIN_TLB_DATA default 23 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx && PIN_TLB_DATA
default 19 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx default 19 if (DEBUG_PAGEALLOC || KFENCE) && PPC_8xx
default 24 if STRICT_KERNEL_RWX && PPC_85xx default 24 if STRICT_KERNEL_RWX && PPC_85xx
default PPC_PAGE_SHIFT default PAGE_SHIFT
help help
On Book3S 32 (603+), DBATs are used to map kernel text and rodata RO. On Book3S 32 (603+), DBATs are used to map kernel text and rodata RO.
Smaller is the alignment, greater is the number of necessary DBATs. Smaller is the alignment, greater is the number of necessary DBATs.
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* page size. When using 64K pages however, whether we are really supporting * page size. When using 64K pages however, whether we are really supporting
* 64K pages in HW or not is irrelevant to those definitions. * 64K pages in HW or not is irrelevant to those definitions.
*/ */
#define PAGE_SHIFT CONFIG_PPC_PAGE_SHIFT #define PAGE_SHIFT CONFIG_PAGE_SHIFT
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -139,7 +139,7 @@ LX_CONFIG(CONFIG_ARM64_64K_PAGES) ...@@ -139,7 +139,7 @@ LX_CONFIG(CONFIG_ARM64_64K_PAGES)
if IS_BUILTIN(CONFIG_ARM64): if IS_BUILTIN(CONFIG_ARM64):
LX_VALUE(CONFIG_ARM64_PA_BITS) LX_VALUE(CONFIG_ARM64_PA_BITS)
LX_VALUE(CONFIG_ARM64_VA_BITS) LX_VALUE(CONFIG_ARM64_VA_BITS)
LX_VALUE(CONFIG_ARM64_PAGE_SHIFT) LX_VALUE(CONFIG_PAGE_SHIFT)
LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER) LX_VALUE(CONFIG_ARCH_FORCE_MAX_ORDER)
LX_CONFIG(CONFIG_SPARSEMEM) LX_CONFIG(CONFIG_SPARSEMEM)
LX_CONFIG(CONFIG_SPARSEMEM_EXTREME) LX_CONFIG(CONFIG_SPARSEMEM_EXTREME)
......
...@@ -41,7 +41,7 @@ class aarch64_page_ops(): ...@@ -41,7 +41,7 @@ class aarch64_page_ops():
self.SECTION_SIZE_BITS = 27 self.SECTION_SIZE_BITS = 27
self.MAX_PHYSMEM_BITS = constants.LX_CONFIG_ARM64_VA_BITS self.MAX_PHYSMEM_BITS = constants.LX_CONFIG_ARM64_VA_BITS
self.PAGE_SHIFT = constants.LX_CONFIG_ARM64_PAGE_SHIFT self.PAGE_SHIFT = constants.LX_CONFIG_PAGE_SHIFT
self.PAGE_SIZE = 1 << self.PAGE_SHIFT self.PAGE_SIZE = 1 << self.PAGE_SHIFT
self.PAGE_MASK = (~(self.PAGE_SIZE - 1)) & ((1 << 64) - 1) self.PAGE_MASK = (~(self.PAGE_SIZE - 1)) & ((1 << 64) - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment