On Tue, May 23, 2023 at 10:23:57AM +0800, "Wen, Qian" <qian.wen@xxxxxxxxx> wrote: > > diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c > > index a59559ff140e..3f49e8e38b6b 100644 > > --- a/arch/x86/kvm/vmx/main.c > > +++ b/arch/x86/kvm/vmx/main.c > > @@ -165,3 +165,54 @@ struct kvm_x86_init_ops vt_init_ops __initdata = { > > .runtime_ops = &vt_x86_ops, > > .pmu_ops = &intel_pmu_ops, > > }; > > + > > +static int __init vt_init(void) > > +{ > > + unsigned int vcpu_size, vcpu_align; > > + int r; > > + > > + if (!kvm_is_vmx_supported()) > > + return -EOPNOTSUPP; > > + > > + /* > > + * Note, hv_init_evmcs() touches only VMX knobs, i.e. there's nothing > > + * to unwind if a later step fails. > > + */ > > + hv_init_evmcs(); > > + > > + r = kvm_x86_vendor_init(&vt_init_ops); > > + if (r) > > + return r; > > + > > + r = vmx_init(); > > + if (r) > > + goto err_vmx_init; > > + > > + /* > > + * Common KVM initialization _must_ come last, after this, /dev/kvm is > > + * exposed to userspace! > > + */ > > + vt_x86_ops.vm_size = sizeof(struct kvm_vmx); > > nit: why initialize vm_size again? I noticed that it has already been assigned a value when create vt_x86_ops. Thanks, will remove the line. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>