diff options
author | Julian Stecklina <jsteckli@os.inf.tu-dresden.de> | 2012-12-05 09:26:19 -0500 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2012-12-05 11:00:07 -0500 |
commit | 66f7b72e117180d0007e7a65b8dc5bd1c8126e3b (patch) | |
tree | 215798d481c12903a48136631ab6978be440ed99 /arch/x86/kvm/x86.c | |
parent | 2b3c5cbc0d814437fe4d70cc11ed60550b95b29f (diff) |
KVM: x86: Make register state after reset conform to specification
VMX behaves now as SVM wrt to FPU initialization. Code has been moved to
generic code path. General-purpose registers are now cleared on reset and
INIT. SVM code properly initializes EDX.
Signed-off-by: Julian Stecklina <jsteckli@os.inf.tu-dresden.de>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3bdaf298b8c7..57c76e86e9bd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6461,6 +6461,10 @@ static int kvm_vcpu_reset(struct kvm_vcpu *vcpu) | |||
6461 | 6461 | ||
6462 | kvm_pmu_reset(vcpu); | 6462 | kvm_pmu_reset(vcpu); |
6463 | 6463 | ||
6464 | memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); | ||
6465 | vcpu->arch.regs_avail = ~0; | ||
6466 | vcpu->arch.regs_dirty = ~0; | ||
6467 | |||
6464 | return kvm_x86_ops->vcpu_reset(vcpu); | 6468 | return kvm_x86_ops->vcpu_reset(vcpu); |
6465 | } | 6469 | } |
6466 | 6470 | ||
@@ -6629,11 +6633,17 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
6629 | if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) | 6633 | if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) |
6630 | goto fail_free_mce_banks; | 6634 | goto fail_free_mce_banks; |
6631 | 6635 | ||
6636 | r = fx_init(vcpu); | ||
6637 | if (r) | ||
6638 | goto fail_free_wbinvd_dirty_mask; | ||
6639 | |||
6632 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; | 6640 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; |
6633 | kvm_async_pf_hash_reset(vcpu); | 6641 | kvm_async_pf_hash_reset(vcpu); |
6634 | kvm_pmu_init(vcpu); | 6642 | kvm_pmu_init(vcpu); |
6635 | 6643 | ||
6636 | return 0; | 6644 | return 0; |
6645 | fail_free_wbinvd_dirty_mask: | ||
6646 | free_cpumask_var(vcpu->arch.wbinvd_dirty_mask); | ||
6637 | fail_free_mce_banks: | 6647 | fail_free_mce_banks: |
6638 | kfree(vcpu->arch.mce_banks); | 6648 | kfree(vcpu->arch.mce_banks); |
6639 | fail_free_lapic: | 6649 | fail_free_lapic: |