Re: [PATCH 5/6] x86/hyperv: Support hypercalls for TDX guests

From: Dave Hansen
Date: Mon Nov 28 2022 - 14:11:16 EST


On 11/28/22 11:03, Dexuan Cui wrote:
...
> u64 hv_tdx_hypercall(u64 control, u64 param1, u64 param2)
> {
> struct tdx_hypercall_args args = { };
>
> if (!(control & HV_HYPERCALL_FAST_BIT)) {
> if (param1)
> param1 = cc_mkdec(param1);
>
> if (param2)
> param2 = cc_mkdec(param2);
> }
>
> args.r10 = control;
> args.rdx = param1;
> args.r8 = param2;
>
> (void)__tdx_hypercall(&args, TDX_HCALL_HAS_OUTPUT);
>
> return args.r11;
> }

I still think this is problematic.

The cc_mkdec() should be done on the parameters when the code still
*knows* that they are addresses.

How do we know, for instance, that no hypercall using this interface
will *ever* take the 0x0 physical address as an argument?