[1/4] arm64: Introduce aarch32_enabled()
Commit Message
Aarch32 bit support on 64bit kernels depends on whether CONFIG_COMPAT
is selected or not. As it is a compile time option it doesn't
provide the flexibility to have distributions set their own policy for
Aarch32 support and give the user the flexibility to override it.
As a first step introduce aarch32_enabled() which abstracts whether 32
bit compat is turned on or off. Upcoming patches will implement
the ability to set Aarch32 compat state at boot time.
Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
---
arch/arm64/include/asm/compat.h | 12 ++++++++++++
arch/arm64/kernel/entry-common.c | 2 ++
2 files changed, 14 insertions(+)
@@ -98,6 +98,13 @@ static inline int is_compat_thread(struct thread_info *thread)
long compat_arm_syscall(struct pt_regs *regs, int scno);
+extern bool __aarch32_enabled;
+
+static inline bool aarch32_enabled(void)
+{
+ return __aarch32_enabled;
+}
+
#else /* !CONFIG_COMPAT */
static inline int is_compat_thread(struct thread_info *thread)
@@ -105,5 +112,10 @@ static inline int is_compat_thread(struct thread_info *thread)
return 0;
}
+static inline bool aarch32_enabled(void)
+{
+ return false;
+}
+
#endif /* CONFIG_COMPAT */
#endif /* __ASM_COMPAT_H */
@@ -877,6 +877,8 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs)
{
__el0_error_handler_common(regs);
}
+
+bool __aarch32_enabled __ro_after_init = true;
#else /* CONFIG_COMPAT */
UNHANDLED(el0t, 32, sync)
UNHANDLED(el0t, 32, irq)