On Wed, Jul 03, 2024 at 11:36:01PM +0000, Tim Merrifield wrote: > @@ -539,6 +547,24 @@ unsigned long vmware_tdx_hypercall(unsigned long cmd, > return args.r12; > } > EXPORT_SYMBOL_GPL(vmware_tdx_hypercall); > + > +static bool vmware_tdx_user_hcall(struct pt_regs *regs) > +{ > + struct tdx_module_args args; Zero the struct to not leak data to VMM. > + > + vmware_init_tdx_args(&args, true, regs->cx, regs->bx, > + regs->dx, regs->si, regs->di, regs->bp); > + __tdx_hypercall(&args); > + regs->ax = args.r12; > + regs->bx = args.rbx; > + regs->cx = args.r13; > + regs->dx = args.rdx; > + regs->si = args.rsi; > + regs->di = args.rdi; > + regs->bp = args.r14; > + > + return true; > +} > #endif > > #ifdef CONFIG_AMD_MEM_ENCRYPT > @@ -586,4 +612,7 @@ const __initconst struct hypervisor_x86 x86_hyper_vmware = { > .runtime.sev_es_hcall_prepare = vmware_sev_es_hcall_prepare, > .runtime.sev_es_hcall_finish = vmware_sev_es_hcall_finish, > #endif > +#ifdef CONFIG_INTEL_TDX_GUEST > + .runtime.tdx_hcall = vmware_tdx_user_hcall, > +#endif > }; > -- > 2.40.1 > -- Kiryl Shutsemau / Kirill A. Shutemov