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

From: Kuppuswamy, Sathyanarayanan
Date: Tue Aug 31 2021 - 16:50:02 EST


Hi Boris,

On 8/24/21 10:27 AM, Borislav Petkov wrote:
I think in the next version all those _tdx_hypercall() wrappers should
spell it out what the parameters they pass are used for.

Hohumm.

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?

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer