RE: [RFC v2-fix-v2 1/1] x86/tdx: Add __tdx_module_call() and __tdx_hypercall() helper functions
From: Luck, Tony
Date: Thu May 27 2021 - 12:25:48 EST
>> Looking at the code, the hypercall can return an error if TDCALL fails,
>> but module_call forces a panic with UD2 on error. This difference isn't
>> explained anywhere.
>
> I think you meant hypercall will panic vs module call will not.
yes
> In hypercall case, since we use same TDCALL instruction, we will have two
> return values. One is for TDCALL failure (at the TDX module level) and
> other is return value from VMM. So in hypercall case, we return VMM value
> to the user but panic for TDCALL failures. As per TDX spec, for hypercall
> use case, if everything is in order, TDCALL will never fail. If we notice
> TDCALL failure error then it means, we are working with the broken TDX module.
> So we panic.
Add a comment in the .S file right before that ud2 explaining this. That
should help anyone tracking down that panic understand that the problem
is in the TDX module.
Otherwise looks ok.
Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx>
-Tony