aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-12-03 09:25:16 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:30:45 -0500
commit38e5e92fe8c02a8766459d505423b855caf9af1f (patch)
tree29a51a874acbbaa4b2938539a4753797bcfe3fdb /arch/x86/kvm
parentf40f6a459c2fefa77fd74eec28d6233c0a7f431a (diff)
KVM: SVM: Implement Flush-By-Asid feature
This patch adds the new flush-by-asid of upcoming AMD processors to the KVM-AMD module. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/svm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 7272b364580c..4dbc37204de1 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3158,7 +3158,6 @@ static void pre_svm_run(struct vcpu_svm *svm)
3158 3158
3159 struct svm_cpu_data *sd = per_cpu(svm_data, cpu); 3159 struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
3160 3160
3161 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
3162 /* FIXME: handle wraparound of asid_generation */ 3161 /* FIXME: handle wraparound of asid_generation */
3163 if (svm->asid_generation != sd->asid_generation) 3162 if (svm->asid_generation != sd->asid_generation)
3164 new_asid(svm, sd); 3163 new_asid(svm, sd);
@@ -3303,7 +3302,12 @@ static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
3303 3302
3304static void svm_flush_tlb(struct kvm_vcpu *vcpu) 3303static void svm_flush_tlb(struct kvm_vcpu *vcpu)
3305{ 3304{
3306 to_svm(vcpu)->asid_generation--; 3305 struct vcpu_svm *svm = to_svm(vcpu);
3306
3307 if (static_cpu_has(X86_FEATURE_FLUSHBYASID))
3308 svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID;
3309 else
3310 svm->asid_generation--;
3307} 3311}
3308 3312
3309static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu) 3313static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
@@ -3529,6 +3533,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
3529 3533
3530 svm->next_rip = 0; 3534 svm->next_rip = 0;
3531 3535
3536 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
3537
3532 /* if exit due to PF check for async PF */ 3538 /* if exit due to PF check for async PF */
3533 if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) 3539 if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR)
3534 svm->apf_reason = kvm_read_and_reset_pf_reason(); 3540 svm->apf_reason = kvm_read_and_reset_pf_reason();