Re: [PATCH v3 2/6] x86/virt/tdx: Configure add-on features on TDX module init
From: Kiryl Shutsemau
Date: Fri Oct 09 2026 - 09:16:36 EST
On Tue, Oct 06, 2026 at 01:41:46AM +0800, Xu Yilun wrote:
> The TDX architecture identifies some features that are off by default
> but can be enabled by the host during TDX module initialization. They
> are classified as add-on features because enabling them affects existing
> TDX systems: they may change existing feature behavior, or reserve more
> memory.
>
> The TDX module extends TDH.SYS.CONFIG with a new register argument to
> specify which add-on features to enable. This new argument is a bitmap
> that uses the same feature bits as TDX_FEATURES0. Note that Dynamic PAMT
> is an exception: although it is an add-on feature, it is controlled via
> a legacy, dedicated register argument [1].
>
> The kernel needs to enable these add-on features when it supports them.
> Add a get_tdx_usable_addon_features0() helper to return the bitmap of
> the add-on features that the module & kernel both support. Initially,
> this helper returns 0. It will be updated to return specific feature
> bits as full kernel support lands. Pass this bitmap as an argument to
> TDH.SYS.CONFIG.
>
> The TDX module requires SEAMCALL leaf version 1 for TDH.SYS.CONFIG when
> passing the new bitmap argument. A previous change [2] supports the
> versioned SEAMCALL leafs by adding a "version" field in
> struct tdx_module_args. Set the version field to 1 if the new bitmap
> argument is used to enable any add-on feature, otherwise keep the
> version as 0. This retains backward compatibility with older modules
> that don't recognize version 1.
>
> Signed-off-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> Reviewed-by: Tony Lindgren <tony.lindgren@xxxxxxxxxxxxxxx>
> Reviewed-by: Nikolay Borisov <nik.borisov@xxxxxxxx>
> Link: https://lore.kernel.org/all/20260904215841.303070-10-rick.p.edgecombe@xxxxxxxxx/ # [1]
> Link: https://lore.kernel.org/all/20260921-seamcall-version-v7-1-cf05fe76b467@xxxxxxxxxxxxxxx/ # [2]
Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
--
Kiryl Shutsemau / Kirill A. Shutemov