Re: [PATCH v5 08/12] x86/tdx: Add HLT support for TDX guest

Borislav Petkov
2021-09-01T07:41:31Z

On Tue, Aug 31, 2021 at 01:49:54PM -0700, Kuppuswamy, Sathyanarayanan wrote:
> Regarding details about _tdx_hypercall() wrapper usage, do you want me
> to document the ABI details?
>
> For example for MSR read,
>
> static u64 tdx_read_msr_safe(unsigned int msr, int *err)
> {
> struct tdx_hypercall_output out = {0};
> u64 ret;
>
> WARN_ON_ONCE(tdx_is_context_switched_msr(msr));
>
> /*
> * TDX MSR READ Hypercall ABI:
> *
> * Input Registers:
> *
> * R11(EXIT_REASON_MSR_READ) - hypercall sub function id
> * R12(msr) - MSR index
> *
> * Output Registers:
> *
> * R10(out.r10) - Hypercall return error code
> * R11(out.r11) - MSR read value
> * RAX(ret) - TDCALL error code
> */
> ret = _tdx_hypercall(EXIT_REASON_MSR_READ, msr, 0, 0, 0, &out);
>
> Let me know if you agree with above format?

Yes, that's nice, thanks.

Alternatively, you could simply point at the relevant place in the TDX
documentation so that people can go look at it and find out how, for
example, a MSR read is done, ABI-wise.

With all those confidential computing solutions and the amount of specs
out there, one can get lost pretty easily so having doc references
should be very helpful.

Thx.

--
Regards/Gruss,
Boris.