]> xenbits.xensource.com Git - xen.git/commitdiff
x86: drop XSAVEOPT and CLWB build flags
authorAlexander M. Merritt <alexander@edera.dev>
Thu, 3 Apr 2025 23:22:19 +0000 (23:22 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 Apr 2025 11:55:06 +0000 (12:55 +0100)
The new toolchain baseline knows both the XSAVEOPT and CLWB instructions.

It knows CLFLUSHOPT too, so fix up those.

No functional change.

Resolves: https://gitlab.com/xen-project/xen/-/work_items/205
Signed-off-by: "Alexander M. Merritt" <alexander@edera.dev>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/arch.mk
xen/arch/x86/flushtlb.c
xen/arch/x86/include/asm/system.h

index 3bbaee2a4404141e37e794c988a7e2a2be49437b..8615533697e78dba97ddb1bdcfbb6d90fc5fd977 100644 (file)
@@ -11,9 +11,7 @@ CFLAGS += -msoft-float
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND)
-$(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT)
 $(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED)
-$(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM)
 $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR)
 $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
index 65be0474a8ead655736d8ba1406fe5aeb3882f51..1e0011d5b10ccf706c01b7a7fd37344d75ed9008 100644 (file)
@@ -287,7 +287,7 @@ void cache_flush(const void *addr, unsigned int size)
          * of letting the alternative framework fill the gap by appending nops.
          */
         alternative_input("ds; clflush %[p]",/* Semicolon for Clang-IAS < 12 */
-                          "data16 clflush %[p]", /* clflushopt */
+                          "clflushopt %[p]",
                            X86_FEATURE_CLFLUSHOPT,
                            [p] "m" (*(const char *)(addr)));
     }
@@ -313,33 +313,7 @@ void cache_writeback(const void *addr, unsigned int size)
     clflush_size = current_cpu_data.x86_clflush_size ?: 16;
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-    {
-/*
- * The arguments to a macro must not include preprocessor directives. Doing so
- * results in undefined behavior, so we have to create some defines here in
- * order to avoid it.
- */
-#if defined(HAVE_AS_CLWB)
-# define CLWB_ENCODING "clwb %[p]"
-#elif defined(HAVE_AS_XSAVEOPT)
-# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
-#else
-# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
-#endif
-
-#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
-#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
-# define INPUT BASE_INPUT
-#else
-# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
-#endif
-
-        asm volatile (CLWB_ENCODING :: INPUT(addr));
-
-#undef INPUT
-#undef BASE_INPUT
-#undef CLWB_ENCODING
-    }
+        clwb(addr);
 
     asm volatile ("sfence" ::: "memory");
 }
index 8ceaaf45d1a05e2e7434a30e4a7753ca861d1256..57446c5b465ceac23df78b6bec07a3f903964976 100644 (file)
@@ -23,19 +23,12 @@ static inline void clflush(const void *p)
 
 static inline void clflushopt(const void *p)
 {
-    asm volatile ( "data16 clflush %0" :: "m" (*(const char *)p) );
+    asm volatile ( "clflushopt %0" :: "m" (*(const char *)p) );
 }
 
 static inline void clwb(const void *p)
 {
-#if defined(HAVE_AS_CLWB)
     asm volatile ( "clwb %0" :: "m" (*(const char *)p) );
-#elif defined(HAVE_AS_XSAVEOPT)
-    asm volatile ( "data16 xsaveopt %0" :: "m" (*(const char *)p) );
-#else
-    asm volatile ( ".byte 0x66, 0x0f, 0xae, 0x32"
-                   :: "d" (p), "m" (*(const char *)p) );
-#endif
 }
 
 #define xchg(ptr,v) \