diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index fb2f7e10e8bc5f943417a779c967649ea0dbd7b3..a05846a524d936430f63e16f3c90a677770a2f96 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c @@ -199,6 +199,18 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) { u64 *p = (u64 *)&vcpu->arch.mtrr_state.fixed_ranges; + /* MSR_MTRRcap is a readonly MSR. */ + if (msr == MSR_MTRRcap) { + /* + * SMRR = 0 + * WC = 1 + * FIX = 1 + * VCNT = KVM_NR_VAR_MTRR + */ + *pdata = 0x500 | KVM_NR_VAR_MTRR; + return 0; + } + if (!msr_mtrr_valid(msr)) return 1; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index e2bc79821b45a9d6c2757255b40f7cdf9d68e991..fb6c9a11b5c1845f1ab238c705982e01a5c7fcee 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2443,8 +2443,6 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) msr_info->data = 0x100000000ULL; break; case MSR_MTRRcap: - msr_info->data = 0x500 | KVM_NR_VAR_MTRR; - break; case 0x200 ... 0x2ff: return kvm_mtrr_get_msr(vcpu, msr_info->index, &msr_info->data); case 0xcd: /* fsb frequency */