[v3,2/3] arm64: enable tlbi range instructions
diff mbox series

Message ID 20200715071945.897-3-yezhenyu2@huawei.com
State New
Headers show
Series
  • arm64: tlb: add support for TLBI RANGE instructions
Related show

Commit Message

Zhenyu Ye July 15, 2020, 7:19 a.m. UTC
TLBI RANGE feature instoduces new assembly instructions and only
support by binutils >= 2.30.  Add necessary Kconfig logic to allow
this to be enabled and pass '-march=armv8.4-a' to KBUILD_CFLAGS.

Signed-off-by: Zhenyu Ye <yezhenyu2@huawei.com>
---
 arch/arm64/Kconfig  | 14 ++++++++++++++
 arch/arm64/Makefile |  7 +++++++
 2 files changed, 21 insertions(+)

Comments

Catalin Marinas July 15, 2020, 12:10 p.m. UTC | #1
On Wed, Jul 15, 2020 at 03:19:44PM +0800, Zhenyu Ye wrote:
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index a0d94d063fa8..4e823b97c92e 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -82,11 +82,18 @@ endif
>  # compiler to generate them and consequently to break the single image contract
>  # we pass it only to the assembler. This option is utilized only in case of non
>  # integrated assemblers.
> +ifneq ($(CONFIG_AS_HAS_ARMV8_4), y)
>  branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
>  endif
> +endif

I couldn't find a clear statement in the gas documentation on what
happens if multiple -march options are passed. I think it's safer to
avoid this here.

>  KBUILD_CFLAGS += $(branch-prot-flags-y)
>  
> +ifeq ($(CONFIG_AS_HAS_ARMV8_4), y)
> +# make sure to pass the newest target architecture to -march.
> +KBUILD_CFLAGS	+= -Wa,-march=armv8.4-a
> +endif

I have a suspicion both of these options will break the LLVM integrated
assembler but we don't officially support it on arm64 yet (-Wa, doesn't
seem to get passed to the integrated asm).

Thanks for the re-spin.

Patch
diff mbox series

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 66dc41fd49f2..e385361f8137 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1596,6 +1596,20 @@  config ARM64_AMU_EXTN
 	  correctly reflect reality. Most commonly, the value read will be 0,
 	  indicating that the counter is not enabled.
 
+config ARM64_TLB_RANGE
+	bool "Enable support for tlbi range feature"
+	default y
+	depends on AS_HAS_ARMV8_4
+	help
+	  ARMv8.4-TLBI provides TLBI invalidation instruction that apply to a
+	  range of input addresses.
+
+	  The feature introduces new assembly instructions, and they were
+	  support when binutils >= 2.30.
+
+config AS_HAS_ARMV8_4
+	def_bool $(cc-option, -Wa$(comma)-march=armv8.4-a)
+
 endmenu
 
 menu "ARMv8.5 architectural features"
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index a0d94d063fa8..4e823b97c92e 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -82,11 +82,18 @@  endif
 # compiler to generate them and consequently to break the single image contract
 # we pass it only to the assembler. This option is utilized only in case of non
 # integrated assemblers.
+ifneq ($(CONFIG_AS_HAS_ARMV8_4), y)
 branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
 endif
+endif
 
 KBUILD_CFLAGS += $(branch-prot-flags-y)
 
+ifeq ($(CONFIG_AS_HAS_ARMV8_4), y)
+# make sure to pass the newest target architecture to -march.
+KBUILD_CFLAGS	+= -Wa,-march=armv8.4-a
+endif
+
 ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
 KBUILD_CFLAGS	+= -ffixed-x18
 endif