Skip to content

Commit 2ca1a06

Browse files
Venkatesh Srinivasbonzini
authored andcommitted
kvm: Handle reads of SandyBridge RAPL PMU MSRs rather than injecting #GP
Linux 3.14 unconditionally reads the RAPL PMU MSRs on boot, without handling General Protection Faults on reading those MSRs. Rather than injecting a #GP, which prevents boot, handle the MSRs by returning 0 for their data. Zero was checked to be safe by code review of the RAPL PMU driver and in discussion with the original driver author ([email protected]). Signed-off-by: Venkatesh Srinivas <[email protected]> Signed-off-by: Jon Cargille <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 7289fdb commit 2ca1a06

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/x86/kvm/x86.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,6 +3060,17 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
30603060
case MSR_IA32_PERF_CTL:
30613061
case MSR_AMD64_DC_CFG:
30623062
case MSR_F15H_EX_CFG:
3063+
/*
3064+
* Intel Sandy Bridge CPUs must support the RAPL (running average power
3065+
* limit) MSRs. Just return 0, as we do not want to expose the host
3066+
* data here. Do not conditionalize this on CPUID, as KVM does not do
3067+
* so for existing CPU-specific MSRs.
3068+
*/
3069+
case MSR_RAPL_POWER_UNIT:
3070+
case MSR_PP0_ENERGY_STATUS: /* Power plane 0 (core) */
3071+
case MSR_PP1_ENERGY_STATUS: /* Power plane 1 (graphics uncore) */
3072+
case MSR_PKG_ENERGY_STATUS: /* Total package */
3073+
case MSR_DRAM_ENERGY_STATUS: /* DRAM controller */
30633074
msr_info->data = 0;
30643075
break;
30653076
case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:

0 commit comments

Comments
 (0)