Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: enable armv8.5-a asm-arch option

Hardware tag-based KASAN relies on Memory Tagging Extension (MTE) which is
an armv8.5-a architecture extension.

Enable the correct asm option when the compiler supports it in order to
allow the usage of ALTERNATIVE()s with MTE instructions.

Link: https://lkml.kernel.org/r/d03d1157124ea3532eaeb77507988733f5734986.1606161801.git.andreyknvl@google.com
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Tested-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Branislav Rankov <Branislav.Rankov@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Marco Elver <elver@google.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Vincenzo Frascino and committed by
Linus Torvalds
f469c032 6a63a63f

+9
+4
arch/arm64/Kconfig
··· 1571 1571 1572 1572 menu "ARMv8.5 architectural features" 1573 1573 1574 + config AS_HAS_ARMV8_5 1575 + def_bool $(cc-option,-Wa$(comma)-march=armv8.5-a) 1576 + 1574 1577 config ARM64_BTI 1575 1578 bool "Branch Target Identification support" 1576 1579 default y ··· 1648 1645 bool "Memory Tagging Extension support" 1649 1646 default y 1650 1647 depends on ARM64_AS_HAS_MTE && ARM64_TAGGED_ADDR_ABI 1648 + depends on AS_HAS_ARMV8_5 1651 1649 select ARCH_USES_HIGH_VMA_FLAGS 1652 1650 help 1653 1651 Memory Tagging (part of the ARMv8.5 Extensions) provides
+5
arch/arm64/Makefile
··· 96 96 asm-arch := armv8.4-a 97 97 endif 98 98 99 + ifeq ($(CONFIG_AS_HAS_ARMV8_5), y) 100 + # make sure to pass the newest target architecture to -march. 101 + asm-arch := armv8.5-a 102 + endif 103 + 99 104 ifdef asm-arch 100 105 KBUILD_CFLAGS += -Wa,-march=$(asm-arch) \ 101 106 -DARM64_ASM_ARCH='"$(asm-arch)"'