Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

From: Sathyanarayanan Kuppuswamy
Date: Wed Oct 12 2022 - 09:36:09 EST




On 10/12/22 3:18 AM, Borislav Petkov wrote:
> On Wed, Sep 28, 2022 at 02:55:33PM -0700, Kuppuswamy Sathyanarayanan wrote:
>> To support TDX attestation, the TDX guest user interface driver must
>> use the __tdx module_call() function in the driver to allow the user to
>> obtain the TDREPORT.
>>
>> So export the __tdx_module_call() and move the TDX Module IDs to
>> asm/tdx.h.
>
> The functions with the __ prefix are usually lower-level interfaces
> which should be internal. Usually.
>
> Why aren't you exporting the tdx_module_call() one instead?

tdx_module_call() calls panic() on a non-zero error value. So it is only
used for cases where failure is fatal to the guest. But in the case of
TDG.MR.REPORT TDCALL, there are valid cases for failure (like invalid
param or busy condition) and the failure is non-fatal.

So we should create a new wrapper for this use case or use
__tdx_module_call() which is already exposed in asm/tdx.h.

>

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer