From: Kishen Maloor <kishen.maloor@intel.com>
To: Xu Yilun <yilun.xu@linux.intel.com>, <kas@kernel.org>,
<djbw@kernel.org>, <rick.p.edgecombe@intel.com>, <x86@kernel.org>,
<peter.fang@intel.com>
Cc: <linux-coco@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<kvm@vger.kernel.org>, <sohil.mehta@intel.com>,
<yilun.xu@intel.com>, <baolu.lu@linux.intel.com>,
<zhenzhong.duan@intel.com>, <xiaoyao.li@intel.com>
Subject: Re: [RFC PATCH 15/15] x86/virt/tdx: Enable TDX Quoting extension
Date: Sat, 6 Jun 2026 21:41:13 -0700 [thread overview]
Message-ID: <caf5de99-bce3-4dc6-8757-cf2b4aaf85c9@intel.com> (raw)
In-Reply-To: <20260522034128.3144354-16-yilun.xu@linux.intel.com>
On 5/21/26 8:41 PM, Xu Yilun wrote:
> From: Peter Fang <peter.fang@intel.com>
>
> Enable the TDX Quoting feature via TDH.SYS.CONFIG when supported by the
> TDX module.
>
> The TDX Quoting extension generates TDX attestation Quotes via a
> SEAMCALL, without using a discrete Quoting engine.
>
> TDX Module supports add-on TDX features (e.g. TDX Quoting & TDX Module
> Extensions) that should be manually enabled by host. It extends
> TDH.SYS.CONFIG for host to choose to enable them on bootup.
>
> Call TDH.SYS.CONFIG with a new bitmap input parameter to specify which
> features to enable. The bitmap uses the same definitions as
> TDX_FEATURES0. But note not all bits in TDX_FEATURES0 are valid for
> configuration, e.g. TDX Module Extensions is a service that supports TDX
> Quoting, it is implicitly enabled when TDX Quoting is enabled. Setting
> TDX_FEATURES0_EXT in the bitmap has no effect.
>
> TDX Module advances the version of TDH.SYS.CONFIG for the change, so
> use the latest version (v1) for add-on feature enabling. But supporting
> existing Modules which only support v0 is still necessary until they are
> deprecated. In fact, it is unlikely that TDH.SYS.CONFIG ever needs to
> change again and the code would stay in v1. So there is little value
> in worrying about deprecating v0 to save a couple lines of code in 5-7
> years when these original TDX platforms sunset.
>
> TDX Module updates global metadata when add-on features are enabled.
> Host should update the cached tdx_sysinfo to reflect these changes.
>
> Co-developed-by: Xu Yilun <yilun.xu@linux.intel.com>
> Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
> Signed-off-by: Peter Fang <peter.fang@intel.com>
> ---
> arch/x86/virt/vmx/tdx/tdx.h | 4 +++-
> arch/x86/virt/vmx/tdx/tdx.c | 24 ++++++++++++++++++++++--
> 2 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/virt/vmx/tdx/tdx.h b/arch/x86/virt/vmx/tdx/tdx.h
> index 10aff23cd01f..524a14c01aa6 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.h
> +++ b/arch/x86/virt/vmx/tdx/tdx.h
> @@ -58,7 +58,8 @@
> #define TDH_PHYMEM_CACHE_WB 40
> #define TDH_PHYMEM_PAGE_WBINVD 41
> #define TDH_VP_WR 43
> -#define TDH_SYS_CONFIG 45
> +#define TDH_SYS_CONFIG_V0 45
Is it necessary to add _Vx macros when multiple versions can co-exist?
Just wondering if it would be cleaner in the following way?
- Leave the macros set at the current (non-deprecated) baseline version.
- Select vX using SEAMCALL_LEAF_VER() in config_tdx_module() when a vX feature
is enabled.
u64 seamcall_fn = TDH_SYS_CONFIG;
...
if (tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE) {
...
seamcall_fn = SEAMCALL_LEAF_VER(TDH_SYS_CONFIG, 1);
> +#define TDH_SYS_CONFIG SEAMCALL_LEAF_VER(TDH_SYS_CONFIG_V0, 1)
> #define TDH_EXT_INIT 60
> #define TDH_EXT_MEM_ADD 61
> #define TDH_SYS_DISABLE 69
> @@ -97,6 +98,7 @@ struct tdmr_info {
> /* Bit definitions of TDX_FEATURES0 metadata field */
> #define TDX_FEATURES0_NO_RBP_MOD BIT(18)
> #define TDX_FEATURES0_EXT BIT_ULL(39)
> +#define TDX_FEATURES0_QUOTE BIT_ULL(50)
>
> /*
> * Do not put any hardware-defined TDX structure representations below
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index f7600f930c6e..86e5b7ad19b3 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1049,6 +1049,7 @@ static __init int construct_tdmrs(struct list_head *tmb_list,
> static __init int config_tdx_module(struct tdmr_info_list *tdmr_list,
> u64 global_keyid)
> {
> + u64 seamcall_fn = TDH_SYS_CONFIG_V0;
> struct tdx_module_args args = {};
> u64 *tdmr_pa_array;
> size_t array_sz;
> @@ -1074,8 +1075,22 @@ static __init int config_tdx_module(struct tdmr_info_list *tdmr_list,
> args.rcx = __pa(tdmr_pa_array);
> args.rdx = tdmr_list->nr_consumed_tdmrs;
> args.r8 = global_keyid;
> - ret = seamcall_prerr(TDH_SYS_CONFIG, &args);
>
> + if (tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE) {
> + args.r9 |= TDX_FEATURES0_QUOTE;
> + /* These parameters require version >= 1 */
> + seamcall_fn = TDH_SYS_CONFIG;
> + }
> +
> + ret = seamcall_prerr(seamcall_fn, &args);
> + if (ret)
> + goto free_tdmr;
> +
> + /* enabling TDX Quoting may change tdx_sysinfo, update it */
> + if (tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE)
> + ret = get_tdx_sys_info(&tdx_sysinfo);
> +
> +free_tdmr:
> /* Free the array as it is not required anymore. */
> kfree(tdmr_pa_array);
>
> @@ -1384,12 +1399,17 @@ static void tdx_quote_init(void)
> unsigned int nr_quote_pages;
> u64 r;
>
> + if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_QUOTE))
> + return;
> +
> do {
> r = seamcall(TDH_QUOTE_INIT, &args);
> } while (r == TDX_INTERRUPTED_RESUMABLE);
>
> - if (r)
> + if (r) {
> + pr_err("Failed to enable quoting extension: 0x%llx\n", r);
> return;
> + }
>
> /* Quoting metadata is valid only after initialization */
> if (get_tdx_sys_info_quote(&tdx_sysinfo.quote))
next prev parent reply other threads:[~2026-06-07 4:41 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 3:41 [PATCH 00/15] Enable TDX Module Extensions and DICE-based TDX Quoting Xu Yilun
2026-05-22 3:41 ` [PATCH 01/15] x86/virt/tdx: Read global metadata for TDX Module Extensions Xu Yilun
2026-05-25 6:24 ` Xiaoyao Li
2026-05-25 6:54 ` Xiaoyao Li
2026-05-27 15:35 ` Kiryl Shutsemau
2026-05-28 4:25 ` Xu Yilun
2026-05-28 21:17 ` Edgecombe, Rick P
2026-05-29 15:34 ` Xu Yilun
2026-05-27 6:05 ` Sohil Mehta
2026-05-27 7:11 ` Xu Yilun
2026-05-27 17:17 ` Sohil Mehta
2026-05-28 3:48 ` Xu Yilun
2026-05-28 21:00 ` Edgecombe, Rick P
2026-05-29 16:59 ` Xu Yilun
2026-06-09 13:06 ` Adrian Hunter
2026-06-10 3:20 ` Xu Yilun
2026-06-12 22:20 ` Dan Williams (nvidia)
2026-06-15 15:24 ` Xu Yilun
2026-06-15 16:05 ` Dave Hansen
2026-05-22 3:41 ` [PATCH 02/15] x86/virt/tdx: Add extra memory to TDX Module for Extensions Xu Yilun
2026-05-25 8:56 ` Xiaoyao Li
2026-05-27 3:47 ` Xu Yilun
2026-05-27 6:38 ` Xiaoyao Li
2026-05-27 7:32 ` Xu Yilun
2026-05-27 8:18 ` Xiaoyao Li
2026-06-07 4:38 ` Kishen Maloor
2026-06-08 9:41 ` Xu Yilun
2026-06-09 13:38 ` Adrian Hunter
2026-06-10 5:13 ` Xu Yilun
2026-06-10 5:43 ` Adrian Hunter
2026-06-10 7:44 ` Xu Yilun
2026-06-12 23:49 ` Dan Williams (nvidia)
2026-06-15 15:55 ` Xu Yilun
2026-05-22 3:41 ` [PATCH 03/15] x86/virt/tdx: Make TDX Module initialize Extensions Xu Yilun
2026-05-25 8:58 ` Xiaoyao Li
2026-06-05 8:46 ` Tony Lindgren
2026-06-09 15:14 ` Adrian Hunter
2026-06-10 8:09 ` Xu Yilun
2026-05-22 3:41 ` [PATCH 04/15] x86/virt/tdx: Enable the Extensions right after basic TDX Module init Xu Yilun
2026-05-25 6:00 ` Tony Lindgren
2026-05-27 4:02 ` Xu Yilun
2026-05-25 8:05 ` Xiaoyao Li
2026-05-28 21:32 ` Edgecombe, Rick P
2026-05-29 17:19 ` Xu Yilun
2026-06-07 4:38 ` Kishen Maloor
2026-06-08 10:12 ` Xu Yilun
2026-06-14 7:00 ` Peter Fang
2026-06-13 0:08 ` Dan Williams (nvidia)
2026-06-15 15:58 ` Xu Yilun
2026-05-22 3:41 ` [RFC PATCH 05/15] x86/virt/tdx: Move tdx_tdr_pa() up in the file Xu Yilun
2026-05-28 21:32 ` Edgecombe, Rick P
2026-06-11 16:21 ` Adrian Hunter
2026-06-14 7:04 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 06/15] x86/virt/tdx: Initialize Quoting extension during bringup Xu Yilun
2026-05-28 21:35 ` Edgecombe, Rick P
2026-06-14 7:10 ` Peter Fang
2026-06-11 16:22 ` Adrian Hunter
2026-06-14 7:20 ` Peter Fang
2026-06-13 0:00 ` Dan Williams (nvidia)
2026-06-14 7:50 ` Peter Fang
2026-06-29 18:11 ` Edgecombe, Rick P
2026-07-02 9:48 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 07/15] x86/virt/tdx: Prepare Quote buffer during extension bringup Xu Yilun
2026-05-28 22:30 ` Edgecombe, Rick P
2026-06-14 10:28 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 08/15] x86/virt/tdx: Add interface to check Quoting availability Xu Yilun
2026-07-01 11:25 ` Nikolay Borisov
2026-07-02 0:19 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 09/15] x86/virt/tdx: Add interface to generate a Quote Xu Yilun
2026-05-28 22:30 ` Edgecombe, Rick P
2026-06-14 11:29 ` Peter Fang
2026-06-26 9:58 ` Peter Fang
2026-06-11 17:15 ` Adrian Hunter
2026-06-14 11:36 ` Peter Fang
2026-07-01 11:46 ` Nikolay Borisov
2026-07-02 15:58 ` Xu Yilun
2026-07-07 3:45 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 10/15] x86/tdx: Move and rename Quote request structure Xu Yilun
2026-06-11 17:16 ` Adrian Hunter
2026-06-14 11:50 ` Peter Fang
2026-06-13 0:04 ` Dan Williams (nvidia)
2026-06-14 11:51 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 11/15] KVM: TDX: Factor out userspace return path from tdx_get_quote() Xu Yilun
2026-07-02 10:08 ` Nikolay Borisov
2026-07-07 5:01 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 12/15] KVM: TDX: Add in-kernel Quote generation Xu Yilun
2026-06-13 0:20 ` Dan Williams (nvidia)
2026-06-14 11:57 ` Peter Fang
2026-07-02 15:26 ` Nikolay Borisov
2026-07-07 5:04 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 13/15] KVM: TDX: Support event-notify interrupts only with userspace quoting Xu Yilun
2026-06-11 19:36 ` Adrian Hunter
2026-06-14 12:57 ` Peter Fang
2026-06-15 4:39 ` Adrian Hunter
2026-06-15 18:14 ` Peter Fang
2026-05-22 3:41 ` [RFC PATCH 14/15] x86/virt/tdx: Embed version info in SEAMCALL leaf function definitions Xu Yilun
2026-05-25 9:00 ` Xiaoyao Li
2026-05-27 6:45 ` Xu Yilun
2026-05-27 7:44 ` Xiaoyao Li
2026-05-27 11:45 ` Xu Yilun
2026-06-12 5:47 ` Adrian Hunter
2026-06-13 15:55 ` Xu Yilun
2026-05-22 3:41 ` [RFC PATCH 15/15] x86/virt/tdx: Enable TDX Quoting extension Xu Yilun
2026-05-25 5:17 ` Tony Lindgren
2026-05-25 10:51 ` Xiaoyao Li
2026-05-26 9:00 ` Tony Lindgren
2026-05-26 15:45 ` Xu Yilun
2026-05-27 1:30 ` Xiaoyao Li
2026-06-07 4:41 ` Kishen Maloor [this message]
2026-06-08 15:10 ` Xu Yilun
2026-07-03 7:57 ` Nikolay Borisov
2026-07-07 5:07 ` Peter Fang
2026-05-27 5:23 ` [PATCH 00/15] Enable TDX Module Extensions and DICE-based TDX Quoting Sohil Mehta
2026-05-27 10:38 ` Xu Yilun
2026-05-27 17:09 ` Sohil Mehta
2026-05-28 4:52 ` Xu Yilun
2026-05-28 19:50 ` Sohil Mehta
2026-06-01 9:36 ` Xu Yilun
2026-06-01 20:17 ` Sohil Mehta
2026-06-02 5:36 ` Xu Yilun
2026-06-07 4:36 ` Kishen Maloor
2026-06-08 6:54 ` Xu Yilun
2026-06-08 18:31 ` Adrian Hunter
2026-06-12 22:03 ` Dan Williams (nvidia)
2026-06-15 15:22 ` Xu Yilun
2026-06-15 15:57 ` Dave Hansen
2026-06-16 15:19 ` Xu Yilun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=caf5de99-bce3-4dc6-8757-cf2b4aaf85c9@intel.com \
--to=kishen.maloor@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=djbw@kernel.org \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.fang@intel.com \
--cc=rick.p.edgecombe@intel.com \
--cc=sohil.mehta@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=yilun.xu@intel.com \
--cc=yilun.xu@linux.intel.com \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox