diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2018-03-20 12:17:18 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-03-23 18:30:44 +0100 |
commit | 434a1e94469d3b603f1efabfb044182de4cf88ef (patch) | |
tree | f456679a994f5798776e06a3c0788233e9408856 /arch/x86/kvm/svm.c | |
parent | 3184a995f782c6fdab89e62d31cf7be042582bd0 (diff) | |
download | linux-434a1e94469d3b603f1efabfb044182de4cf88ef.tar.gz linux-434a1e94469d3b603f1efabfb044182de4cf88ef.tar.xz |
KVM: x86: define SVM/VMX specific kvm_arch_[alloc|free]_vm
Define kvm_arch_[alloc|free]_vm in x86 as pass through functions
to new kvm_x86_ops vm_alloc and vm_free, and move the current
allocation logic as-is to SVM and VMX. Vendor specific alloc/free
functions set the stage for SVM/VMX wrappers of 'struct kvm',
which will allow us to move the growing number of SVM/VMX specific
member variables out of 'struct kvm_arch'.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 9729b7e59cc9..12b8e3867ce5 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1717,6 +1717,16 @@ static void __unregister_enc_region_locked(struct kvm *kvm, kfree(region); } +static struct kvm *svm_vm_alloc(void) +{ + return kzalloc(sizeof(struct kvm), GFP_KERNEL); +} + +static void svm_vm_free(struct kvm *kvm) +{ + kfree(kvm); +} + static void sev_vm_destroy(struct kvm *kvm) { struct kvm_sev_info *sev = &kvm->arch.sev_info; @@ -6881,6 +6891,8 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { .vcpu_free = svm_free_vcpu, .vcpu_reset = svm_vcpu_reset, + .vm_alloc = svm_vm_alloc, + .vm_free = svm_vm_free, .vm_init = avic_vm_init, .vm_destroy = svm_vm_destroy, |