Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alexey Kardashevskiy <aik@amd.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Jonathan Corbet <corbet@lwn.net>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	kvm@vger.kernel.org, linux-coco@lists.linux.dev,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Lukas Wunner <lukas@wunner.de>, Ingo Molnar <mingo@redhat.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Shuah Khan <shuah@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Thomas Gleixner <tglx@kernel.org>,
	x86@kernel.org
Cc: Jiri Pirko <jiri@resnulli.us>,
	patches@lists.linux.dev, Yeoreum Yun <yeoreum.yun@arm.com>
Subject: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
Date: Mon, 30 Nov 2026 20:52:23 -0400	[thread overview]
Message-ID: <3-v1-56c8df81fd64+16c-att_start_jgg@nvidia.com> (raw)
In-Reply-To: <0-v1-56c8df81fd64+16c-att_start_jgg@nvidia.com>

tdx-guest.c is the driver for the Root of Trust inside the TDX module
accessed by the guest.

The Intel TDX spec supports two token formats and 4 measurement registers.

Move it into drivers/attestation/intel/tdx-guest.c.

Module autoloading continues to be triggered by the x86_cpu_id match
mechanism.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 arch/x86/coco/tdx/tdx.c                             |  8 ++++----
 drivers/attestation/Kconfig                         |  1 +
 drivers/attestation/Makefile                        |  1 +
 drivers/attestation/intel/Kconfig                   | 13 +++++++++++++
 drivers/attestation/intel/Makefile                  |  4 ++++
 .../tdx-guest => attestation/intel}/tdx-guest.c     |  4 ++--
 drivers/virt/coco/Kconfig                           |  2 --
 drivers/virt/coco/Makefile                          |  1 -
 drivers/virt/coco/tdx-guest/Kconfig                 | 11 -----------
 drivers/virt/coco/tdx-guest/Makefile                |  2 --
 tools/testing/selftests/tdx/config                  |  2 +-
 11 files changed, 26 insertions(+), 23 deletions(-)
 create mode 100644 drivers/attestation/intel/Kconfig
 create mode 100644 drivers/attestation/intel/Makefile
 rename drivers/{virt/coco/tdx-guest => attestation/intel}/tdx-guest.c (99%)
 delete mode 100644 drivers/virt/coco/tdx-guest/Kconfig
 delete mode 100644 drivers/virt/coco/tdx-guest/Makefile

diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 8bacbef62891fd..55124b201b3c1a 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -139,7 +139,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
 
 	return 0;
 }
-EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_get_report0, "tdx-guest");
+EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_get_report0, "attestation_intel_tdx_guest");
 
 /**
  * tdx_mcall_extend_rtmr() - Wrapper to extend RTMR registers using
@@ -175,7 +175,7 @@ int tdx_mcall_extend_rtmr(u8 index, u8 *data)
 
 	return 0;
 }
-EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_extend_rtmr, "tdx-guest");
+EXPORT_SYMBOL_FOR_MODULES(tdx_mcall_extend_rtmr, "attestation_intel_tdx_guest");
 
 /**
  * tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote
@@ -196,7 +196,7 @@ u64 tdx_hcall_get_quote(void *buf, size_t size)
 	/* Since buf is a shared memory, set the shared (decrypted) bits */
 	return _tdx_hypercall(TDVMCALL_GET_QUOTE, cc_mkdec(virt_to_phys(buf)), size, 0, 0);
 }
