Re: [PATCH v5 2/6] x86/virt/tdx: Configure add-on features on TDX module init

From: Artem Bityutskiy

Date: Sat Nov 21 2026 - 22:50:56 EST


Hi Yilun,

The patch looks good, but its framing can be improved.

Remove references to enabling all add-ons to improve it. This patch adds
plumbing, it should not dictate/discuss whether all or only some add-ons
should be enabled. See comments below.

On Wed, 2026-11-11 at 11:48 +0800, Xu Yilun wrote:
> The TDX architecture identifies some features that are off by default.
> They are classified as add-on features because enabling them affects
> existing TDX systems: they may change existing feature behavior, or
> reserve more memory.
>
> However, the impact of the first add-on features will be low enough to
> pursue a simple approach - the kernel just enables them when supported.
> If a feature with a very high overhead appears in the future, this can
> be revisited.

This sounds like all supported add-ons will be enabled for simplicity.

The reviewer keeps this in mind now.

... snip ...

> Pass the bitmap of features that are supported by both kernel & TDX
> module to TDH.SYS.CONFIG. Initially, the bitmap is 0. It will be updated
> to contain specific feature bits as full kernel support lands.

But this says that it enables no add-ons. Now reviewer needs to spend
brain cycles to process the contradiction, unnecessarily.

... snip ...

> arch/x86/virt/vmx/tdx/tdx.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index c7bd0b01786d..3bfe78b4b538 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1033,9 +1033,19 @@ static __init int construct_tdmrs(struct list_head *tmb_list,
>
> #define TDX_SYS_CONFIG_DYNAMIC_PAMT BIT(16)
>
> +/* List all kernel-supported add-on features0 bits here */
> +#define TDX_KERNEL_SUPPORTED_ADDON_FEATURES0 (0)

Suggested comment:

/* Specify add-on feature bits to enable” instead */

I think that this patch should not dictate "all" vs "some", no need.

... snip ...

> + /*
> + * Use SEAMCALL version 1 that supports add-on features if any are
> + * requested. Otherwise use version 0 for backward compatibility.
> + */
> + if (addon_features0) {
> + args.r9 = addon_features0;
> + args.version = 1;
> + }

Separate nitpick for the comment.

Suggested comment:

/*
* Avoid unnecessarily requiring version 1 when no add-on features to
* request.
*/

I was confused by "for backward compatibility”, which sounds like the
kernel or the seamcall falls back to version 0 if version 1 is not
supported.

Thanks, Artem.