summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mtrr.c
diff options
context:
space:
mode:
authorXiao Guangrong <guangrong.xiao@linux.intel.com>2015-06-15 16:55:23 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2015-06-19 17:16:27 +0200
commiteb839917a75207b89799e3500211163cb6de0dea (patch)
tree6992e709b95ec5cbabc929d59e206020bc8c3234 /arch/x86/kvm/mtrr.c
parentff53604b40b439cbb235f89bda99839ca81d3b9d (diff)
downloadlinux-eb839917a75207b89799e3500211163cb6de0dea.tar.bz2
KVM: MTRR: handle MSR_MTRRcap in kvm_mtrr_get_msr
MSR_MTRRcap is a MTRR msr so move the handler to the common place, also add some comments to make the hard code more readable Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mtrr.c')
-rw-r--r--arch/x86/kvm/mtrr.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c
index fb2f7e10e8bc..a05846a524d9 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;