Re: [PATCHv5 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, Jul 03, 2024 at 07:49:48AM -0700, Dave Hansen wrote:
> On 7/3/24 06:04, Kirill A. Shutemov wrote:
> >>> -/* TDCS fields. To be used by TDG.VM.WR and TDG.VM.RD module calls */
> >>> +/* TDX TD-Scope Metadata. To be used by TDG.VM.WR and TDG.VM.RD */
> >>> +#define TDCS_CONFIG_FLAGS		0x1110000300000016
> >> 0x9110000300000016
> >>> +#define TDCS_TD_CTLS			0x11104800000017
> >> 0x9110000300000017
> > Setting bit 63 in these field id is regression in new TDX spec and TDX
> > module. It is going to be fixed in next version. Both versions of field
> > ids are going to be valid.
> 
> I kinda never liked the big ol' magic numbers approach here.  But could
> we please introduce some helpers here?
> 
> Then we'll end up with something like this (if the 0x111 can't be
> decomposed):
> 
> #define _TDCS_CMD(c)	((0x1110UL << 48) | (c))
> 
> #define TDCS_CONFIG_FLAGS _TDCS_CMD(0x16)
> #define TDCS_TD_CTLS	  _TDCS_CMD(0x17)
> 
> Then when folks change their mind about what should be in the TDX spec,
> we have one place to go fix it up in addition to making this all more
> readable.

Hm. I am not sure about this. It can be tedious if we want to encode all
info this way. Like, size of the field, number of elements in the
field, number of elements in the sequence, etc. It is going to be macro on
the macro on the macro. I don't think it would improve readability.

On related note, I think the TDX 1.5 definitions of field ids are more
useful as you can infer more info from them. I consider to switching all
definitions to the new format. It effectively drops TDX 1.0 support as the
newly used bits are reserved in 1.0.

TDX module 1.0 is no longer supported, but kernel haven't broken anything
from the guest side yet. I don't think anybody actually uses it and I need
to jump hoops to get it running for validation.

Any objections for dropping TDX 1.0 support?

-- 
  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