diff options
| author | Joerg Roedel <joerg.roedel@amd.com> | 2010-12-03 09:25:15 -0500 |
|---|---|---|
| committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:30:44 -0500 |
| commit | f40f6a459c2fefa77fd74eec28d6233c0a7f431a (patch) | |
| tree | c7e8e8e1c3b04b50014089efd07a03a36c3c82c2 | |
| parent | fa22a8d608a580264a99f0ddf4bb7fe65a9c2eb3 (diff) | |
KVM: SVM: Use svm_flush_tlb instead of force_new_asid
This patch replaces all calls to force_new_asid which are
intended to flush the guest-tlb by the more appropriate
function svm_flush_tlb. As a side-effect the force_new_asid
function is removed.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
| -rw-r--r-- | arch/x86/kvm/svm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 16a73c77b27e..7272b364580c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -421,11 +421,6 @@ static inline void invlpga(unsigned long addr, u32 asid) | |||
| 421 | asm volatile (__ex(SVM_INVLPGA) : : "a"(addr), "c"(asid)); | 421 | asm volatile (__ex(SVM_INVLPGA) : : "a"(addr), "c"(asid)); |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static inline void force_new_asid(struct kvm_vcpu *vcpu) | ||
| 425 | { | ||
| 426 | to_svm(vcpu)->asid_generation--; | ||
| 427 | } | ||
| 428 | |||
| 429 | static int get_npt_level(void) | 424 | static int get_npt_level(void) |
| 430 | { | 425 | { |
| 431 | #ifdef CONFIG_X86_64 | 426 | #ifdef CONFIG_X86_64 |
| @@ -999,7 +994,7 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
| 999 | save->cr3 = 0; | 994 | save->cr3 = 0; |
| 1000 | save->cr4 = 0; | 995 | save->cr4 = 0; |
| 1001 | } | 996 | } |
| 1002 | force_new_asid(&svm->vcpu); | 997 | svm->asid_generation = 0; |
| 1003 | 998 | ||
| 1004 | svm->nested.vmcb = 0; | 999 | svm->nested.vmcb = 0; |
| 1005 | svm->vcpu.arch.hflags = 0; | 1000 | svm->vcpu.arch.hflags = 0; |
| @@ -1419,7 +1414,7 @@ static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
| 1419 | unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4; | 1414 | unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4; |
| 1420 | 1415 | ||
| 1421 | if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE)) | 1416 | if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE)) |
| 1422 | force_new_asid(vcpu); | 1417 | svm_flush_tlb(vcpu); |
| 1423 | 1418 | ||
| 1424 | vcpu->arch.cr4 = cr4; | 1419 | vcpu->arch.cr4 = cr4; |
| 1425 | if (!npt_enabled) | 1420 | if (!npt_enabled) |
| @@ -1762,7 +1757,7 @@ static void nested_svm_set_tdp_cr3(struct kvm_vcpu *vcpu, | |||
| 1762 | 1757 | ||
| 1763 | svm->vmcb->control.nested_cr3 = root; | 1758 | svm->vmcb->control.nested_cr3 = root; |
| 1764 | mark_dirty(svm->vmcb, VMCB_NPT); | 1759 | mark_dirty(svm->vmcb, VMCB_NPT); |
| 1765 | force_new_asid(vcpu); | 1760 | svm_flush_tlb(vcpu); |
| 1766 | } | 1761 | } |
| 1767 | 1762 | ||
| 1768 | static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu, | 1763 | static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu, |
| @@ -2366,7 +2361,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) | |||
| 2366 | svm->nested.intercept_exceptions = nested_vmcb->control.intercept_exceptions; | 2361 | svm->nested.intercept_exceptions = nested_vmcb->control.intercept_exceptions; |
| 2367 | svm->nested.intercept = nested_vmcb->control.intercept; | 2362 | svm->nested.intercept = nested_vmcb->control.intercept; |
| 2368 | 2363 | ||
| 2369 | force_new_asid(&svm->vcpu); | 2364 | svm_flush_tlb(&svm->vcpu); |
| 2370 | svm->vmcb->control.int_ctl = nested_vmcb->control.int_ctl | V_INTR_MASKING_MASK; | 2365 | svm->vmcb->control.int_ctl = nested_vmcb->control.int_ctl | V_INTR_MASKING_MASK; |
| 2371 | if (nested_vmcb->control.int_ctl & V_INTR_MASKING_MASK) | 2366 | if (nested_vmcb->control.int_ctl & V_INTR_MASKING_MASK) |
| 2372 | svm->vcpu.arch.hflags |= HF_VINTR_MASK; | 2367 | svm->vcpu.arch.hflags |= HF_VINTR_MASK; |
| @@ -3308,7 +3303,7 @@ static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) | |||
| 3308 | 3303 | ||
| 3309 | static void svm_flush_tlb(struct kvm_vcpu *vcpu) | 3304 | static void svm_flush_tlb(struct kvm_vcpu *vcpu) |
| 3310 | { | 3305 | { |
| 3311 | force_new_asid(vcpu); | 3306 | to_svm(vcpu)->asid_generation--; |
| 3312 | } | 3307 | } |
| 3313 | 3308 | ||
| 3314 | static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu) | 3309 | static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu) |
| @@ -3562,7 +3557,7 @@ static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root) | |||
| 3562 | 3557 | ||
| 3563 | svm->vmcb->save.cr3 = root; | 3558 | svm->vmcb->save.cr3 = root; |
| 3564 | mark_dirty(svm->vmcb, VMCB_CR); | 3559 | mark_dirty(svm->vmcb, VMCB_CR); |
| 3565 | force_new_asid(vcpu); | 3560 | svm_flush_tlb(vcpu); |
| 3566 | } | 3561 | } |
| 3567 | 3562 | ||
| 3568 | static void set_tdp_cr3(struct kvm_vcpu *vcpu, unsigned long root) | 3563 | static void set_tdp_cr3(struct kvm_vcpu *vcpu, unsigned long root) |
| @@ -3576,7 +3571,7 @@ static void set_tdp_cr3(struct kvm_vcpu *vcpu, unsigned long root) | |||
| 3576 | svm->vmcb->save.cr3 = vcpu->arch.cr3; | 3571 | svm->vmcb->save.cr3 = vcpu->arch.cr3; |
| 3577 | mark_dirty(svm->vmcb, VMCB_CR); | 3572 | mark_dirty(svm->vmcb, VMCB_CR); |
| 3578 | 3573 | ||
| 3579 | force_new_asid(vcpu); | 3574 | svm_flush_tlb(vcpu); |
| 3580 | } | 3575 | } |
| 3581 | 3576 | ||
| 3582 | static int is_disabled(void) | 3577 | static int is_disabled(void) |
