Re: [RFC PATCH 0/6] SEAMCALL Wrappers

Paolo Bonzini
2024-12-24T14:58:12Z

On Fri, Nov 15, 2024 at 9:20 PM Rick Edgecombe
<rick.p.edgecombe@intel.com> wrote:
> Separate from discussions with Dave on the SEAMCALLs, there was some some
> suggestions on how we might remove or combine specific SEAMCALLs. I didn’t
> try this here, because this RFC is more about exploring in general how we
> want to distribute things between KVM and arch/x86 for these SEAMCALL
> wrappers.
>
> So in summary the RFC only has:
> - Use structs to hold tdXYZ fields for TD and vCPUs
> - Make helper to hold CLFLUSH_BEFORE_ALLOC comments
> - Use semantic names for out args
> - (Add Kai's sign-off that should have been in the last version)
>
> Patches 1 and 3 contain new commit log verbiage justifying specific design
> choices behind the struct definitions.
>
> I didn’t create enums for the out args. Just using proper names for the
> args seemed like a good balance between code clarity and not
> over-engineering. But please correct if this was the wrong judgment.

Sounds good. I'll also convert

x86/virt/tdx: Add SEAMCALL wrapper tdh_mem_sept_add() to add SEPT pages
x86/virt/tdx: Add SEAMCALL wrappers to add TD private pages
x86/virt/tdx: Add SEAMCALL wrappers to manage TDX TLB tracking
x86/virt/tdx: Add SEAMCALL wrappers to remove a TD private page
x86/virt/tdx: Add SEAMCALL wrappers for TD measurement of initial contents
x86/virt/tdx: Add SEAMCALL wrapper to enter/exit TDX guest

(which I've "extracted" from the TDX-KVM series and placed all at the
top of kvm-coco-queue).

Paolo

> Here is a branch for seeing the callers. I didn’t squash the caller
> changes into the patches yet either, the caller changes are all just in the
> HEAD commit. I also only converted the “VM/vCPU creation” SEAMCALLs to the
> approach described above:
> https://github.com/intel/tdx/tree/seamcall-rfc
>
> [0] https://lore.kernel.org/kvm/20241030190039.77971-1-rick.p.edgecombe@intel.com/
>
>
> Rick Edgecombe (6):
> x86/virt/tdx: Add SEAMCALL wrappers for TDX KeyID management
> x86/virt/tdx: Add SEAMCALL wrappers for TDX TD creation
> x86/virt/tdx: Add SEAMCALL wrappers for TDX vCPU creation
> x86/virt/tdx: Add SEAMCALL wrappers for TDX page cache management
> x86/virt/tdx: Add SEAMCALL wrappers for TDX VM/vCPU field access
> x86/virt/tdx: Add SEAMCALL wrappers for TDX flush operations
>
> arch/x86/include/asm/tdx.h | 29 +++++
> arch/x86/virt/vmx/tdx/tdx.c | 224 ++++++++++++++++++++++++++++++++++++
> arch/x86/virt/vmx/tdx/tdx.h | 38 ++++--
> 3 files changed, 284 insertions(+), 7 deletions(-)
>
> --
> 2.47.0
>