Re: [PATCH v2 08/31] x86/virt/tdx: Configure TDX Module with optional TDX Connect feature

Xu Yilun
2026-04-08T07:34:02Z

On Wed, Apr 01, 2026 at 10:13:33AM +0000, Huang, Kai wrote:
>
> >
> > TDX Module updates global metadata when optional features are enabled.
> > Host should update the cached tdx_sysinfo to reflect these changes.
> >
> >
> [...]
>
> > static int config_tdx_module(struct tdmr_info_list *tdmr_list, u64 global_keyid)
> > {
> > struct tdx_module_args args = {};
> > + u64 seamcall_fn = TDH_SYS_CONFIG_V0;
> > u64 *tdmr_pa_array;
> > size_t array_sz;
> > int i, ret;
> > @@ -1377,7 +1378,15 @@ static int config_tdx_module(struct tdmr_info_list *tdmr_list, u64 global_keyid)
> > 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_TDXCONNECT) {
> > + args.r9 |= TDX_FEATURES0_TDXCONNECT;
> > + args.r11 = ktime_get_real_seconds();
> > + /* These parameters requires version >= 1 */
> > + seamcall_fn = TDH_SYS_CONFIG;
> > + }
> > +
> > + ret = seamcall_prerr(seamcall_fn, &args);
> >
> > /* Free the array as it is not required anymore. */
> > kfree(tdmr_pa_array);
> > @@ -1537,6 +1546,11 @@ static int init_tdx_module(void)
> > if (ret)
> > goto err_free_pamts;
> >
> > + /* configuration to tdx module may change tdx_sysinfo, update it */
> > + ret = get_tdx_sys_info(&tdx_sysinfo);
> > + if (ret)
> > + goto err_reset_pamts;
> > +
>
> How about put this into config_tdx_module()?
>
> In this way you can only update global metadata when there's new feature

mm.. personally I don't like such subtle control, especially when

- We expect one or more features are doomed to be enabled.
- We are pursuing simple TDX enabling process.
- This is still not the exact control. If we really want to be precise,
should check feature by feature, that's not worth it.

> being opted in, and at the meantime, avoid making init_tdx_module() more
> complicated.