Re: [PATCHv4 3/4] x86/tdx: Dynamically disable SEPT violations from causing #VEs

From: Kirill A. Shutemov
Date: Wed May 15 2024 - 05:31:10 EST


On Tue, May 14, 2024 at 05:56:21PM +0300, Nikolay Borisov wrote:
> > diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> > index 1ff571cb9177..ba37f4306f4e 100644
> > --- a/arch/x86/coco/tdx/tdx.c
> > +++ b/arch/x86/coco/tdx/tdx.c
> > @@ -77,6 +77,20 @@ static inline void tdcall(u64 fn, struct tdx_module_args *args)
> > panic("TDCALL %lld failed (Buggy TDX module!)\n", fn);
> > }
> > +/* Read TD-scoped metadata */
> > +static inline u64 tdg_vm_rd(u64 field, u64 *value)
> > +{
> > + struct tdx_module_args args = {
> > + .rdx = field,
> > + };
> > + u64 ret;
> > +
> > + ret = __tdcall_ret(TDG_VM_RD, &args);
> > + *value = args.r8;
> > +
> > + return ret;
> > +}
>
> nit: Perhaps this function can be put in the first patch and the description
> there be made more generic, something along the lines of "introduce
> functions for tdg_rd/tdg_wr" ?

A static function without an user will generate a build warning. I don't
think it is good idea.

--
Kiryl Shutsemau / Kirill A. Shutemov