Re: [PATCH v4 04/16] x86/virt/tdx: Allocate page bitmap for Dynamic PAMT

From: Xu Yilun
Date: Thu Jan 08 2026 - 08:21:56 EST


On Wed, Jan 07, 2026 at 02:41:44PM +0000, Edgecombe, Rick P wrote:
> On Wed, 2026-01-07 at 14:01 +0800, Xu Yilun wrote:
> > > I do think this is a good area for cleanup, but let's not overhaul
> > > it
> > > just to get a small incremental benefit. If we need a new interface
> > > in
> >
> > Agree. I definitely don't want a new TDX module interface for now.
>
> No, I was suggesting to think about a new TDX module interface if that
> is what it takes to really simplify it. For example, something like a
> consistent TDH.SYS.RDALL. For TDX module changes to be available in the

I actually don't understand why a RDALL seamcall could eliminate
the check "if (some_optional_feature_exists) read_it;". IIUC, The check
exists because kernel doesn't trust TDX Module so kernel wants to verify
the correctness/consistency of the data, otherwise we could accept
whatever TDX Module tells us, do the below for each field:

static int read_sys_metadata_field(u64 field_id, u64 *data)
{
...
ret = seamcall(TDH_SYS_RD, &args);
if (ret == TDX_SUCCESS) {
*data = args.r8;
return 0;
}

/* The field doesn't exist */
if (ret == TDX_METADATA_FIELD_ID_INCORRECT) {
*data = 0;
return 0;
}

...

/* Real reading error */
return -EFAULT;
}

The trustness doesn't change no matter how kernel retrieves these data,
by a series of RD or a RDALL.

Thanks,
Yilun

> future (for example at the time of the other optional metadata), we
> actually need to start the process now.