mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 23:45:31 +08:00
1764c3edc6
Commit7c78f67e9b
("arm64: enable tlbi range instructions") breaks LLVM's integrated assembler, because -Wa,-march is only passed to external assemblers and therefore, the new instructions are not enabled when IAS is used. This change adds a common architecture version preamble, which can be used in inline assembly blocks that contain instructions that require a newer architecture version, and uses it to fix __TLBI_0 and __TLBI_1 with ARM64_TLB_RANGE. Fixes:7c78f67e9b
("arm64: enable tlbi range instructions") Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Tested-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Link: https://github.com/ClangBuiltLinux/linux/issues/1106 Link: https://lore.kernel.org/r/20200827203608.1225689-1-samitolvanen@google.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
27 lines
850 B
C
27 lines
850 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_COMPILER_H
|
|
#define __ASM_COMPILER_H
|
|
|
|
#ifdef ARM64_ASM_ARCH
|
|
#define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n"
|
|
#else
|
|
#define ARM64_ASM_PREAMBLE
|
|
#endif
|
|
|
|
/*
|
|
* The EL0/EL1 pointer bits used by a pointer authentication code.
|
|
* This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply.
|
|
*/
|
|
#define ptrauth_user_pac_mask() GENMASK_ULL(54, vabits_actual)
|
|
#define ptrauth_kernel_pac_mask() GENMASK_ULL(63, vabits_actual)
|
|
|
|
/* Valid for EL0 TTBR0 and EL1 TTBR1 instruction pointers */
|
|
#define ptrauth_clear_pac(ptr) \
|
|
((ptr & BIT_ULL(55)) ? (ptr | ptrauth_kernel_pac_mask()) : \
|
|
(ptr & ~ptrauth_user_pac_mask()))
|
|
|
|
#define __builtin_return_address(val) \
|
|
(void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val)))
|
|
|
|
#endif /* __ASM_COMPILER_H */
|