Re: [PATCH v12 013/106] KVM: TDX: create/destroy VM structure

From: Isaku Yamahata
Date: Wed Mar 01 2023 - 20:11:57 EST


On Wed, Mar 01, 2023 at 03:24:49PM +0800,
Chenyi Qiang <chenyi.qiang@xxxxxxxxx> wrote:

> > return -EINVAL;
> > }
> >
> > + max_pkgs = topology_max_packages();
> > + tdx_mng_key_config_lock = kcalloc(max_pkgs, sizeof(*tdx_mng_key_config_lock),
> > + GFP_KERNEL);
> > + if (!tdx_mng_key_config_lock)
> > + return -ENOMEM;
> > + for (i = 0; i < max_pkgs; i++)
> > + mutex_init(&tdx_mng_key_config_lock[i]);
> > +
> > /* TDX requires VMX. */
> > r = vmxon_all();
> > if (!r)
> > @@ -168,3 +600,9 @@ int __init tdx_hardware_setup(struct kvm_x86_ops *x86_ops)
> >
> > return r;
> > }
> > +
> > +void tdx_hardware_unsetup(void)
> > +{
>
> To align with tdx_hardware_setup(), add some check like:
>
> if (!enable_ept || !enable_tdx)
> return;
>

Oh yes, thanks for catching it.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>