diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-03-05 00:39:29 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-03-05 00:39:29 +0100 |
commit | 0564eeb71bbb0e1a566fb701f90155bef9e7a224 (patch) | |
tree | 2935323651d0f8ab2acb5f96f6ee6c722a9cad5a /arch/x86/kvm/mmu | |
parent | KVM: SVM: Disable preemption across AVIC load/put during APICv refresh (diff) | |
parent | KVM: x86: pull kvm->srcu read-side to kvm_arch_vcpu_ioctl_run (diff) | |
download | linux-0564eeb71bbb0e1a566fb701f90155bef9e7a224.tar.xz linux-0564eeb71bbb0e1a566fb701f90155bef9e7a224.zip |
Merge branch 'kvm-bugfixes' into HEAD
Merge bugfixes from 5.17 before merging more tricky work.
Diffstat (limited to 'arch/x86/kvm/mmu')
-rw-r--r-- | arch/x86/kvm/mmu/mmu.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 3e7c8ad5bed9..1a4760873652 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3539,7 +3539,7 @@ set_root_pgd: out_unlock: write_unlock(&vcpu->kvm->mmu_lock); - return 0; + return r; } static int mmu_alloc_special_roots(struct kvm_vcpu *vcpu) @@ -3865,12 +3865,23 @@ static void shadow_page_table_clear_flood(struct kvm_vcpu *vcpu, gva_t addr) walk_shadow_page_lockless_end(vcpu); } +static u32 alloc_apf_token(struct kvm_vcpu *vcpu) +{ + /* make sure the token value is not 0 */ + u32 id = vcpu->arch.apf.id; + + if (id << 12 == 0) + vcpu->arch.apf.id = 1; + + return (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; +} + static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, gfn_t gfn) { struct kvm_arch_async_pf arch; - arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; + arch.token = alloc_apf_token(vcpu); arch.gfn = gfn; arch.direct_map = vcpu->arch.mmu->direct_map; arch.cr3 = vcpu->arch.mmu->get_guest_pgd(vcpu); |