linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/cpu: Use XGETBV and XSETBV mnemonics in fpu/internal.h
@ 2020-07-07 17:47 Uros Bizjak
  2020-08-18 13:57 ` [tip: x86/cpu] " tip-bot2 for Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2020-07-07 17:47 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: Uros Bizjak

Current minimum required version of binutils is 2.23,
which supports XGETBV and XSETBV instruction mnemonics.

Replace the byte-wise specification of XGETBV and
XSETBV with these proper mnemonics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/include/asm/fpu/internal.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index 845e7481ab77..fbc7a333b28e 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -636,9 +636,7 @@ static inline u64 xgetbv(u32 index)
 {
 	u32 eax, edx;
 
-	asm volatile(".byte 0x0f,0x01,0xd0" /* xgetbv */
-		     : "=a" (eax), "=d" (edx)
-		     : "c" (index));
+	asm volatile("xgetbv" : "=a" (eax), "=d" (edx) : "c" (index));
 	return eax + ((u64)edx << 32);
 }
 
@@ -647,8 +645,7 @@ static inline void xsetbv(u32 index, u64 value)
 	u32 eax = value;
 	u32 edx = value >> 32;
 
-	asm volatile(".byte 0x0f,0x01,0xd1" /* xsetbv */
-		     : : "a" (eax), "d" (edx), "c" (index));
+	asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index));
 }
 
 #endif /* _ASM_X86_FPU_INTERNAL_H */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: x86/cpu] x86/cpu: Use XGETBV and XSETBV mnemonics in fpu/internal.h
  2020-07-07 17:47 [PATCH] x86/cpu: Use XGETBV and XSETBV mnemonics in fpu/internal.h Uros Bizjak
@ 2020-08-18 13:57 ` tip-bot2 for Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2020-08-18 13:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Uros Bizjak, Borislav Petkov, x86, LKML

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID:     86109813990b5d6d6cfb8072382ee69d11ea9460
Gitweb:        https://git.kernel.org/tip/86109813990b5d6d6cfb8072382ee69d11ea9460
Author:        Uros Bizjak <ubizjak@gmail.com>
AuthorDate:    Tue, 07 Jul 2020 19:47:22 +02:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 18 Aug 2020 15:49:07 +02:00

x86/cpu: Use XGETBV and XSETBV mnemonics in fpu/internal.h

Current minimum required version of binutils is 2.23, which supports
XGETBV and XSETBV instruction mnemonics.

Replace the byte-wise specification of XGETBV and XSETBV with these
proper mnemonics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200707174722.58651-1-ubizjak@gmail.com
---
 arch/x86/include/asm/fpu/internal.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index 0a460f2..21a8b52 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -602,9 +602,7 @@ static inline u64 xgetbv(u32 index)
 {
 	u32 eax, edx;
 
-	asm volatile(".byte 0x0f,0x01,0xd0" /* xgetbv */
-		     : "=a" (eax), "=d" (edx)
-		     : "c" (index));
+	asm volatile("xgetbv" : "=a" (eax), "=d" (edx) : "c" (index));
 	return eax + ((u64)edx << 32);
 }
 
@@ -613,8 +611,7 @@ static inline void xsetbv(u32 index, u64 value)
 	u32 eax = value;
 	u32 edx = value >> 32;
 
-	asm volatile(".byte 0x0f,0x01,0xd1" /* xsetbv */
-		     : : "a" (eax), "d" (edx), "c" (index));
+	asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index));
 }
 
 #endif /* _ASM_X86_FPU_INTERNAL_H */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-18 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 17:47 [PATCH] x86/cpu: Use XGETBV and XSETBV mnemonics in fpu/internal.h Uros Bizjak
2020-08-18 13:57 ` [tip: x86/cpu] " tip-bot2 for Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).