lkml.org 
[lkml]   [2018]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
From
Subject[PATCH 07/35] x86: Annotate static_cpu_has alternative
In order to recognise static_cpu_has() alternatives from any other
alternative without dodgy heuristics, we need to explicitly mark them.
Use the new type field for this.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/alternative.h | 1 +
arch/x86/include/asm/cpufeature.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)

--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -46,6 +46,7 @@
#endif

#define ALT_TYPE_DEFAULT 0
+#define ALT_TYPE_STATIC_CPU_HAS 1 /* objtool, static_cpu_has */

struct alt_instr {
s32 instr_offset; /* original instruction */
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -157,7 +157,7 @@ static __always_inline __pure bool _stat
" .byte 3b - 1b\n" /* src len */
" .byte 5f - 4f\n" /* repl len */
" .byte 3b - 2b\n" /* pad len */
- " .byte 0\n" /* type */
+ " .byte %P[type]\n" /* type */
".previous\n"
".section .altinstr_replacement,\"ax\"\n"
"4: jmp %l[t_no]\n"
@@ -170,7 +170,7 @@ static __always_inline __pure bool _stat
" .byte 3b - 1b\n" /* src len */
" .byte 0\n" /* repl len */
" .byte 0\n" /* pad len */
- " .byte 0\n" /* type */
+ " .byte %P[type]\n" /* type */
".previous\n"
".section .altinstr_aux,\"ax\"\n"
"6:\n"
@@ -181,6 +181,7 @@ static __always_inline __pure bool _stat
: : [feature] "i" (bit),
[always] "i" (X86_FEATURE_ALWAYS),
[bitnum] "i" (1 << (bit & 7)),
+ [type] "i" (ALT_TYPE_STATIC_CPU_HAS),
[cap_byte] "m" (((const char *)boot_cpu_data.x86_capability)[bit >> 3])
: : t_yes, t_no);
t_yes:

\
 
 \ /
  Last update: 2018-01-18 16:09    [W:0.203 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site