Skip to contentSkip to conversation

ARM: assembler: Drop obsolete VFP accessor fallback

PATCH In review Ard Biesheuvel 3 participants 3 messages Jul 30, 2024 – Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: assembler: Drop obsolete VFP accessor fallback

From: Ard Biesheuvel <[email protected]>

Now that the minimum supported binutils version is 2.25, we no longer need a workaround for binutils older than 2.24 for accessing VFP control registers from assembler.

Cc Calvin Owens <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc clang-built-linux <[email protected]>
Cc Russell King <[email protected]>
Cc Linus Walleij <[email protected]>

---
Note: applies onto 9410/1

 arch/arm/Kconfig                 |  2 --
 arch/arm/Kconfig.assembler       |  6 ------
 arch/arm/include/asm/vfp.h       | 10 ---------
 arch/arm/include/asm/vfpmacros.h | 11 ----------
 arch/arm/vfp/vfpinstr.h          | 22 --------------------
 5 files changed, 51 deletions(-)
arch/arm/Kconfig +0 -2
index 54b2bb817a7f..854a12d89471 100644
@@ -1747,5 +1747,3 @@ config ARCH_HIBERNATION_POSSIBLE
 	default y if ARCH_SUSPEND_POSSIBLE
 
 endmenu
-
-source "arch/arm/Kconfig.assembler"
arch/arm/Kconfig.assembler deleted +0 -6
deleted file mode 100644
index 5cb31aae1188..000000000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-
-config AS_VFP_VMRS_FPINST
-	def_bool $(as-instr,.fpu vfpv2\nvmrs r0$(comma)FPINST)
-	help
-	  Supported by binutils >= 2.24 and LLVM integrated assembler.
arch/arm/include/asm/vfp.h +0 -10
index 157ea3426158..85ccc422d4d0 100644
@@ -9,16 +9,6 @@
 #ifndef __ASM_VFP_H
 #define __ASM_VFP_H
 
-#ifndef CONFIG_AS_VFP_VMRS_FPINST
-#define FPSID			cr0
-#define FPSCR			cr1
-#define MVFR1			cr6
-#define MVFR0			cr7
-#define FPEXC			cr8
-#define FPINST			cr9
-#define FPINST2			cr10
-#endif
-
 /* FPSID bits */
 #define FPSID_IMPLEMENTER_BIT	(24)
 #define FPSID_IMPLEMENTER_MASK	(0xff << FPSID_IMPLEMENTER_BIT)
arch/arm/include/asm/vfpmacros.h +0 -11
index ba0d4cb5377e..e2e1d5a3727a 100644
@@ -8,7 +8,6 @@
 
 #include <asm/vfp.h>
 
-#ifdef CONFIG_AS_VFP_VMRS_FPINST
 	.macro	VFPFMRX, rd, sysreg, cond
 	vmrs\cond	\rd, \sysreg
 	.endm
@@ -16,16 +15,6 @@
 	.macro	VFPFMXR, sysreg, rd, cond
 	vmsr\cond	\sysreg, \rd
 	.endm
-#else
-	@ Macros to allow building with old toolkits (with no VFP support)
-	.macro	VFPFMRX, rd, sysreg, cond
-	MRC\cond	p10, 7, \rd, \sysreg, cr0, 0	@ FMRX	\rd, \sysreg
-	.endm
-
-	.macro	VFPFMXR, sysreg, rd, cond
-	MCR\cond	p10, 7, \rd, \sysreg, cr0, 0	@ FMXR	\sysreg, \rd
-	.endm
-#endif
 
 	@ read all the working registers back into the VFP
 	.macro	VFPFLDMIA, base, tmp
arch/arm/vfp/vfpinstr.h +0 -22
index 32090b0fb250..a2f0c47e0ce7 100644
@@ -62,8 +62,6 @@
 #define FPSCR_C (1 << 29)
 #define FPSCR_V	(1 << 28)
 
-#ifdef CONFIG_AS_VFP_VMRS_FPINST
-
 #define fmrx(_vfp_) ({				\
 	u32 __v;				\
 	asm volatile (".fpu	vfpv2\n"	\
@@ -78,26 +76,6 @@
 		     : : "r" (_var_) : "cc");	\
 })
 
-#else
-
-#define vfpreg(_vfp_) #_vfp_
-
-#define fmrx(_vfp_) ({						\
-	u32 __v;						\
-	asm volatile ("mrc p10, 7, %0, " vfpreg(_vfp_) ","	\
-		      "cr0, 0 @ fmrx	%0, " #_vfp_		\
-		     : "=r" (__v) : : "cc");			\
-	__v;							\
-})
-
-#define fmxr(_vfp_, _var_) ({					\
-	asm volatile ("mcr p10, 7, %0, " vfpreg(_vfp_) ","	\
-		      "cr0, 0 @ fmxr	" #_vfp_ ", %0"		\
-		     : : "r" (_var_) : "cc");			\
-})
-
-#endif
-
 u32 vfp_single_cpdo(u32 inst, u32 fpscr);
 u32 vfp_single_cprt(u32 inst, u32 fpscr, struct pt_regs *regs);
 
Signature · 1 line
2.46.0.rc1.232.g9752f9e123-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

Now that the minimum supported binutils version is 2.25, we no longer need a workaround for binutils older than 2.24 for accessing VFP control registers from assembler.

