Re: [PATCH v7 05/20] x86/virt/tdx: Implement functions to make SEAMCALL

From: Huang, Kai
Date: Wed Nov 23 2022 - 03:53:46 EST


On Tue, 2022-11-22 at 10:06 +0100, Peter Zijlstra wrote:
> On Mon, Nov 21, 2022 at 01:26:27PM +1300, Kai Huang wrote:
> > +/*
> > + * Wrapper of __seamcall() to convert SEAMCALL leaf function error code
> > + * to kernel error code. @seamcall_ret and @out contain the SEAMCALL
> > + * leaf function return code and the additional output respectively if
> > + * not NULL.
> > + */
> > +static int __always_unused seamcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9,
> > + u64 *seamcall_ret,
> > + struct tdx_module_output *out)
> > +{
>
> What's the point of a 'static __always_unused' function again? Other
> than to test the DCE pass of a linker, that is?
>

It is used to avoid the compile warning as so far with this patch it doesn't
have any caller. Without the __always_unused, the compiler will complain.

Originally it was in the patch "Shut down TDX module in case of error" where it
was firstly called. Dave suggested to move it out:

https://lore.kernel.org/all/6ed2746d-f44c-4511-7373-5706dd7c3f0f@xxxxxxxxx/