Skip to contentSkip to conversation

s390: Raise minimum clang version to 19.1.0

PATCH In review Heiko Carstens 2 participants 7 messages Nov 13, 2024 – Nov 14, 2024 s390

lore
Share & tools
lore

Heiko Carstens

author maintainer
#0 lore raw

cover s390: Raise minimum clang version to 19.1.0

In order to get rid of special inline assemblies for old clang versions, raise the minimum clang version to 19.1.0 for s390.

This allows to make use of various inline assembly format flags for which support has been added with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

Heiko Carstens (2):
scripts/min-tool-version.sh: Raise minimum clang version to 19.1.0 for s390 s390/fpu: Remove inline assembly variants for old clang versions

 arch/s390/include/asm/fpu-insn.h | 124 -------------------------------
 scripts/min-tool-version.sh      |   2 +-
 2 files changed, 1 insertion(+), 125 deletions(-)
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH 1/2 scripts/min-tool-version.sh: Raise minimum clang version to 19.1.0 for s390

Raise minimum clang version to 19.1.0 for s390 so that various inline assembly format flags can be used. The missing format flags were implemented with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

---
 scripts/min-tool-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/min-tool-version.sh +1 -1
index 91c91201212c..2dc674a74624 100755
@@ -25,7 +25,7 @@ gcc)
 	;;
 llvm)
 	if [ "$SRCARCH" = s390 ]; then
-		echo 15.0.0
+		echo 19.1.0
 	elif [ "$SRCARCH" = loongarch ]; then
 		echo 18.0.0
 	else
Signature · 1 line
2.45.2
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] scripts/min-tool-version.sh: Raise minimum clang version to 19.1.0 for s390

Quoted 6 lines · Heiko Carstens

Raise minimum clang version to 19.1.0 for s390 so that various inline assembly format flags can be used. The missing format flags were implemented with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

Oof, this is quite new but now that kernel.org has LLVM binaries available, I do not think this is an unreasonable ask, especially if it makes your life easier with code maintenance.

One question: Is it worth dropping the mention about CC=clang for clang-18 and older in Documentation/kbuild/llvm.rst? Maybe it is better to leave it around for a bit just in case people read the newer documentation while working on an older kernel?

Quoted 20 lines
---
 scripts/min-tool-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/min-tool-version.sh +1 -1
index 91c91201212c..2dc674a74624 100755
@@ -25,7 +25,7 @@ gcc)
 	;;
 llvm)
 	if [ "$SRCARCH" = s390 ]; then
-		echo 15.0.0
+		echo 19.1.0
 	elif [ "$SRCARCH" = loongarch ]; then
 		echo 18.0.0
 	else
Signature · 1 line
2.45.2
author maintainer
#3 lore raw

Re: [PATCH 1/2] scripts/min-tool-version.sh: Raise minimum clang version to 19.1.0 for s390

Quoted 11 lines · Nathan Chancellor
Quoted 6 lines · Heiko Carstens

Raise minimum clang version to 19.1.0 for s390 so that various inline assembly format flags can be used. The missing format flags were implemented with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

Oof, this is quite new but now that kernel.org has LLVM binaries available, I do not think this is an unreasonable ask, especially if it makes your life easier with code maintenance.

Thanks for your feedback! I read this as "is nearly unreasonable" :)

Even though you acked this, I guess I will drop this for now and maybe address this a few clang versions later.

#4 lore raw

Re: [PATCH 1/2] scripts/min-tool-version.sh: Raise minimum clang version to 19.1.0 for s390

Quoted 7 lines · Heiko Carstens
Quoted 6 lines · Nathan Chancellor
Quoted 5 lines · Heiko Carstens

Raise minimum clang version to 19.1.0 for s390 so that various inline assembly format flags can be used. The missing format flags were implemented with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Oof, this is quite new but now that kernel.org has LLVM binaries available, I do not think this is an unreasonable ask, especially if it makes your life easier with code maintenance.

Thanks for your feedback! I read this as "is nearly unreasonable" :)

Yeah, that is probably a fair way to put it :)

Quoted 2 lines

Even though you acked this, I guess I will drop this for now and maybe address this a few clang versions later.

Yes, I think waiting until that LLVM change has had some time to actually make it into the hands of users would be good if it is not too much of a burden. However, if you start writing new kernel code that depends on these format flags, it may be reasonable to revisit this series at that point for ease of maintenance on your end.

Cheers,
Nathan

author maintainer
#5 lore raw

PATCH 2/2 s390/fpu: Remove inline assembly variants for old clang versions

In reply to Heiko Carstens

With the minimal clang version raised to 19.1.0 there is no need to keep the inline assemblies for old clang versions which do not support the O and R inline assembly format flags.

Support for those flags was added with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

---
 arch/s390/include/asm/fpu-insn.h | 124 -------------------------------
 1 file changed, 124 deletions(-)