-EXPORT_SYMBOL_FOR_MODULES(tdx_hcall_get_quote, "tdx-guest");
+EXPORT_SYMBOL_FOR_MODULES(tdx_hcall_get_quote, "attestation_intel_tdx_guest");
 
 /*
  * Ask the TDX module what the largest Quote on the host platform might be.
@@ -213,7 +213,7 @@ int tdx_get_max_quote_size(u64 *max_quote_size)
 
 	return 0;
 }
-EXPORT_SYMBOL_FOR_MODULES(tdx_get_max_quote_size, "tdx-guest");
+EXPORT_SYMBOL_FOR_MODULES(tdx_get_max_quote_size, "attestation_intel_tdx_guest");
 
 /*
  * The kernel cannot handle #VEs when accessing normal kernel memory. Ensure
diff --git a/drivers/attestation/Kconfig b/drivers/attestation/Kconfig
index c71b6e1e5a501e..d632503a55f85a 100644
--- a/drivers/attestation/Kconfig
+++ b/drivers/attestation/Kconfig
@@ -18,4 +18,5 @@ menuconfig ATTESTATION
 
 if ATTESTATION
 source "drivers/attestation/arm/Kconfig"
+source "drivers/attestation/intel/Kconfig"
 endif # ATTESTATION
diff --git a/drivers/attestation/Makefile b/drivers/attestation/Makefile
index c48d12d31c6579..e12162cb55e30b 100644
--- a/drivers/attestation/Makefile
+++ b/drivers/attestation/Makefile
@@ -5,3 +5,4 @@ attestation-y := \
 obj-$(CONFIG_ATTESTATION) += attestation.o
 
 obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/
+obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += intel/
diff --git a/drivers/attestation/intel/Kconfig b/drivers/attestation/intel/Kconfig
new file mode 100644
index 00000000000000..18a6a2b87e9188
--- /dev/null
+++ b/drivers/attestation/intel/Kconfig
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config ATTESTATION_INTEL_TDX_GUEST
+	tristate "Intel TDX Guest Attestation Driver"
+	depends on INTEL_TDX_GUEST
+	help
+	  Driver for the TDX guest signed quote from the Root of Trust inside
+	  the TDX module for confidential VMs. The quote includes 4 measurement
+	  registers.
+
+	  Reports are available in user-created directories under
+	  /sys/kernel/config/tsm/report/ with provider "tdx_guest".
+	  Measurement registers are exposed under
+	  /sys/devices/virtual/misc/tdx_guest/measurements/.
diff --git a/drivers/attestation/intel/Makefile b/drivers/attestation/intel/Makefile
new file mode 100644
index 00000000000000..43ba77b6bfa012
--- /dev/null
+++ b/drivers/attestation/intel/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+attestation_intel_tdx_guest-y := tdx-guest.o
+
+obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += attestation_intel_tdx_guest.o
diff --git a/drivers/virt/coco/tdx-guest/tdx-guest.c b/drivers/attestation/intel/tdx-guest.c
similarity index 99%
rename from drivers/virt/coco/tdx-guest/tdx-guest.c
rename to drivers/attestation/intel/tdx-guest.c
index 11d741da3b35f5..1ccc81f507141e 100644
--- a/drivers/virt/coco/tdx-guest/tdx-guest.c
+++ b/drivers/attestation/intel/tdx-guest.c
@@ -403,7 +403,7 @@ static const struct attribute_group *tdx_attr_groups[] = {
 };
 
 static struct miscdevice tdx_misc_dev = {
-	.name = KBUILD_MODNAME,
+	.name = "tdx_guest",
 	.minor = MISC_DYNAMIC_MINOR,
 	.fops = &tdx_guest_fops,
 	.groups = tdx_attr_groups,
@@ -416,7 +416,7 @@ static const struct x86_cpu_id tdx_guest_ids[] = {
 MODULE_DEVICE_TABLE(x86cpu, tdx_guest_ids);
 
 static const struct tsm_report_ops tdx_tsm_ops = {
-	.name = KBUILD_MODNAME,
+	.name = "tdx_guest",
 	.report_new = tdx_report_new,
 	.report_attr_visible = tdx_report_attr_visible,
 	.report_bin_attr_visible = tdx_report_bin_attr_visible,
diff --git a/drivers/virt/coco/Kconfig b/drivers/virt/coco/Kconfig
index cc5fa179f2e850..5329f82c2b1e6d 100644
--- a/drivers/virt/coco/Kconfig
+++ b/drivers/virt/coco/Kconfig
@@ -9,8 +9,6 @@ source "drivers/virt/coco/efi_secret/Kconfig"
 source "drivers/virt/coco/pkvm-guest/Kconfig"
 
 source "drivers/virt/coco/sev-guest/Kconfig"
-
-source "drivers/virt/coco/tdx-guest/Kconfig"
 endif
 
 source "drivers/virt/coco/tdx-host/Kconfig"
diff --git a/drivers/virt/coco/Makefile b/drivers/virt/coco/Makefile
index acda2e49d5e173..ea4e27a5ce5040 100644
--- a/drivers/virt/coco/Makefile
+++ b/drivers/virt/coco/Makefile
@@ -5,6 +5,5 @@
 obj-$(CONFIG_EFI_SECRET)	+= efi_secret/
 obj-$(CONFIG_ARM_PKVM_GUEST)	+= pkvm-guest/
 obj-$(CONFIG_SEV_GUEST)		+= sev-guest/
-obj-$(CONFIG_INTEL_TDX_GUEST)	+= tdx-guest/
 obj-$(CONFIG_INTEL_TDX_HOST)	+= tdx-host/
 obj-$(CONFIG_TSM) 		+= tsm-core.o
diff --git a/drivers/virt/coco/tdx-guest/Kconfig b/drivers/virt/coco/tdx-guest/Kconfig
deleted file mode 100644
index bfb7e6787ffc88..00000000000000
--- a/drivers/virt/coco/tdx-guest/Kconfig
+++ /dev/null
@@ -1,11 +0,0 @@
-config TDX_GUEST_DRIVER
-	tristate "TDX Guest driver"
-	depends on INTEL_TDX_GUEST
-	depends on ATTESTATION
-	help
-	  The driver provides userspace interface to communicate with
-	  the TDX module to request the TDX guest details like attestation
-	  report.
-
-	  To compile this driver as module, choose M here. The module will
-	  be called tdx-guest.
diff --git a/drivers/virt/coco/tdx-guest/Makefile b/drivers/virt/coco/tdx-guest/Makefile
deleted file mode 100644
index 775cb463f9c876..00000000000000
--- a/drivers/virt/coco/tdx-guest/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.o
diff --git a/tools/testing/selftests/tdx/config b/tools/testing/selftests/tdx/config
index aa1edc829ab679..c5382d0cbcbad1 100644
--- a/tools/testing/selftests/tdx/config
+++ b/tools/testing/selftests/tdx/config
@@ -1 +1 @@
-CONFIG_TDX_GUEST_DRIVER=y
+CONFIG_ATTESTATION_INTEL_TDX_GUEST=y
-- 
2.43.0


  parent reply	other threads:[~2026-12-01  0:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  0:52 [PATCH tsm 0/4] Start building drivers/attestation Jason Gunthorpe
2026-12-01  0:52 ` [PATCH tsm 1/4] attestation: Start the new subsystem using tsm_report and mr Jason Gunthorpe
2026-12-01  0:52 ` [PATCH tsm 2/4] attestation: Move the ARM Realm Token tsm_report driver Jason Gunthorpe
2026-12-01  0:52 ` Jason Gunthorpe [this message]
2026-12-01  0:52 ` [PATCH tsm 4/4] attestation: Move AMD SEV Guest " Jason Gunthorpe

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=3-v1-56c8df81fd64+16c-att_start_jgg@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=aik@amd.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jiri@resnulli.us \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mingo@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=rdunlap@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /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