aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorBoris Ostrovsky <boris.ostrovsky@amd.com>2012-01-09 14:00:35 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:21 -0500
commit2b036c6b861dc5da295c6fe19a3edcff7093fdeb (patch)
tree6c329a86190f3d071946864643fee0d851387985 /arch/x86/kvm/x86.c
parent4a58ae614a28b1ae3bea1c74a307cdfb7c77dab8 (diff)
KVM: SVM: Add support for AMD's OSVW feature in guests
In some cases guests should not provide workarounds for errata even when the physical processor is affected. For example, because of erratum 400 on family 10h processors a Linux guest will read an MSR (resulting in VMEXIT) before going to idle in order to avoid getting stuck in a non-C0 state. This is not necessary: HLT and IO instructions are intercepted and therefore there is no reason for erratum 400 workaround in the guest. This patch allows us to present a guest with certain errata as fixed, regardless of the state of actual hardware. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a3ce196d21fe..2bd77a3a41ed 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1675,6 +1675,16 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1675 */ 1675 */
1676 pr_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n", msr, data); 1676 pr_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n", msr, data);
1677 break; 1677 break;
1678 case MSR_AMD64_OSVW_ID_LENGTH:
1679 if (!guest_cpuid_has_osvw(vcpu))
1680 return 1;
1681 vcpu->arch.osvw.length = data;
1682 break;
1683 case MSR_AMD64_OSVW_STATUS:
1684 if (!guest_cpuid_has_osvw(vcpu))
1685 return 1;
1686 vcpu->arch.osvw.status = data;
1687 break;
1678 default: 1688 default:
1679 if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr)) 1689 if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr))
1680 return xen_hvm_config(vcpu, data); 1690 return xen_hvm_config(vcpu, data);
@@ -1959,6 +1969,16 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1959 */ 1969 */
1960 data = 0xbe702111; 1970 data = 0xbe702111;
1961 break; 1971 break;
1972 case MSR_AMD64_OSVW_ID_LENGTH:
1973 if (!guest_cpuid_has_osvw(vcpu))
1974 return 1;
1975 data = vcpu->arch.osvw.length;
1976 break;
1977 case MSR_AMD64_OSVW_STATUS:
1978 if (!guest_cpuid_has_osvw(vcpu))
1979 return 1;
1980 data = vcpu->arch.osvw.status;
1981 break;
1962 default: 1982 default:
1963 if (kvm_pmu_msr(vcpu, msr)) 1983 if (kvm_pmu_msr(vcpu, msr))
1964 return kvm_pmu_get_msr(vcpu, msr, pdata); 1984 return kvm_pmu_get_msr(vcpu, msr, pdata);