]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86/boot: Record MSR_ARCH_CAPS for the Raw and Host CPU policy
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 12 May 2023 14:37:02 +0000 (15:37 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Aug 2023 15:02:17 +0000 (16:02 +0100)
Extend x86_cpu_policy_fill_native() with a read of ARCH_CAPS based on the
CPUID information just read, removing the specially handling in
calculate_raw_cpu_policy().

Right now, the only use of x86_cpu_policy_fill_native() outside of Xen is the
unit tests.  Getting MSR data in this context is left to whomever first
encounters a genuine need to have it.

Extend generic_identify() to read ARCH_CAPS into x86_capability[], which is
fed into the Host Policy.  This in turn means there's no need to special case
arch_caps in calculate_host_policy().

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit 70553000d6b44dd7c271a35932b0b3e1f22c5532)

xen/arch/x86/cpu-policy.c
xen/arch/x86/cpu/common.c
xen/lib/x86/cpuid.c

index 630c133daf08ac5b7613b80d9bb341ead1948ebd..db04ffb8992dc8a26dc81a569e93e23448744d47 100644 (file)
@@ -354,9 +354,6 @@ static void __init calculate_raw_policy(void)
 
     /* 0x000000ce  MSR_INTEL_PLATFORM_INFO */
     /* Was already added by probe_cpuid_faulting() */
-
-    if ( cpu_has_arch_caps )
-        rdmsrl(MSR_ARCH_CAPABILITIES, p->arch_caps.raw);
 }
 
 static void __init calculate_host_policy(void)
@@ -409,15 +406,6 @@ static void __init calculate_host_policy(void)
     /* 0x000000ce  MSR_INTEL_PLATFORM_INFO */
     /* probe_cpuid_faulting() sanity checks presence of MISC_FEATURES_ENABLES */
     p->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
-
-    /* Temporary, until we have known_features[] for feature bits in MSRs. */
-    p->arch_caps.raw = raw_cpu_policy.arch_caps.raw &
-        (ARCH_CAPS_RDCL_NO | ARCH_CAPS_IBRS_ALL | ARCH_CAPS_RSBA |
-         ARCH_CAPS_SKIP_L1DFL | ARCH_CAPS_SSB_NO | ARCH_CAPS_MDS_NO |
-         ARCH_CAPS_IF_PSCHANGE_MC_NO | ARCH_CAPS_TSX_CTRL | ARCH_CAPS_TAA_NO |
-         ARCH_CAPS_SBDR_SSDP_NO | ARCH_CAPS_FBSDP_NO | ARCH_CAPS_PSDP_NO |
-         ARCH_CAPS_FB_CLEAR | ARCH_CAPS_RRSBA | ARCH_CAPS_BHI_NO |
-         ARCH_CAPS_PBRSB_NO);
 }
 
 static void __init guest_common_default_feature_adjustments(uint32_t *fs)
index ce692328086e76c022e42d2013f9a32086604cfc..ffa609930766cddfa80306c6601316e4abc0ed2f 100644 (file)
@@ -471,6 +471,11 @@ static void generic_identify(struct cpuinfo_x86 *c)
                cpuid_count(0xd, 1,
                            &c->x86_capability[FEATURESET_Da1],
                            &tmp, &tmp, &tmp);
+
+       if (test_bit(X86_FEATURE_ARCH_CAPS, c->x86_capability))
+               rdmsr(MSR_ARCH_CAPABILITIES,
+                     c->x86_capability[FEATURESET_m10Al],
+                     c->x86_capability[FEATURESET_m10Ah]);
 }
 
 /*
index e795ce375032ce15c9c165879b55d061ce6d7449..07e55019144856004efe5adcab8b44b4e932a94f 100644 (file)
@@ -226,7 +226,12 @@ void x86_cpu_policy_fill_native(struct cpu_policy *p)
     p->hv_limit = 0;
     p->hv2_limit = 0;
 
-    /* TODO MSRs */
+#ifdef __XEN__
+    /* TODO MSR_PLATFORM_INFO */
+
+    if ( p->feat.arch_caps )
+        rdmsrl(MSR_ARCH_CAPABILITIES, p->arch_caps.raw);
+#endif
 
     x86_cpu_policy_recalc_synth(p);
 }