]> xenbits.xensource.com Git - xen.git/commitdiff
x86: further CPUID handling adjustments
authorJan Beulich <jbeulich@suse.com>
Wed, 18 Apr 2018 14:53:40 +0000 (16:53 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 18 Apr 2018 14:53:40 +0000 (16:53 +0200)
In particular for Dom0 we need to make sure to surface Spectre related
feature flags.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/traps.c
xen/include/asm-x86/cpuid.h

index 2596597b3a0c1c65a3cd2979abf77993d0652780..5211c23fb224c0188cfc7d5385c5d1d0688e89a3 100644 (file)
@@ -3497,6 +3497,9 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
 
             *ecx &= hvm_featureset[FEATURESET_7c0];
 
+            *edx |= cpufeat_mask(X86_FEATURE_STIBP);
+            *edx &= hvm_featureset[FEATURESET_7d0];
+
             /* Don't expose HAP-only features to non-hap guests. */
             if ( !hap_enabled(d) )
             {
@@ -3654,6 +3657,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
         hvm_cpuid(0x80000001, NULL, NULL, NULL, &_edx);
         *eax |= (_edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits : 32) << 8;
 
+        *ebx |= cpufeat_mask(X86_FEATURE_IBPB);
         *ebx &= hvm_featureset[FEATURESET_e8b];
         break;
     }
index e5884039bf3269aedaa584964fcace2efb1bfdff..e96a5d36421e60229012340c05ed31712ae6eff1 100644 (file)
@@ -1089,6 +1089,9 @@ void pv_cpuid(struct cpu_user_regs *regs)
 
             c &= pv_featureset[FEATURESET_7c0];
 
+            d |= cpufeat_mask(X86_FEATURE_STIBP);
+            d &= pv_featureset[FEATURESET_7d0];
+
             if ( !is_pvh_domain(currd) )
             {
                 /*
@@ -1102,8 +1105,8 @@ void pv_cpuid(struct cpu_user_regs *regs)
             }
         }
         else
-            b = c = 0;
-        a = d = 0;
+            b = c = d = 0;
+        a = 0;
         break;
 
     case XSTATE_CPUID:
@@ -1185,6 +1188,7 @@ void pv_cpuid(struct cpu_user_regs *regs)
 
     case 0x80000008:
         a = paddr_bits | (vaddr_bits << 8);
+        b |= cpufeat_mask(X86_FEATURE_IBPB);
         b &= pv_featureset[FEATURESET_e8b];
         break;
 
index 9a21c25ec10ae27f3ba70e100d272f4043908971..abe2874eb9f422e960a1840b7fe0747d7bca5ce1 100644 (file)
@@ -16,6 +16,7 @@
 #define FEATURESET_7c0    6 /* 0x00000007:0.ecx    */
 #define FEATURESET_e7d    7 /* 0x80000007.edx      */
 #define FEATURESET_e8b    8 /* 0x80000008.ebx      */
+#define FEATURESET_7d0    9 /* 0x00000007:0.edx    */
 
 #ifndef __ASSEMBLY__
 #include <xen/types.h>