KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection
authorSean Christopherson <sean.j.christopherson@intel.com>
Sat, 21 Mar 2020 20:26:00 +0000 (13:26 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 31 Mar 2020 14:48:08 +0000 (10:48 -0400)
commitafaf0b2f9b801c6eb2278b52d49e6a7d7b659cf1
tree5d2d8a4ba51297ef0c1a421327da285fb32d72d5
parent69c6f69aa3064ab6cc8426661f125ea75ffe899c
KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection

Replace the kvm_x86_ops pointer in common x86 with an instance of the
struct to save one pointer dereference when invoking functions.  Copy the
struct by value to set the ops during kvm_init().

Arbitrarily use kvm_x86_ops.hardware_enable to track whether or not the
ops have been initialized, i.e. a vendor KVM module has been loaded.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200321202603.19355-7-sean.j.christopherson@intel.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
15 files changed:
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/hyperv.c
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/lapic.c
arch/x86/kvm/mmu.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/pmu.c
arch/x86/kvm/pmu.h
arch/x86/kvm/svm.c
arch/x86/kvm/trace.h
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h