arch/s390/include/asm/fpu-insn.h +0 -124
index c1e2e521d9af..e57d80981f13 100644
@@ -183,22 +183,6 @@ static __always_inline void fpu_vgfmg(u8 v1, u8 v2, u8 v3)
 		     : "memory");
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vl(u8 v1, const void *vxr)
-{
-	instrument_read(vxr, sizeof(__vector128));
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VL	%[v1],0,,1\n"
-		:
-		: [vxr] "R" (*(__vector128 *)vxr),
-		  [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vl(u8 v1, const void *vxr)
 {
 	instrument_read(vxr, sizeof(__vector128));
@@ -209,8 +193,6 @@ static __always_inline void fpu_vl(u8 v1, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vleib(u8 v, s16 val, u8 index)
 {
 	asm volatile("VLEIB	%[v],%[val],%[index]"
@@ -238,26 +220,6 @@ static __always_inline u64 fpu_vlgvf(u8 v, u16 index)
 	return val;
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
-{
-	unsigned int size;
-
-	size = min(index + 1, sizeof(__vector128));
-	instrument_read(vxr, size);
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VLL	%[v1],%[index],0,1\n"
-		:
-		: [vxr] "R" (*(u8 *)vxr),
-		  [index] "d" (index),
-		  [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 {
 	unsigned int size;
@@ -272,30 +234,6 @@ static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-#define fpu_vlm(_v1, _v3, _vxrs)					\
-({									\
-	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
-	struct {							\
-		__vector128 _v[(_v3) - (_v1) + 1];			\
-	} *_v = (void *)(_vxrs);					\
-									\
-	instrument_read(_v, size);					\
-	asm volatile("\n"						\
-		"	la	1,%[vxrs]\n"				\
-		"	VLM	%[v1],%[v3],0,1\n"			\
-		:							\
-		: [vxrs] "R" (*_v),					\
-		  [v1] "I" (_v1), [v3] "I" (_v3)			\
-		: "memory", "1");					\
-	(_v3) - (_v1) + 1;						\
-})
-
-#else /* CONFIG_CC_IS_CLANG */
-
 #define fpu_vlm(_v1, _v3, _vxrs)					\
 ({									\
 	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
@@ -312,8 +250,6 @@ static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 	(_v3) - (_v1) + 1;						\
 })
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vlr(u8 v1, u8 v2)
 {
 	asm volatile("VLR	%[v1],%[v2]"
@@ -362,21 +298,6 @@ static __always_inline void fpu_vsrlb(u8 v1, u8 v2, u8 v3)
 		     : "memory");
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vst(u8 v1, const void *vxr)
-{
-	instrument_write(vxr, sizeof(__vector128));
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VST	%[v1],0,,1\n"
-		: [vxr] "=R" (*(__vector128 *)vxr)
-		: [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vst(u8 v1, const void *vxr)
 {
 	instrument_write(vxr, sizeof(__vector128));
@@ -386,26 +307,6 @@ static __always_inline void fpu_vst(u8 v1, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
-{
-	unsigned int size;
-
-	size = min(index + 1, sizeof(__vector128));
-	instrument_write(vxr, size);
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VSTL	%[v1],%[index],0,1\n"
-		: [vxr] "=R" (*(u8 *)vxr)
-		: [index] "d" (index), [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 {
 	unsigned int size;
@@ -418,29 +319,6 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-#define fpu_vstm(_v1, _v3, _vxrs)					\
-({									\
-	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
-	struct {							\
-		__vector128 _v[(_v3) - (_v1) + 1];			\
-	} *_v = (void *)(_vxrs);					\
-									\
-	instrument_write(_v, size);					\
-	asm volatile("\n"						\
-		"	la	1,%[vxrs]\n"				\
-		"	VSTM	%[v1],%[v3],0,1\n"			\
-		: [vxrs] "=R" (*_v)					\
-		: [v1] "I" (_v1), [v3] "I" (_v3)			\
-		: "memory", "1");					\
-	(_v3) - (_v1) + 1;						\
-})
-
-#else /* CONFIG_CC_IS_CLANG */
-
 #define fpu_vstm(_v1, _v3, _vxrs)					\
 ({									\
 	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
@@ -456,8 +334,6 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 	(_v3) - (_v1) + 1;						\
 })
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vupllf(u8 v1, u8 v2)
 {
 	asm volatile("VUPLLF	%[v1],%[v2]"
Signature · 1 line
2.45.2
Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] s390/fpu: Remove inline assembly variants for old clang versions

Quoted 8 lines · Heiko Carstens

With the minimal clang version raised to 19.1.0 there is no need to keep the inline assemblies for old clang versions which do not support the O and R inline assembly format flags.

Support for those flags was added with llvm-project commit 9c75a981554d ("[SystemZ] Implement A, O and R inline assembly format flags (#80685)").

I will trust that it compiles :)

Quoted 198 lines
---
 arch/s390/include/asm/fpu-insn.h | 124 -------------------------------
 1 file changed, 124 deletions(-)
arch/s390/include/asm/fpu-insn.h +0 -124
index c1e2e521d9af..e57d80981f13 100644
@@ -183,22 +183,6 @@ static __always_inline void fpu_vgfmg(u8 v1, u8 v2, u8 v3)
 		     : "memory");
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vl(u8 v1, const void *vxr)
-{
-	instrument_read(vxr, sizeof(__vector128));
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VL	%[v1],0,,1\n"
-		:
-		: [vxr] "R" (*(__vector128 *)vxr),
-		  [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vl(u8 v1, const void *vxr)
 {
 	instrument_read(vxr, sizeof(__vector128));
@@ -209,8 +193,6 @@ static __always_inline void fpu_vl(u8 v1, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vleib(u8 v, s16 val, u8 index)
 {
 	asm volatile("VLEIB	%[v],%[val],%[index]"
@@ -238,26 +220,6 @@ static __always_inline u64 fpu_vlgvf(u8 v, u16 index)
 	return val;
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
-{
-	unsigned int size;
-
-	size = min(index + 1, sizeof(__vector128));
-	instrument_read(vxr, size);
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VLL	%[v1],%[index],0,1\n"
-		:
-		: [vxr] "R" (*(u8 *)vxr),
-		  [index] "d" (index),
-		  [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 {
 	unsigned int size;
@@ -272,30 +234,6 @@ static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-#define fpu_vlm(_v1, _v3, _vxrs)					\
-({									\
-	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
-	struct {							\
-		__vector128 _v[(_v3) - (_v1) + 1];			\
-	} *_v = (void *)(_vxrs);					\
-									\
-	instrument_read(_v, size);					\
-	asm volatile("\n"						\
-		"	la	1,%[vxrs]\n"				\
-		"	VLM	%[v1],%[v3],0,1\n"			\
-		:							\
-		: [vxrs] "R" (*_v),					\
-		  [v1] "I" (_v1), [v3] "I" (_v3)			\
-		: "memory", "1");					\
-	(_v3) - (_v1) + 1;						\
-})
-
-#else /* CONFIG_CC_IS_CLANG */
-
 #define fpu_vlm(_v1, _v3, _vxrs)					\
 ({									\
 	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
@@ -312,8 +250,6 @@ static __always_inline void fpu_vll(u8 v1, u32 index, const void *vxr)
 	(_v3) - (_v1) + 1;						\
 })
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vlr(u8 v1, u8 v2)
 {
 	asm volatile("VLR	%[v1],%[v2]"
@@ -362,21 +298,6 @@ static __always_inline void fpu_vsrlb(u8 v1, u8 v2, u8 v3)
 		     : "memory");
 }
 
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vst(u8 v1, const void *vxr)
-{
-	instrument_write(vxr, sizeof(__vector128));
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VST	%[v1],0,,1\n"
-		: [vxr] "=R" (*(__vector128 *)vxr)
-		: [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vst(u8 v1, const void *vxr)
 {
 	instrument_write(vxr, sizeof(__vector128));
@@ -386,26 +307,6 @@ static __always_inline void fpu_vst(u8 v1, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
-{
-	unsigned int size;
-
-	size = min(index + 1, sizeof(__vector128));
-	instrument_write(vxr, size);
-	asm volatile("\n"
-		"	la	1,%[vxr]\n"
-		"	VSTL	%[v1],%[index],0,1\n"
-		: [vxr] "=R" (*(u8 *)vxr)
-		: [index] "d" (index), [v1] "I" (v1)
-		: "memory", "1");
-}
-
-#else /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 {
 	unsigned int size;
@@ -418,29 +319,6 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 		     : "memory");
 }
 
-#endif /* CONFIG_CC_IS_CLANG */
-
-#ifdef CONFIG_CC_IS_CLANG
-
-#define fpu_vstm(_v1, _v3, _vxrs)					\
-({									\
-	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
-	struct {							\
-		__vector128 _v[(_v3) - (_v1) + 1];			\
-	} *_v = (void *)(_vxrs);					\
-									\
-	instrument_write(_v, size);					\
-	asm volatile("\n"						\
-		"	la	1,%[vxrs]\n"				\
-		"	VSTM	%[v1],%[v3],0,1\n"			\
-		: [vxrs] "=R" (*_v)					\
-		: [v1] "I" (_v1), [v3] "I" (_v3)			\
-		: "memory", "1");					\
-	(_v3) - (_v1) + 1;						\
-})
-
-#else /* CONFIG_CC_IS_CLANG */
-
 #define fpu_vstm(_v1, _v3, _vxrs)					\
 ({									\
 	unsigned int size = ((_v3) - (_v1) + 1) * sizeof(__vector128);	\
@@ -456,8 +334,6 @@ static __always_inline void fpu_vstl(u8 v1, u32 index, const void *vxr)
 	(_v3) - (_v1) + 1;						\
 })
 
-#endif /* CONFIG_CC_IS_CLANG */
-
 static __always_inline void fpu_vupllf(u8 v1, u8 v2)
 {
 	asm volatile("VUPLLF	%[v1],%[v2]"
Signature · 1 line
2.45.2