]> xenbits.xensource.com Git - xtf.git/commitdiff
Extend rtm-check to report the RTM_ALWAYS_ABORT flag master
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 6 Apr 2024 19:25:43 +0000 (20:25 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Nov 2024 11:44:54 +0000 (11:44 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/include/arch/cpuid.h
arch/x86/setup.c
include/xen/arch-x86/cpufeatureset.h
tests/rtm-check/main.c

index e6d6a8cef61dd0ee4bc06c26d46856fe2b34486f..364b0b4f8d9264c00d8f0d27cd53ca23bf3cec3b 100644 (file)
@@ -47,8 +47,9 @@ static inline bool vendor_is(enum x86_vendor v)
 #define FEATURESET_7c0          cpufeat_word(X86_FEATURE_PREFETCHWT1)
 #define FEATURESET_e7d          cpufeat_word(X86_FEATURE_ITSC)
 #define FEATURESET_e8b          cpufeat_word(X86_FEATURE_CLZERO)
 #define FEATURESET_7c0          cpufeat_word(X86_FEATURE_PREFETCHWT1)
 #define FEATURESET_e7d          cpufeat_word(X86_FEATURE_ITSC)
 #define FEATURESET_e8b          cpufeat_word(X86_FEATURE_CLZERO)
+#define FEATURESET_7d0          cpufeat_word(X86_FEATURE_RTM_ALWAYS_ABORT)
 
 
-#define FSCAPINTS               (FEATURESET_e8b + 1)
+#define FSCAPINTS               (FEATURESET_7d0 + 1)
 
 extern uint32_t x86_features[FSCAPINTS];
 
 
 extern uint32_t x86_features[FSCAPINTS];
 
@@ -98,6 +99,8 @@ static inline bool cpu_has(unsigned int feature)
 #define cpu_has_umip            cpu_has(X86_FEATURE_UMIP)
 #define cpu_has_pku             cpu_has(X86_FEATURE_PKU)
 
 #define cpu_has_umip            cpu_has(X86_FEATURE_UMIP)
 #define cpu_has_pku             cpu_has(X86_FEATURE_PKU)
 
+#define cpu_has_rtm_always_abort cpu_has(X86_FEATURE_RTM_ALWAYS_ABORT)
+
 #endif /* XTF_X86_CPUID_H */
 
 /*
 #endif /* XTF_X86_CPUID_H */
 
 /*
index d47fb620109112c277dfbb03ab1fc0d30911c5dd..c797e57bae62d8b37fab0d55a0ec6576924423aa 100644 (file)
@@ -71,7 +71,7 @@ static void collect_cpuid(cpuid_count_fn_t cpuid_fn)
         cpuid_fn(7, 0, &tmp,
                  &x86_features[FEATURESET_7b0],
                  &x86_features[FEATURESET_7c0],
         cpuid_fn(7, 0, &tmp,
                  &x86_features[FEATURESET_7b0],
                  &x86_features[FEATURESET_7c0],
-                 &tmp);
+                 &x86_features[FEATURESET_7d0]);
     if ( max_leaf >= 0xd )
         cpuid_fn(0xd, 0,
                  &x86_features[FEATURESET_Da1],
     if ( max_leaf >= 0xd )
         cpuid_fn(0xd, 0,
                  &x86_features[FEATURESET_Da1],
index f66a4ab11dd5a04b9fb9b2af06345ed7d6a6dfa5..0604780c12f51ff08773f00da9a1a3c52d38be02 100644 (file)
 /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */
 #define X86_FEATURE_CLZERO        (8*32+ 0) /* CLZERO instruction */
 
 /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */
 #define X86_FEATURE_CLZERO        (8*32+ 0) /* CLZERO instruction */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
+#define X86_FEATURE_RTM_ALWAYS_ABORT (9*32+11) /* RTM disabled (XBEGIN aborts) */
+
 #endif /* XEN_PUBLIC_ARCH_X86_CPUFEATURESET_H */
 
 /*
 #endif /* XEN_PUBLIC_ARCH_X86_CPUFEATURESET_H */
 
 /*
index eadee268ea5f9086dd76fb74d59e4ecdbd76d76e..fafb10eefeeb94bfc6b774a58dab79716107ee84 100644 (file)
@@ -15,8 +15,8 @@ const char test_title[] = "Test RTM behaviour";
 
 void test_main(void)
 {
 
 void test_main(void)
 {
-    printk("CPUID: HLE %u, RTM %u\n",
-           cpu_has_hle, cpu_has_rtm);
+    printk("CPUID: HLE %u, RTM %u, RTM_ALWAYS_ABORT %u\n",
+           cpu_has_hle, cpu_has_rtm, cpu_has_rtm_always_abort);
 
     for ( int i = 0; i < 1000; ++i )
     {
 
     for ( int i = 0; i < 1000; ++i )
     {