[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/5] x86/msr: Expose MSR_ARCH_CAPS in the raw and host policies


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 11 Jun 2021 17:36:25 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Jan Beulich" <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 11 Jun 2021 16:36:55 +0000
  • Ironport-hdrordr: A9a23:S3ZKOa2L7Fr689kvE6CDQgqjBcpxeYIsimQD101hICG9Lfbo8v xGzc5rtyMc1gxhO03IwerwSZVohEmsgaKdkrNhTYtKPTOGhILMFupfBOTZskDd8kHFh4hgPO JbAtZD4b7LfBpHZKTBkXWF+r8bqbHsnc7J9IOuqEuBVTsEV0gj1XYHNu/yKDwxeOAsP+tAKH Po3Ls8m9PWQwVtUi3UPAh9Y8Hz4/fMmZ7afxhDIxI88gGBgROEgYSKVySw71M1VT5C/KklyH PCmQDi/Kmv2svLjSM041Wjtqi+1eGRlueqy6S3+4YowmGHsGqVTbUkf4fHkCE+oemp5lpvus LLuQ0cM8N67G6UVn2poDP2sjOQhQoG2jvH8xu1kHHjqcv2SHYREMxan79UdRPf9g4JoMx86q RWxGiU3qAnXy8opB6Ns+QgaisaxnZc4EBSwNL7tkYvD7f2vYUh/rD2/ytuYdo99WzBmcVXR9 WHyqnnla5rmBihHgPkV1JUsZWRtq5aJGbcfqFLgL3m79F3pgEi86JK/r1Dop/3nKhNBKWt2Y z/Q+9VfEYndL5bUUs6PpZffSP8YFa9NC7kISaXOxDqBasHM3XCp9r+56g0/vijfNgNwIEpkJ rMXVtEvSpqEnieSfGmzdlO6FTAUW+9VTPixoVX4IV4oKT1QP7uPTeYQF4jnsO8q7EUA9HdWf y0JJVKasWTbFcGPLw5nDEWaqMiY0X2CvdlzOrTc2j+6v4jBLeawdDmTA==
  • Ironport-sdr: xrSGWtslKYaKBq4K6IL5VyQMKgp6haUR+g8xAsBarllu5V+3lM9qe7FIAw+6U5RjHBW0ycZywg FDCWD1a1Z5OWnlkIg4kuVGnpGqIfZvioF/QGFjiwS24CtJ8wrfXCeLxfahX8ID5m8RldEBiXE9 ahR5WaN3SDqohtxF8F07vO0Ls3QQBCkBZx1zrYpv0DlTAst3fuNmTAmFtyo9CwTuoiLfMgXF8P 6sD+DvxQvW0jd9pPyPk3A9Cp/0elYQRy0Hx+s3W4JugOxcjXNyRh3ryEDpEBGxHw2sHfVQYrI3 nxk=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

MSR_ARCH_CAPS is still not supported for guests (other than the hardware
domain) yet, until the toolstack learns how to construct an MSR policy.

However, we want access to the host ARCH_CAPS_TSX_CTRL value in particular for
testing purposes.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
---
 xen/arch/x86/msr.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 374f92b2c5..6dbb4744e7 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -47,8 +47,13 @@ struct msr_policy __read_mostly hvm_def_msr_policy;
 
 static void __init calculate_raw_policy(void)
 {
+    struct msr_policy *mp = &raw_msr_policy;
+
     /* 0x000000ce  MSR_INTEL_PLATFORM_INFO */
     /* Was already added by probe_cpuid_faulting() */
+
+    if ( cpu_has_arch_caps )
+        rdmsrl(MSR_ARCH_CAPABILITIES, mp->arch_caps.raw);
 }
 
 static void __init calculate_host_policy(void)
@@ -60,6 +65,11 @@ static void __init calculate_host_policy(void)
     /* 0x000000ce  MSR_INTEL_PLATFORM_INFO */
     /* probe_cpuid_faulting() sanity checks presence of MISC_FEATURES_ENABLES 
*/
     mp->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
+
+    mp->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);
 }
 
 static void __init calculate_pv_max_policy(void)
@@ -67,6 +77,8 @@ static void __init calculate_pv_max_policy(void)
     struct msr_policy *mp = &pv_max_msr_policy;
 
     *mp = host_msr_policy;
+
+    mp->arch_caps.raw = 0; /* Not supported yet. */
 }
 
 static void __init calculate_pv_def_policy(void)
@@ -84,6 +96,8 @@ static void __init calculate_hvm_max_policy(void)
 
     /* It's always possible to emulate CPUID faulting for HVM guests */
     mp->platform_info.cpuid_faulting = true;
+
+    mp->arch_caps.raw = 0; /* Not supported yet. */
 }
 
 static void __init calculate_hvm_def_policy(void)
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.