@@ -24,12 +24,34 @@
#include <xen/sched.h>
#include <asm/msr.h>
-struct msr_domain_policy __read_mostly hvm_max_msr_domain_policy,
+struct msr_domain_policy __read_mostly raw_msr_domain_policy,
+ __read_mostly host_msr_domain_policy,
+ __read_mostly hvm_max_msr_domain_policy,
__read_mostly pv_max_msr_domain_policy;
struct msr_vcpu_policy __read_mostly hvm_max_msr_vcpu_policy,
__read_mostly pv_max_msr_vcpu_policy;
+static void __init calculate_raw_policy(void)
+{
+ struct msr_domain_policy *dp = &raw_msr_domain_policy;
+ uint64_t val;
+
+ if ( rdmsr_safe(MSR_INTEL_PLATFORM_INFO, val) == 0 )
+ {
+ dp->plaform_info.available = true;
+ if ( val & MSR_PLATFORM_INFO_CPUID_FAULTING )
+ dp->plaform_info.cpuid_faulting = true;
+ }
+}
+
+static void __init calculate_host_policy(void)
+{
+ struct msr_domain_policy *dp = &host_msr_domain_policy;
+
+ *dp = raw_msr_domain_policy;
+}
+
static void __init calculate_hvm_max_policy(void)
{
struct msr_domain_policy *dp = &hvm_max_msr_domain_policy;
@@ -67,6 +89,8 @@ static void __init calculate_pv_max_policy(void)
void __init init_guest_msr_policy(void)
{
+ calculate_raw_policy();
+ calculate_host_policy();
calculate_hvm_max_policy();
calculate_pv_max_policy();
}
Raw policy contains the actual values from H/W MSRs. PLATFORM_INFO msr needs to be read again because probe_intel_cpuid_faulting() records the presence of X86_FEATURE_CPUID_FAULTING but not the presence of msr itself (if cpuid faulting is not available). Host policy might have certain features disabled if Xen decides not to use them. For now, make Host policy equal to Raw policy. Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com> --- xen/arch/x86/msr.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)