Re: [PATCH v2 2/5] x86/virt/tdx: Configure add-on features on TDX module init
From: Nikolay Borisov
Date: Fri Sep 25 2026 - 10:14:04 EST
On 15.09.26 г. 13:26 ч., 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_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 extra bitmap to TDH.SYS.CONFIG wrapper.
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>
Link: https://lore.kernel.org/all/20260904215841.303070-10-rick.p.edgecombe@xxxxxxxxx/ # [1]
Link: https://lore.kernel.org/all/20260722084634.131020-1-yilun.xu@xxxxxxxxxxxxxxx/ # [2]
Reviewed-by: Nikolay Borisov <nik.borisov@xxxxxxxx>