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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 15, 2024 at 04:14:18PM +0300, Nikolay Borisov wrote:
> 
> 
> On 15.05.24 г. 12:30 ч., Kirill A. Shutemov wrote:
> > 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.
> > 
> 
> But are those 2 wrappers really static-worthy? Those two interfaces seem to
> be rather generic and could be used by more things in the future? OTOH when
> the time comes they can be exposed as needed.

Generally, functions have to static unless they used outside of the
translation unit.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux