Re: [PATCH 14/25] KVM: TDX: initialize VM with TDX specific parameters

Tony Lindgren
2024-09-03T05:44:32Z

On Tue, Sep 03, 2024 at 10:58:11AM +0800, Chenyi Qiang wrote:
> On 8/13/2024 6:48 AM, Rick Edgecombe wrote:
> > From: Isaku Yamahata <isaku.yamahata@intel.com>
> > @@ -543,10 +664,23 @@ static int __tdx_td_init(struct kvm *kvm)
> > }
> > }
> >
> > - /*
> > - * Note, TDH_MNG_INIT cannot be invoked here. TDH_MNG_INIT requires a dedicated
> > - * ioctl() to define the configure CPUID values for the TD.
> > - */
> > + err = tdh_mng_init(kvm_tdx, __pa(td_params), &rcx);
> > + if ((err & TDX_SEAMCALL_STATUS_MASK) == TDX_OPERAND_INVALID) {
> > + /*
> > + * Because a user gives operands, don't warn.
> > + * Return a hint to the user because it's sometimes hard for the
> > + * user to figure out which operand is invalid. SEAMCALL status
> > + * code includes which operand caused invalid operand error.
> > + */
> > + *seamcall_err = err;
>
> I'm wondering if we could return or output more hint (i.e. the value of
> rcx) in the case of invalid operand. For example, if seamcall returns
> with INVALID_OPERAND_CPUID_CONFIG, rcx will contain the CPUID
> leaf/sub-leaf info.

Printing a decriptive error here would be nice when things go wrong.
Probably no need to return that information.

Sounds like you have a patch already in mind though :) Care to post a
patch against the current kvm-coco branch? If not, I can do it after all
the obvious comment changes are out of the way.

Regards,

Tony