lkml.org 
[lkml]   [2022]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/3] x86/tdx: Add TDX Guest attestation interface driver
From
Date
On Tue, 2022-04-26 at 22:45 -0700, Isaku Yamahata wrote:
> > + */
> > +long tdx_mcall_tdreport(void *data, void *reportdata)
> > +{
> > + u64 ret;
> > +
> > + /*
> > + * Check for a valid TDX guest to ensure this API is only
> > + * used by TDX guest platform. Also make sure "data" and
> > + * "reportdata" pointers are valid.
> > + */
> > + if (!data || !reportdata ||
> > !cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
> > + return -EINVAL;
> > +
> > + /*
> > + * Pass the physical address of user generated report data
> > + * and the physical address of output buffer to the TDX module
> > + * to generate the TD report. Generated data contains
> > + * measurements/configuration data of the TD guest. More info
> > + * about ABI can be found in TDX 1.0 Module specification, sec
> > + * titled "TDG.MR.REPORT".
> > + */
> > + ret = __tdx_module_call(TDX_GET_REPORT, virt_to_phys(data),
> > + virt_to_phys(reportdata), 0, 0, NULL);
> > +
> > + if (ret)
> > + return TDCALL_RETURN_CODE(ret);
>
> Why is status code masked?
>
>
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(tdx_mcall_tdreport);
>
> Can this function be put into attest.c. Instead, wecan export
> __tdx_module_call.

As we discussed, there's no need to export this anymore.

Btw, I even think we can move this function to attest.c so it can be static.
Theoretically there should be no other caller of this except attest.c. I
understand in this way we need to define TDX_GET_REPORT macro in attest.c but
this looks fine to me. This function can even be removed, and we can call
__tdx_module_call() directly in attest.c. This function literally doesn't do
anything meaningful more than __tdx_module_call(), instead, calling
__tdx_module_call() directly gives us more context, i.e., we can easily see the
buffer is allocated by kernel and passed to TDX module, etc.

--
Thanks,
-Kai


\
 
 \ /
  Last update: 2022-04-27 07:58    [W:0.139 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site