summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/cpuid.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-12-22 15:20:00 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2015-12-22 15:29:00 +0100
commite24dea2afc6a0852983dc741072d8e96155e13f5 (patch)
tree80b972cf9cd865559d6b6aae01392bc5bc4321b3 /arch/x86/kvm/cpuid.h
parentfa7c4ebd5ae0c22f9908436303106a9ffcf0cf42 (diff)
downloadlinux-e24dea2afc6a0852983dc741072d8e96155e13f5.tar.bz2
KVM: MTRR: treat memory as writeback if MTRR is disabled in guest CPUID
Virtual machines can be run with CPUID such that there are no MTRRs. In that case, the firmware will never enable MTRRs and it is obviously undesirable to run the guest entirely with UC memory. Check out guest CPUID, and use WB memory if MTRR do not exist. Cc: qemu-stable@nongnu.org Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=107561 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.h')
-rw-r--r--arch/x86/kvm/cpuid.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 06332cb7e7d1..3f5c48ddba45 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -38,6 +38,14 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
return best && (best->ecx & bit(X86_FEATURE_XSAVE));
}
+static inline bool guest_cpuid_has_mtrr(struct kvm_vcpu *vcpu)
+{
+ struct kvm_cpuid_entry2 *best;
+
+ best = kvm_find_cpuid_entry(vcpu, 1, 0);
+ return best && (best->edx & bit(X86_FEATURE_MTRR));
+}
+
static inline bool guest_cpuid_has_tsc_adjust(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;