Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Jan Beulich <jbeul...@suse.com> CC: Roger Pau Monné <roger....@citrix.com> CC: Wei Liu <w...@xen.org> CC: Boris Ostrovsky <boris.ostrov...@oracle.com> CC: Ian Jackson <i...@xenproject.org>
For 4.15 This wants backporting to all security trees, as it is a fix to a regression introduced in XSA-351. Also it means that users don't need msr_relaxed=1 to unbreak Solaris guests, which is a strict useability improvement. --- xen/arch/x86/msr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 5927b6811b..a83a1d7fba 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -188,7 +188,6 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) case MSR_TSX_CTRL: case MSR_MCU_OPT_CTRL: case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7): - case MSR_RAPL_POWER_UNIT: case MSR_PKG_POWER_LIMIT ... MSR_PKG_POWER_INFO: case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO: case MSR_PP0_POWER_LIMIT ... MSR_PP0_POLICY: @@ -284,6 +283,18 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) goto gp_fault; break; + case MSR_RAPL_POWER_UNIT: + /* + * This MSR is non-architectural. However, some versions of Solaris + * blindly reads it without a #GP guard, and some versions of + * turbostat crash after expecting a read of /proc/cpu/0/msr not to + * fail. Read as zero on Intel hardware. + */ + if ( !(cp->x86_vendor & X86_VENDOR_INTEL) ) + goto gp_fault; + *val = 0; + break; + /* * These MSRs are not enumerated in CPUID. They have been around * since the Pentium 4, and implemented by other vendors. -- 2.11.0