From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C370533688C; Tue, 4 Aug 2026 11:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785843070; cv=none; b=VVN8NZAxmkIqP4p7Z1GaqMGv1Hj5h0SyYkw5jJZVjIdWwx8X/YSillW4fM1dtdR8Xlz/FfEe6+4wQllz7ZVPSGmaHB8TzloTmMN9ozlsvNADNtizTATCzPRENrBFndE6ERC39wTS3lIRctt02NAN8aHCjeAaSnDWUgdE5bjjD50= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785843070; c=relaxed/simple; bh=dheLYLhH3hHWdM96NiJlrPMtGHu2WUhpgs2LPgQ1WE0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UwhHvjlRIif3w/9P/cQJzArAYNIKjqiIil7ZYMLoX0xiGorwz7ncKOKQMizL1HSSXpGtO2Beedjkn4V+5HgdNOXY1pYg8iC27wV/CAVwKucFL+meg/HEXPFUyYE9sTneAFQi00YyfMLordAzT7RxI8ylpqNKKCz8Ft70TU+hxBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Eu7TjxUh; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Eu7TjxUh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785843068; x=1817379068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dheLYLhH3hHWdM96NiJlrPMtGHu2WUhpgs2LPgQ1WE0=; b=Eu7TjxUhmi5KldvR702PkjTbCyp2flz4WMC3twWyecRyVFj8e42o6mo1 s8VTu948lwbiOBd8nL53WBy6q96hfkxNh1xI02NvYBbV6x6FOciueuDJy N9jIHaC92gNg7CVFaIOpHpkewxSJ/1gn6zUHyPvxwKBfcZObcffvmshrB nfFyyvh7JrJhHgn8snxGTozlpx0Qp+bMNahDLcFU43zct0ewiPJgi50F5 gtKncrKbwWdzcWBH4qbUpKUdflZzMfSMSq36ijcJcGqOHITehye7wokRF znFSW2457z2ha4kG28tCfiXkNJzYZ9m6KxTG0zJA7SbjKzOCKK+Nf1XBG Q==; X-CSE-ConnectionGUID: ixIjzXnWSPyXeMn7oKefmw== X-CSE-MsgGUID: JWHRYL0yRi2z/CaYp7IXrw== X-IronPort-AV: E=McAfee;i="6800,10657,11864"; a="86244233" X-IronPort-AV: E=Sophos;i="6.25,204,1779174000"; d="scan'208";a="86244233" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 04:31:07 -0700 X-CSE-ConnectionGUID: VtMtWNSoR0OCx1PrxWSjzw== X-CSE-MsgGUID: QqXI0nRhRu+sjW6NjxJUdA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,204,1779174000"; d="scan'208";a="265323095" Received: from jf.jf.intel.com (HELO 984fee019967.jf.intel.com) ([10.23.153.244]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 04:31:07 -0700 From: Chao Gao To: linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org Cc: rick.p.edgecombe@intel.com, kas@kernel.org, dave.hansen@linux.intel.com, chao.gao@intel.com Subject: [PATCH v1 1/8] x86/virt/tdx: Stop treating tdx_global_metadata.h as auto-generated Date: Tue, 4 Aug 2026 04:29:29 -0700 Message-ID: <20260804112941.19894-2-chao.gao@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260804112941.19894-1-chao.gao@intel.com> References: <20260804112941.19894-1-chao.gao@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Dave Hansen 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 Signed-off-by: Chao Gao --- 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 +/* + * 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