Re: [PATCH v19 035/130] KVM: TDX: Add place holder for TDX VM specific mem_enc_op ioctl

From: Huang, Kai
Date: Sat Mar 23 2024 - 00:27:58 EST


>
> > > +
> > > + mutex_lock(&kvm->lock);
> > > +
> > > + switch (tdx_cmd.id) {
> > > + default:
> > > + r = -EINVAL;
> >
> > I am not sure whether you should return -ENOTTY to be consistent with the
> > previous vt_mem_enc_ioctl() where a TDX-specific IOCTL is issued for non-TDX
> > guest.
> >
> > Here I think the invalid @id means the sub-command isn't valid.
>
> vt_vcpu_mem_enc_ioctl() checks non-TDX case and returns -ENOTTY. We know that
> the guest is TD.

But the command is not supported, right?

I roughly recall I saw somewhere that in such case we should return -ENOTTY, but
I cannot find the link now.

But I found this old link uses -ENOTTY:

https://lwn.net/Articles/58719/

So, just fyi.