From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.19 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796142010; b=eCm+hCApPYXZrgLKfDoFhZTQo4lU63b7A2lBQI8cGIWTPABtlPUKdzOcTfe5xqxjfUgG Hi+JsNqYRUFDgqNoEm3gUBLH6CopK23YsaiUNv8+91PtqklOpf2XOP0Cznih+El5yEPus ndsA4un5bGBtjSnTTh62IzxQKb7qilmoYmjCG2VU2H5OjLby6mvppuqXl6fenEvUbmRgU iaxLbIxIKFJ51Ir8WKhqiQ3ta8OWFM6cEpel63H70PozoD5fnBrDTxkRlZtzteon1slfW F3+8vZ1M8dqXAJj7Xa1qbv3js4Ipkz3XXa1Cv2CMMtRoC3kFuRCCRaY5Jakbsa9j50g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796142010; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=82j3WfHmBl0oy34DwAHegH1bFx1iOOWpyP1+cmjD+Jw=; b=R40Bjz+NvfSOpiTk4k1zI+RHLEt8oiXxELQMxQZZOfRUkgwWI8x+YSzJO0mqrOuVyxLF SZGpIzGA4R7hfqqXac++loXoSy5SGtm3gmCVUJRRS1VAoG2fh6L5dz1IsC8XbRd5tZqVY lsDUpSBsIfzTDENSjcuR1TXBnvBDWQ3VCwSuwM5TW7cNKOg/dBoFjppnZJbJO5KWGQjnh rtl6NDyF7G/eSH9HJ6ZYEknriLB3UIayekEyXrMlNyeatvNEuU0CmKCaxqXTpfhb/YcLk qNTBQFZnUDcdYkBXBvVVa/KwJxHKIUPLtNk2N5YBrphYtL7gFui3+k4B2MvOWvIFt2A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gh7Iqudc; arc=none smtp.remote-ip=192.198.163.19 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD93460A263A; Tue, 1 Dec 2026 16:20:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DD93460A263A 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.a=rsa-sha256 header.s=Intel header.b=gh7Iqudc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796142011; x=1827678011; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=82j3WfHmBl0oy34DwAHegH1bFx1iOOWpyP1+cmjD+Jw=; b=gh7IqudcP3p1V9Uii4lfJkcrkA5g/sGqF8sJqIcpIvzr2n49uCAq9oEw rwhcRruSVRk9/pn6mRAq+QJKcwLuG70wMEDfgezG+azN2quaJ55h5Csdq iIZnA+O2h2IlgSR2g08xgIHSCioE5/xe1pm1SzAVxpkqlDauQjruLICX+ HzQlF8ak1b+cUF6cOt3Jterkr2q3Ytp0WeziE9ExuQK5QZK0fwSF5b+Sm kS6NDczO5lxLHW53eRETMOLAwj/qvdvEgfsCLugKWSbEJQikz6Gn6zW2W TcUuan+MeE5ijTwBylrxBK3i0umRerhNMvTO+dEvnI1hyz+KNc2/pbWLM w==; X-CSE-ConnectionGUID: BDDE4LuTThqe37oEi1/zfw== X-CSE-MsgGUID: ADdAUFttSnS453KOD3x0Tg== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5046190" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5046190" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 08:20:09 -0800 X-CSE-ConnectionGUID: 4su8wpthSiGNv3lLMj7EcA== X-CSE-MsgGUID: 3w+Op0ZTSbykOWFZzSImFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13769064" Received: from gmitchel-mobl2.amr.corp.intel.com (HELO [10.125.111.29]) ([10.125.111.29]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 08:19:48 -0800 Message-ID: <7187409e-becb-4a94-a669-29c39ecd7343@intel.com> Date: Tue, 1 Dec 2026 09:19:47 -0700 X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver To: Jason Gunthorpe , Alexey Kardashevskiy , "Aneesh Kumar K.V" , Borislav Petkov , Jonathan Corbet , Dave Hansen , "H. Peter Anvin" , Kiryl Shutsemau , kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Lukas Wunner , Ingo Molnar , Randy Dunlap , Rick Edgecombe , Shuah Khan , Shuah Khan , Thomas Gleixner , x86@kernel.org Cc: Jiri Pirko , patches@lists.linux.dev, Yeoreum Yun References: <3-v1-56c8df81fd64+16c-att_start_jgg@nvidia.com> From: Dave Jiang Content-Language: en-US In-Reply-To: <3-v1-56c8df81fd64+16c-att_start_jgg@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/30/26 5:52 PM, Jason Gunthorpe wrote: > 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 > --- > 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. Unlike the RMM and the PSP, the TDX module doesn't sign anything. It produces the TD report, and the TD Quoting Enclave (QE) on the host signs it into a quote, which the guest gets through the GetQuote hypercall. See the Attestation section of Documentation/arch/x86/tdx.rst. Also looking at tsm_mrs[], it looks to expose 8 measurement registers. How about something like this? Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG. DJ> + > + 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