KVM: x86: Move APIC access page helper to common x86 code
authorSean Christopherson <seanjc@google.com>
Fri, 6 Jan 2023 01:12:42 +0000 (01:12 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 13 Jan 2023 15:45:25 +0000 (10:45 -0500)
commitc482f2cebe2d169c43c75ca769bdeba16fce6036
tree113483932becf2f518cb99f43990f67f69531ffe
parent1459f5c6b8b8dfbc16adf4844421d46459c9ab1f
KVM: x86: Move APIC access page helper to common x86 code

Move the APIC access page allocation helper function to common x86 code,
the allocation routine is virtually identical between APICv (VMX) and
AVIC (SVM).  Keep APICv's gfn_to_page() + put_page() sequence, which
verifies that a backing page can be allocated, i.e. that the system isn't
under heavy memory pressure.  Forcing the backing page to be populated
isn't strictly necessary, but skipping the effective prefetch only delays
the inevitable.

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230106011306.85230-10-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/svm/avic.c
arch/x86/kvm/vmx/vmx.c