Re: [PATCHv2 20/29] x86/tdx: Get page shared bit info from the TDX module

Sean Christopherson
2022-02-07T22:27:28Z

On Wed, Feb 02, 2022, Thomas Gleixner wrote:
> On Mon, Jan 24 2022 at 18:02, Kirill A. Shutemov wrote:
> > +static void tdx_get_info(void)
> > +{
> > + struct tdx_module_output out;
> > + u64 ret;
> > +
> > + /*
> > + * TDINFO TDX module call is used to get the TD execution environment
> > + * information like GPA width, number of available vcpus, debug mode
> > + * information, etc. More details about the ABI can be found in TDX
> > + * Guest-Host-Communication Interface (GHCI), sec 2.4.2 TDCALL
> > + * [TDG.VP.INFO].
> > + */
> > + ret = __tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out);
> > +
> > + /* Non zero return value indicates buggy TDX module, so panic */
>
> Can you please get rid of these useless comments all over the place. The
> panic() message tells the same story. Please document the non-obvious
> things.

And why isn't there a tdx_module_call() wrapper to panic() on failure? IIRC,
that's why the asm routines had the double underscore, but that detail appears
to have been lost. E.g. __tdx_module_call(TDX_GET_VEINFO, ...) in patch 04 should
also panic, but it currently morphs the #VE into a #GP if it can't retrieve the
info, which will lead to weird "#GPs" on things like vanilla MOV instructions if
something does go wrong. TDX_ACCEPT_PAGE is the only call into the TDX Module
for which failure is not fatal.