Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Gao, Chao" <chao.gao@intel.com>,
	"x86@kernel.org" <x86@kernel.org>
Cc: "kas@kernel.org" <kas@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [PATCH v1 0/8] TDX: Stop auto-generating the global metadata code
Date: Wed, 5 Aug 2026 17:19:59 +0000	[thread overview]
Message-ID: <bcbfffccd8f68c638511fcd12211a3501d744585.camel@intel.com> (raw)
In-Reply-To: <20260804112941.19894-1-chao.gao@intel.com>

On Tue, 2026-08-04 at 04:29 -0700, Chao Gao wrote:
> The TDX module exposes its capabilities and limits through "Global Scope
> Metadata" fields, defined in the Intel TDX Module ABI spec.  The kernel
> mirrors a small subset of those fields in C structures under struct
> tdx_sys_info, populated by reading each field via TDH.SYS.RD.
> 
> Both the structures and the code that fills them are nominally generated
> by an out-of-tree script from a JSON file describing the module's
> metadata.  That made it trivial to add a new field, but everything else
> suffered for it:
> 
>   - The generated files are edited by hand in practice, for different
>     reasons.  The VMXON rework added __init annotations to the readers,
>     and the handoff metadata is read at module shutdown into a
>     caller-local struct rather than into tdx_sys_info.  In-flight series
>     will add more: DPAMT and TDX module extension metadata may only be
>     read when the corresponding TDX_FEATURES0 bit is set.  Regenerating
>     the files would clobber all of these edits.
> 
>   - The generated code is opaque to anyone who doesn't have the script
>     and the JSON file handy.  Each field is identified by a bare 64-bit
>     hex literal, so verifying any one line means cross-referencing the
>     JSON file.
> 
>   - The script ships outside the tree, so reproducing changes requires
>     fetching it from a mailing list link.
> 
>   - The structures are short and stable, so the script's value over
>     hand-maintained code is small.
> 
> So switch to a hand-maintained implementation.  Name each field ID after
> the spec, then describe the field-ID-to-C-member mapping as a table: one
> row per field, pairing the named spec field ID with the C member that
> holds it.  Reading is then a walk over the table.

It might help to fill out this problem statement a bit more. The script is
already dead because of problems. But it came about due to other problems. And
we still have problems without the script.

Also, there were previous attempts at a macro based solution that failed to make
it upstream. It would be good to highlight how it avoids those problems.



      parent reply	other threads:[~2026-08-05 17:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 11:29 [PATCH v1 0/8] TDX: Stop auto-generating the global metadata code Chao Gao
2026-08-04 11:29 ` [PATCH v1 1/8] x86/virt/tdx: Stop treating tdx_global_metadata.h as auto-generated Chao Gao
2026-08-04 23:43   ` Dave Hansen
2026-08-05 12:06     ` Chao Gao
2026-08-05 15:26       ` Dave Hansen
2026-08-04 11:29 ` [PATCH v1 2/8] x86/virt/tdx: Name the TDX module global metadata field IDs Chao Gao
2026-08-04 23:52   ` Dave Hansen
2026-08-05 12:45     ` Chao Gao
2026-08-05 17:10   ` Edgecombe, Rick P
2026-08-04 11:29 ` [PATCH v1 3/8] x86/virt/tdx: Add a table-driven TDX global metadata reader Chao Gao
2026-08-05 17:48   ` Edgecombe, Rick P
2026-08-04 11:29 ` [PATCH v1 4/8] x86/virt/tdx: Convert version/tdmr/td_ctrl/handoff readers Chao Gao
2026-08-04 11:29 ` [PATCH v1 5/8] x86/virt/tdx: Convert td_conf reader Chao Gao
2026-08-04 11:29 ` [PATCH v1 6/8] x86/virt/tdx: Remove the auto-generated tdx_global_metadata.c Chao Gao
2026-08-04 11:29 ` [PATCH v1 7/8] x86/virt/tdx: Clean up error handling in get_tdx_sys_info() Chao Gao
2026-08-04 11:29 ` [PATCH v1 8/8] x86/virt/tdx: Verify the C member size against the metadata field ID Chao Gao
2026-08-04 23:38 ` [PATCH v1 0/8] TDX: Stop auto-generating the global metadata code Dave Hansen
2026-08-05 12:11   ` Chao Gao
2026-08-05 17:19 ` Edgecombe, Rick P [this message]

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=bcbfffccd8f68c638511fcd12211a3501d744585.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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