summaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@arm.com>2018-12-06 17:50:42 -0500
committerWill Deacon <will.deacon@arm.com>2018-12-10 13:42:18 -0500
commitb9567720a1b8e739380e0241413606c056c57859 (patch)
tree760f658f0fbb3ec46f0cbdaa0314245f6f094fb7 /arch/arm64
parent67e7fdfcc6824a4f768d76d89377b33baad58fad (diff)
arm64: mm: Allow forcing all userspace addresses to 52-bit
On arm64 52-bit VAs are provided to userspace when a hint is supplied to mmap. This helps maintain compatibility with software that expects at most 48-bit VAs to be returned. In order to help identify software that has 48-bit VA assumptions, this patch allows one to compile a kernel where 52-bit VAs are returned by default on HW that supports it. This feature is intended to be for development systems only. Signed-off-by: Steve Capper <steve.capper@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/Kconfig13
-rw-r--r--arch/arm64/include/asm/elf.h4
-rw-r--r--arch/arm64/include/asm/processor.h9
3 files changed, 25 insertions, 1 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 858e353b2f40..ca1f93233b22 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1186,6 +1186,19 @@ config ARM64_CNP
1186 at runtime, and does not affect PEs that do not implement 1186 at runtime, and does not affect PEs that do not implement
1187 this feature. 1187 this feature.
1188 1188
1189config ARM64_FORCE_52BIT
1190 bool "Force 52-bit virtual addresses for userspace"
1191 depends on ARM64_52BIT_VA && EXPERT
1192 help
1193 For systems with 52-bit userspace VAs enabled, the kernel will attempt
1194 to maintain compatibility with older software by providing 48-bit VAs
1195 unless a hint is supplied to mmap.
1196
1197 This configuration option disables the 48-bit compatibility logic, and
1198 forces all userspace addresses to be 52-bit on HW that supports it. One
1199 should only enable this configuration option for stress testing userspace
1200 memory management code. If unsure say N here.
1201
1189endmenu 1202endmenu
1190 1203
1191config ARM64_SVE 1204config ARM64_SVE
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index bc9bd9e77d9d..6adc1a90e7e6 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -117,7 +117,11 @@
117 * 64-bit, this is above 4GB to leave the entire 32-bit address 117 * 64-bit, this is above 4GB to leave the entire 32-bit address
118 * space open for things that want to use the area for 32-bit pointers. 118 * space open for things that want to use the area for 32-bit pointers.
119 */ 119 */
120#ifdef CONFIG_ARM64_FORCE_52BIT
121#define ELF_ET_DYN_BASE (2 * TASK_SIZE_64 / 3)
122#else
120#define ELF_ET_DYN_BASE (2 * DEFAULT_MAP_WINDOW_64 / 3) 123#define ELF_ET_DYN_BASE (2 * DEFAULT_MAP_WINDOW_64 / 3)
124#endif /* CONFIG_ARM64_FORCE_52BIT */
121 125
122#ifndef __ASSEMBLY__ 126#ifndef __ASSEMBLY__
123 127
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 7ff75e52b762..efa0210cf927 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -74,8 +74,13 @@ extern u64 vabits_user;
74#define DEFAULT_MAP_WINDOW DEFAULT_MAP_WINDOW_64 74#define DEFAULT_MAP_WINDOW DEFAULT_MAP_WINDOW_64
75#endif /* CONFIG_COMPAT */ 75#endif /* CONFIG_COMPAT */
76 76
77#define TASK_UNMAPPED_BASE (PAGE_ALIGN(DEFAULT_MAP_WINDOW / 4)) 77#ifdef CONFIG_ARM64_FORCE_52BIT
78#define STACK_TOP_MAX TASK_SIZE_64
79#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4))
80#else
78#define STACK_TOP_MAX DEFAULT_MAP_WINDOW_64 81#define STACK_TOP_MAX DEFAULT_MAP_WINDOW_64
82#define TASK_UNMAPPED_BASE (PAGE_ALIGN(DEFAULT_MAP_WINDOW / 4))
83#endif /* CONFIG_ARM64_FORCE_52BIT */
79 84
80#ifdef CONFIG_COMPAT 85#ifdef CONFIG_COMPAT
81#define AARCH32_VECTORS_BASE 0xffff0000 86#define AARCH32_VECTORS_BASE 0xffff0000
@@ -85,12 +90,14 @@ extern u64 vabits_user;
85#define STACK_TOP STACK_TOP_MAX 90#define STACK_TOP STACK_TOP_MAX
86#endif /* CONFIG_COMPAT */ 91#endif /* CONFIG_COMPAT */
87 92
93#ifndef CONFIG_ARM64_FORCE_52BIT
88#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\ 94#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\
89 DEFAULT_MAP_WINDOW) 95 DEFAULT_MAP_WINDOW)
90 96
91#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \ 97#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
92 base + TASK_SIZE - DEFAULT_MAP_WINDOW :\ 98 base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
93 base) 99 base)
100#endif /* CONFIG_ARM64_FORCE_52BIT */
94 101
95extern phys_addr_t arm64_dma_phys_limit; 102extern phys_addr_t arm64_dma_phys_limit;
96#define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) 103#define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1)