Re: [PATCH v2 07/17] x86/virt/tdx: Initialize Quoting extension

From: Peter Fang

Date: Tue Jun 30 2026 - 01:20:58 EST


On Mon, Jun 29, 2026 at 04:33:25PM +0800, Chao Gao wrote:
> On Thu, Jun 18, 2026 at 04:13:45PM +0800, Xu Yilun wrote:
> >From: Peter Fang <peter.fang@xxxxxxxxx>
> >
> >Initialize the Quoting extension during TDX bringup, after enabling TDX
> >module Extension.
>
> This jumps into what the patch does without explaining what the Quoting
> extension is. A brief background would help reviewers who aren't familiar
> with it.

Yep, I'll add more background in the changelog.

>
> >diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> >index 4d2940f4538a..06c42b86b05e 100644
> >--- a/arch/x86/virt/vmx/tdx/tdx.c
> >+++ b/arch/x86/virt/vmx/tdx/tdx.c
> >@@ -1167,6 +1167,32 @@ static __init int init_tdmrs(struct tdmr_info_list *tdmr_list)
> > return 0;
> > }
> >
> >+/* Initialize quoting extension */
>
> This comment isn't quite helpful.

Got it. It makes more sense to add it in patch 12.

>
> >+static __init int tdx_quote_init(void)
> >+{
> >+ struct tdx_module_args args = {};
> >+ u64 r;
> >+
> >+ do {
> >+ r = seamcall(TDH_QUOTE_INIT, &args);
> >+ } while (r == TDX_INTERRUPTED_RESUMABLE);
> >+
> >+ if (r != TDX_SUCCESS)
> >+ return -EFAULT;
> >+
> >+ return 0;
> >+}
> >+
> >+static __init void init_tdx_quoting_extension(void)
> >+{
> >+ int ret;
> >+
> >+ if (tdx_addon_feature0 & TDX_FEATURES0_QUOTE) {
> >+ ret = tdx_quote_init();
> >+ WARN_ON_ONCE(ret);
> >+ }
>
> nit: Reduce indentation of the main body.
>
> if (!(tdx_addon_feature0 & TDX_FEATURES0_QUOTE))
> return;
>
> ret = tdx_quote_init();
> WARN_ON_ONCE(ret);

That's better. I'll make this change.

>
>
> Also, why two functions? Can we inline tdx_quote_init() here, or push the
> feature check into it.

tdx_quote_init() has a second call site in patch 12
(update_tdx_quoting_extension()), during runtime TDX module update.

Adding the "if (feature)" check inside a SEAMCALL helper doesn't seem
like a common pattern. I'm a bit concerned about making this look
inconsistent.

>