[PATCH v1 1/8] x86/virt/tdx: Stop treating tdx_global_metadata.h as auto-generated
Chao Gao <[email protected]> Tue, 4 Aug 2026 04:29:29 -0700
| Newsgroups | org.kernel.vger.kvm,dev.linux.lists.linux-coco,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Dave Hansen <[email protected]> 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 (for example, struct tdx_sys_info_version/features). Those structures are populated by reading each field via the TDH.SYS.RD SEAMCALL. Today the header that holds these structures is generated by an out-of-tree script from a JSON file listing all of the TDX module's metadata. That made it trivial to add a new field, but everything else suffered for it: - The header is opaque to anyone who doesn't have the script and the JSON file handy, and the "Automatically generated" tag tells reviewers their edits will be clobbered. - The script ships outside the tree, so reproducing changes requires fetching it from a mailing list link. - The structures are short and stable; the script's value over a hand-edited header is small. In preparation for switching to a hand-maintained implementation, mark the header as such: - Drop the "Automatically generated" comment. - Rename the header guard to a non-"AUTO_GENERATED" name following the usual asm/ convention. - Add a comment describing what the structures are and how they are populated. No functional change intended. Assisted-by: Claude:claude-opus-5 Not-yet-signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Chao Gao <[email protected]> --- arch/x86/include/asm/tdx_global_metadata.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/tdx_global_metadata.h b/arch/x86/include/asm/tdx_global_metadata.h index 41150d546589..a86be9e5ec77 100644 --- a/arch/x86/include/asm/tdx_global_metadata.h +++ b/arch/x86/include/asm/tdx_global_metadata.h @@ -1,10 +1,15 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* Automatically generated TDX global metadata structures. */ -#ifndef _X86_VIRT_TDX_AUTO_GENERATED_TDX_GLOBAL_METADATA_H -#define _X86_VIRT_TDX_AUTO_GENERATED_TDX_GLOBAL_METADATA_H +#ifndef _ASM_X86_TDX_GLOBAL_METADATA_H +#define _ASM_X86_TDX_GLOBAL_METADATA_H #include <linux/types.h> +/* + * TDX module "Global Scope Metadata" as documented in the Intel TDX + * Module ABI spec. Each sub-structure below corresponds to one TDX + * metadata "Class"; its members are populated via TDH.SYS.RD SEAMCALLs. + */ + struct tdx_sys_info_version { u16 minor_version; u16 major_version; @@ -52,4 +57,4 @@ struct tdx_sys_info { struct tdx_sys_info_td_conf td_conf; }; -#endif +#endif /* _ASM_X86_TDX_GLOBAL_METADATA_H */ -- 2.52.0