Re: [RFC PATCH 01/15] x86/tdx: Export tdg_vm_rd() for tdx-guest module

From: Peter Fang

Date: Wed Sep 30 2026 - 18:14:05 EST


On Thu, Sep 24, 2026 at 12:10:18PM +0800, Zhenzhong Duan wrote:
> Export tdg_vm_rd() to allow the tdx-guest driver module to directly
> read TD-scoped metadata fields from the Trust Domain Control Structure
> (TDCS) via TDG.VM.RD TDCALL.
>
> Since tdg_vm_rd() is read-only and cannot cause harm, exporting it
> directly is simpler and more flexible. This allows the tdx-guest driver
> to read any TDCS field it needs.
>
> In a following patch, the tdx-guest driver will use tdg_vm_rd() to read
> TDCS_CONFIG_FLAGS field directly.

Can this be a separate helper? I'm adding another helper for
TDCS_QUOTE_MAX_SIZE [1]. I think maybe their patterns should stay consistent.

Yilun, any thoughts on this?

Thanks,
Peter

[1] https://lore.kernel.org/kvm/20260930103739.2851980-6-peter.fang@xxxxxxxxx/

>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx>