From: Edwin Török <edvin.to...@citrix.com> Expose MSR_TURBO_RATIO_LIMIT{,1,2} and MSR_TEMPERATURE_TARGET to guest as RO. Although these are not architectural MSRs they are in the same place currently on all supported CPUs. They also have the same meaning, except for 06_55H and 06_5C where they have a different meaning (turbo core count).
It is safe to expose this to the guest by default: they are only statically defined limits and don't expose runtime measurements. It has been observed that some drivers BSOD on an unguarded read on MSR 1ADH (e.g. socwatch). Also we read as zero the actual temperature, so reporting the temp target as 0 might lead to 0/0. Backport: 4.15+ Signed-off-by: Edwin Török <edvin.to...@citrix.com> --- xen/arch/x86/hvm/vmx/vmx.c | 9 +++++++++ xen/arch/x86/pv/emul-priv-op.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index fefd01be40..cd772585fe 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3353,6 +3353,15 @@ static int cf_check vmx_msr_read_intercept( if ( !nvmx_msr_read_intercept(msr, msr_content) ) goto gp_fault; break; + + case MSR_TEMPERATURE_TARGET: + case MSR_TURBO_RATIO_LIMIT...MSR_TURBO_RATIO_LIMIT2: + if ( !rdmsr_safe(msr, *msr_content) ) + break; + /* RO for guests, MSR_PLATFORM_INFO bits set accordingly in msr.c to indicate lack of write + * support. */ + goto gp_fault; + case MSR_IA32_MISC_ENABLE: rdmsrl(MSR_IA32_MISC_ENABLE, *msr_content); /* Debug Trace Store is not supported. */ diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index e623e57b55..09bfde1060 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -960,6 +960,10 @@ static int cf_check read_msr( *val = guest_misc_enable(*val); return X86EMUL_OKAY; + case MSR_TEMPERATURE_TARGET: + case MSR_TURBO_RATIO_LIMIT...MSR_TURBO_RATIO_LIMIT2: + goto normal; + case MSR_P6_PERFCTR(0) ... MSR_P6_PERFCTR_LAST: case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL_LAST: case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTRn: -- 2.41.0