On Fri, Aug 14, 2026 at 04:32:59PM +0800, Xiaoyao Li wrote:
> >     }                                                               \
> >   })
> > +#define __tdx_vcpu_ioctl(vcpu, cmd, _flags, arg)                   \
> > +({                                                                 \
> > +   union {                                                         \
> > +           struct kvm_tdx_cmd c;                                   \
> > +           unsigned long raw;                                      \
> > +   } tdx_cmd = { .c = {                                            \
> > +           .id = (cmd),                                            \
> > +           .flags = (u32)(_flags),                                 \
> > +           .data = (u64)(arg),                                     \
> > +   } };                                                            \
> > +                                                                   \
> > +   __vcpu_ioctl(vcpu, KVM_MEMORY_ENCRYPT_OP, &tdx_cmd.raw);        \
> > +})
> > +
> > +#define tdx_vcpu_ioctl(vcpu, cmd, flags, arg)                              
> > \
> > +({                                                                 \
> > +   int ret = __tdx_vcpu_ioctl(vcpu, cmd, flags, arg);              \
> > +   TEST_ASSERT(!ret, "%s failed, errno: %d (%s)",                  \
> > +                #cmd, errno, strerror(errno));                     \
> > +})
> 
> It doesn't handle the tdx_cmd.c.hw_error for vcpu ioctl, but handle it for
> vm ioctl, which looks inconsistent. This at least deserves a justification
> in the changelog.

Looks like this assymetry came from a v13 comment [1].

tdx_vcpu_ioctl() actually doesn't write back hw_error to userspace like
tdx_vm_ioctl() does, so hw_error is vCPU-scoped only right now. This is
a bit subtle so probably deserves to be called out.

[1] 
https://lore.kernel.org/all/[email protected]/

> 

Reply via email to