Quoted 7 lines
Cc Calvin Owens <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc clang-built-linux <[email protected]>
Cc Russell King <[email protected]>
Cc Linus Walleij <[email protected]>

Neat!

Yours,
Linus Walleij

Reviewed-by on v1 1/1
#2 lore raw
In reply to Ard Biesheuvel
Quoted 6 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

Now that the minimum supported binutils version is 2.25, we no longer need a workaround for binutils older than 2.24 for accessing VFP control registers from assembler.

Quoted 7 lines
Cc Calvin Owens <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc clang-built-linux <[email protected]>
Cc Russell King <[email protected]>
Cc Linus Walleij <[email protected]>

Very nice :)

Quoted 125 lines

---
Note: applies onto 9410/1

 arch/arm/Kconfig                 |  2 --
 arch/arm/Kconfig.assembler       |  6 ------
 arch/arm/include/asm/vfp.h       | 10 ---------
 arch/arm/include/asm/vfpmacros.h | 11 ----------
 arch/arm/vfp/vfpinstr.h          | 22 --------------------
 5 files changed, 51 deletions(-)
arch/arm/Kconfig +0 -2
index 54b2bb817a7f..854a12d89471 100644
@@ -1747,5 +1747,3 @@ config ARCH_HIBERNATION_POSSIBLE
 	default y if ARCH_SUSPEND_POSSIBLE
 
 endmenu
-
-source "arch/arm/Kconfig.assembler"
arch/arm/Kconfig.assembler deleted +0 -6
deleted file mode 100644
index 5cb31aae1188..000000000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-
-config AS_VFP_VMRS_FPINST
-	def_bool $(as-instr,.fpu vfpv2\nvmrs r0$(comma)FPINST)
-	help
-	  Supported by binutils >= 2.24 and LLVM integrated assembler.
arch/arm/include/asm/vfp.h +0 -10
index 157ea3426158..85ccc422d4d0 100644
@@ -9,16 +9,6 @@
 #ifndef __ASM_VFP_H
 #define __ASM_VFP_H
 
-#ifndef CONFIG_AS_VFP_VMRS_FPINST
-#define FPSID			cr0
-#define FPSCR			cr1
-#define MVFR1			cr6
-#define MVFR0			cr7
-#define FPEXC			cr8
-#define FPINST			cr9
-#define FPINST2			cr10
-#endif
-
 /* FPSID bits */
 #define FPSID_IMPLEMENTER_BIT	(24)
 #define FPSID_IMPLEMENTER_MASK	(0xff << FPSID_IMPLEMENTER_BIT)
arch/arm/include/asm/vfpmacros.h +0 -11
index ba0d4cb5377e..e2e1d5a3727a 100644
@@ -8,7 +8,6 @@
 
 #include <asm/vfp.h>
 
-#ifdef CONFIG_AS_VFP_VMRS_FPINST
 	.macro	VFPFMRX, rd, sysreg, cond
 	vmrs\cond	\rd, \sysreg
 	.endm
@@ -16,16 +15,6 @@
 	.macro	VFPFMXR, sysreg, rd, cond
 	vmsr\cond	\sysreg, \rd
 	.endm
-#else
-	@ Macros to allow building with old toolkits (with no VFP support)
-	.macro	VFPFMRX, rd, sysreg, cond
-	MRC\cond	p10, 7, \rd, \sysreg, cr0, 0	@ FMRX	\rd, \sysreg
-	.endm
-
-	.macro	VFPFMXR, sysreg, rd, cond
-	MCR\cond	p10, 7, \rd, \sysreg, cr0, 0	@ FMXR	\sysreg, \rd
-	.endm
-#endif
 
 	@ read all the working registers back into the VFP
 	.macro	VFPFLDMIA, base, tmp
arch/arm/vfp/vfpinstr.h +0 -22
index 32090b0fb250..a2f0c47e0ce7 100644
@@ -62,8 +62,6 @@
 #define FPSCR_C (1 << 29)
 #define FPSCR_V	(1 << 28)
 
-#ifdef CONFIG_AS_VFP_VMRS_FPINST
-
 #define fmrx(_vfp_) ({				\
 	u32 __v;				\
 	asm volatile (".fpu	vfpv2\n"	\
@@ -78,26 +76,6 @@
 		     : : "r" (_var_) : "cc");	\
 })
 
-#else
-
-#define vfpreg(_vfp_) #_vfp_
-
-#define fmrx(_vfp_) ({						\
-	u32 __v;						\
-	asm volatile ("mrc p10, 7, %0, " vfpreg(_vfp_) ","	\
-		      "cr0, 0 @ fmrx	%0, " #_vfp_		\
-		     : "=r" (__v) : : "cc");			\
-	__v;							\
-})
-
-#define fmxr(_vfp_, _var_) ({					\
-	asm volatile ("mcr p10, 7, %0, " vfpreg(_vfp_) ","	\
-		      "cr0, 0 @ fmxr	" #_vfp_ ", %0"		\
-		     : : "r" (_var_) : "cc");			\
-})
-
-#endif
-
 u32 vfp_single_cpdo(u32 inst, u32 fpscr);
 u32 vfp_single_cprt(u32 inst, u32 fpscr, struct pt_regs *regs);
 
Signature · 1 line
2.46.0.rc1.232.g9752f9e123-goog