Re: [PATCH v13 06/22] x86/virt/tdx: Add SEAMCALL error printing for module initialization

From: Huang, Kai
Date: Mon Sep 11 2023 - 18:09:45 EST


On Fri, 2023-09-08 at 09:31 -0700, Dave Hansen wrote:
> On 8/25/23 05:14, Kai Huang wrote:
> > +#define SEAMCALL_PRERR(__seamcall_func, __fn, __args, __seamcall_err_func) \
> > +({ \
> > + u64 ___sret = __SEAMCALL_PRERR(__seamcall_func, __fn, __args, \
> > + __seamcall_err_func, pr_err); \
> > + int ___ret; \
> > + \
> > + switch (___sret) { \
> > + case TDX_SUCCESS: \
> > + ___ret = 0; \
> > + break; \
> > + case TDX_SEAMCALL_VMFAILINVALID: \
> > + pr_err("SEAMCALL failed: TDX module not loaded.\n"); \
> > + ___ret = -ENODEV; \
> > + break; \
> > + case TDX_SEAMCALL_GP: \
> > + pr_err("SEAMCALL failed: TDX disabled by BIOS.\n"); \
> > + ___ret = -EOPNOTSUPP; \
> > + break; \
> > + case TDX_SEAMCALL_UD: \
> > + pr_err("SEAMCALL failed: CPU not in VMX operation.\n"); \
> > + ___ret = -EACCES; \
> > + break; \
> > + default: \
> > + ___ret = -EIO; \
> > + } \
> > + ___ret; \
> > +})
>
> I have no clue where all of this came from or why it is necessary or why
> it has to be macros. I'm just utterly confused.
>
> I was really hoping to be able to run through this set and get it ready
> to be merged. But it seems to still be seeing a *LOT* of change.
> Should I wait another few weeks for this to settle down again?

Those changes are due to SEAMCALL API change from the TDCALL/VMCALL/SEAMCALL
assembly change patchset. I'll work internally to make this stable asap (I
tried before but was suggested to sent out to community for feedback).

Also I would appreciate if you could take a look at patch 18/19 (which are
separated small patches for better review) and patch 20 (reset PAMT in kexec).

Thanks in advance!