Skip to contentSkip to conversation

Add TDX Guest Attestation support

PATCH Superseded Kuppuswamy Sathyanarayanan 4 participants 19 messages Sep 28, 2022 – Oct 13, 2022

Subsystems (4)

v14 of 18 Superseded Latest is v18 →

lore
Share & tools
lore
#0 lore raw

v14 cover Add TDX Guest Attestation support

Hi All,

Intel's Trust Domain Extensions (TDX) protect guest VMs from malicious hosts and some physical attacks. VM guest with TDX support is called as a TDX Guest.

In TDX guest, attestation process is used to verify the TDX guest trustworthiness to other entities before provisioning secrets to the guest. For example, a key server may request for attestation before releasing the encryption keys to mount the encrypted rootfs or secondary drive.

This patch set adds attestation support for the TDX guest. Details about the TDX attestation process and the steps involved are explained in Documentation/x86/tdx.rst (added by patch 2/3).

Following are the details of the patch set:

Patch 1/3 -> Preparatory patch for adding attestation support. Patch 2/3 -> Adds user interface driver to support attestation. Patch 3/3 -> Adds selftest support for TDREPORT feature.

Commit log history is maintained in the individual patches.

Kuppuswamy Sathyanarayanan (3):
x86/tdx: Make __tdx_module_call() usable in driver module
virt: Add TDX guest driver
selftests: tdx: Test TDX attestation GetReport support

 Documentation/virt/coco/tdx-guest.rst        |  42 +++++
 Documentation/virt/index.rst                 |   1 +
 Documentation/x86/tdx.rst                    |  43 +++++
 arch/x86/coco/tdx/tdcall.S                   |   2 +
 arch/x86/coco/tdx/tdx.c                      |   5 -
 arch/x86/include/asm/tdx.h                   |   6 +
 drivers/virt/Kconfig                         |   2 +
 drivers/virt/Makefile                        |   1 +
 drivers/virt/coco/tdx-guest/Kconfig          |  10 ++
 drivers/virt/coco/tdx-guest/Makefile         |   2 +
 drivers/virt/coco/tdx-guest/tdx-guest.c      | 131 ++++++++++++++
 include/uapi/linux/tdx-guest.h               |  53 ++++++
 tools/testing/selftests/Makefile             |   1 +
 tools/testing/selftests/tdx/Makefile         |   7 +
 tools/testing/selftests/tdx/config           |   1 +
 tools/testing/selftests/tdx/tdx_guest_test.c | 175 +++++++++++++++++++
 16 files changed, 477 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/virt/coco/tdx-guest.rst
 create mode 100644 drivers/virt/coco/tdx-guest/Kconfig
 create mode 100644 drivers/virt/coco/tdx-guest/Makefile
 create mode 100644 drivers/virt/coco/tdx-guest/tdx-guest.c
 create mode 100644 include/uapi/linux/tdx-guest.h
 create mode 100644 tools/testing/selftests/tdx/Makefile
 create mode 100644 tools/testing/selftests/tdx/config
 create mode 100644 tools/testing/selftests/tdx/tdx_guest_test.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v14 1/3 x86/tdx: Make __tdx_module_call() usable in driver module

To support TDX attestation, the TDX guest user interface driver must use the __tdx module_call() function in the driver to allow the user to obtain the TDREPORT.

So export the __tdx_module_call() and move the TDX Module IDs to asm/tdx.h.

This is a preparatory patch for adding attestation support.

---

Changes since v13:
* None

 arch/x86/coco/tdx/tdcall.S | 2 ++
 arch/x86/coco/tdx/tdx.c    | 5 -----
 arch/x86/include/asm/tdx.h | 5 +++++
 3 files changed, 7 insertions(+), 5 deletions(-)
arch/x86/coco/tdx/tdcall.S +2 -0
index f9eb1134f22d..47a1534946c8 100644
@@ -3,6 +3,7 @@
 #include <asm/asm.h>
 #include <asm/frame.h>
 #include <asm/unwind_hints.h>
+#include <asm/export.h>
 
 #include <linux/linkage.h>
 #include <linux/bits.h>
@@ -75,6 +76,7 @@ SYM_FUNC_START(__tdx_module_call)
 	FRAME_END
 	RET
 SYM_FUNC_END(__tdx_module_call)
+EXPORT_SYMBOL_GPL(__tdx_module_call);
 
 /*
  * __tdx_hypercall() - Make hypercalls to a TDX VMM using TDVMCALL leaf
arch/x86/coco/tdx/tdx.c +0 -5
index 928dcf7a20d9..2dcc6021aa43 100644
@@ -12,11 +12,6 @@
 #include <asm/insn-eval.h>
 #include <asm/pgtable.h>
 
-/* TDX module Call Leaf IDs */
-#define TDX_GET_INFO			1
-#define TDX_GET_VEINFO			3
-#define TDX_ACCEPT_PAGE			6
-
 /* TDX hypercall Leaf IDs */
 #define TDVMCALL_MAP_GPA		0x10001
 
arch/x86/include/asm/tdx.h +5 -0
index 020c81a7c729..34c00d8a5263 100644
@@ -18,6 +18,11 @@
 #define TDX_SW_ERROR			(TDX_ERROR | GENMASK_ULL(47, 40))
 #define TDX_SEAMCALL_VMFAILINVALID	(TDX_SW_ERROR | _UL(0xFFFF0000))
 
+/* TDX module Call Leaf IDs */
+#define TDX_GET_INFO			1
+#define TDX_GET_VEINFO			3
+#define TDX_ACCEPT_PAGE			6
+
 #ifndef __ASSEMBLY__
 
 /*
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 6 lines · Kuppuswamy Sathyanarayanan

To support TDX attestation, the TDX guest user interface driver must use the __tdx module_call() function in the driver to allow the user to obtain the TDREPORT.

So export the __tdx_module_call() and move the TDX Module IDs to asm/tdx.h.

The functions with the __ prefix are usually lower-level interfaces which should be internal. Usually.

Why aren't you exporting the tdx_module_call() one instead?

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#3 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 5 lines · Borislav Petkov
Quoted 4 lines · Kuppuswamy Sathyanarayanan

To support TDX attestation, the TDX guest user interface driver must use the __tdx module_call() function in the driver to allow the user to obtain the TDREPORT.

Quoted 7 lines
Quoted 2 lines

So export the __tdx_module_call() and move the TDX Module IDs to asm/tdx.h.

The functions with the __ prefix are usually lower-level interfaces which should be internal. Usually.

Why aren't you exporting the tdx_module_call() one instead?

tdx_module_call() calls panic() on a non-zero error value. So it is only used for cases where failure is fatal to the guest. But in the case of TDG.MR.REPORT TDCALL, there are valid cases for failure (like invalid param or busy condition) and the failure is non-fatal.

So we should create a new wrapper for this use case or use __tdx_module_call() which is already exposed in asm/tdx.h.

Quoted 1 line
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
maintainer
#4 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#5 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 4 lines · Borislav Petkov
Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Ok. I will add a new wrapper to get the TDREPORT.

+/*

+ * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest

+ * driver module to get the TDREPORT.

+ */

+long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

+{

+ if (subtype || !reportdata || !tdreport)

+ return -EINVAL;

+

+ /*

+ * Generate TDREPORT using "TDG.MR.REPORT" TDCALL.

+ *

+ * Get the TDREPORT using REPORTDATA as input. Refer to

+ * section 22.3.3 TDG.MR.REPORT leaf in the TDX Module 1.0

+ * specification for detailed information.

+ */

+ return __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),

+ virt_to_phys(reportdata), subtype, 0, NULL);

+}

+EXPORT_SYMBOL_GPL(tdx_mcall_get_report);

Quoted 3 lines

Thx.

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
#6 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 10 lines · Sathyanarayanan Kuppuswamy
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Ok. I will add a new wrapper to get the TDREPORT.

Review

Quoted 9 lines
(quoted diff) +5 -0
+/*
 
+ * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest
 
+ * driver module to get the TDREPORT.
 
+ */
 
+long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

Why "long"?

Why void *? Don't you have real types for these?

Review

Quoted 6 lines
(quoted diff) +3 -0
+{
 
+       if (subtype || !reportdata || !tdreport)
 
+               return -EINVAL;

How could that happen if you control all callers?

Quoted 10 lines
(quoted diff) +5 -0
+
 
+       /*
 
+        * Generate TDREPORT using "TDG.MR.REPORT" TDCALL.
 
+        *
 
+        * Get the TDREPORT using REPORTDATA as input. Refer to

Review

Quoted 10 lines
(quoted diff) +5 -0
 
+        * section 22.3.3 TDG.MR.REPORT leaf in the TDX Module 1.0
 
+        * specification for detailed information.
 
+        */
 
+       return __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),
 
+                       virt_to_phys(reportdata), subtype, 0, NULL);

If you check for NULL, why are you not validating that these are valid pointers as well? You can't have it both ways.

thanks,

greg k-h

#7 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Hi,

Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Sathyanarayanan Kuppuswamy
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Ok. I will add a new wrapper to get the TDREPORT.

+/*

+ * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest

Quoted 7 lines
Quoted 5 lines

+ * driver module to get the TDREPORT.

+ */

+long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

Why "long"?

We used long because __tdx_module_call() call returns u64 value.

Alternatively, we can also check for return value of __tdx_module_call() here and return 0/-EIO as return values. In this case we can change return value to int.

Quoted 2 lines

Why void *? Don't you have real types for these?

We use these buffers as an intermediary to transfer data between userspace and the TDX module. In the kernel we don't consume these datas. So we did not define the type of the data.

Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +3 -0
+{
 
+       if (subtype || !reportdata || !tdreport)
 
+               return -EINVAL;

How could that happen if you control all callers?

I have added it as a safety check against any incorrect usage in future. I will remove it.

Quoted 4 lines

thanks,

greg k-h

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
#8 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 20 lines · Sathyanarayanan Kuppuswamy

Hi,

Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Sathyanarayanan Kuppuswamy
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Ok. I will add a new wrapper to get the TDREPORT.

+/*

+ * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest

+ * driver module to get the TDREPORT.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+ */

+long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

Why "long"?

We used long because __tdx_module_call() call returns u64 value.

Great, then use u64 please. Or if you are returning negative errors, use s64 to be specific.

Quoted 3 lines

Alternatively, we can also check for return value of __tdx_module_call() here and return 0/-EIO as return values. In this case we can change return value to int.

That would make more sense, right?

Quoted 6 lines
Quoted 2 lines

Why void *? Don't you have real types for these?

We use these buffers as an intermediary to transfer data between userspace and the TDX module. In the kernel we don't consume these datas. So we did not define the type of the data.

Then these are userspace pointers? Why are they not marked as such?

thanks,

greg k-h

#9 lore raw

Re: [PATCH v14 1/3] x86/tdx: Make __tdx_module_call() usable in driver module

Quoted 29 lines · Greg Kroah-Hartman
Quoted 20 lines · Sathyanarayanan Kuppuswamy

Hi,

Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Sathyanarayanan Kuppuswamy
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Sathyanarayanan Kuppuswamy

So we should create a new wrapper for this use case or use

Yes, you got it - a new wrapper pls.

Ok. I will add a new wrapper to get the TDREPORT.

+/*

+ * Add a wrapper for TDG.MR.REPORT TDCALL. It is used in TDX guest

+ * driver module to get the TDREPORT.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+ */

+long tdx_mcall_get_report(void *reportdata, void *tdreport, u8 subtype)

Why "long"?

We used long because __tdx_module_call() call returns u64 value.

Quoted 8 lines

Great, then use u64 please. Or if you are returning negative errors, use s64 to be specific.

Quoted 3 lines

Alternatively, we can also check for return value of __tdx_module_call() here and return 0/-EIO as return values. In this case we can change return value to int.

That would make more sense, right?

Yes. I will change it as mentioned above.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Why void *? Don't you have real types for these?

We use these buffers as an intermediary to transfer data between userspace and the TDX module. In the kernel we don't consume these datas. So we did not define the type of the data.

Then these are userspace pointers? Why are they not marked as such?

They are not userspace pointers. Since we need to pass physical addresses of reportdata and tdreport buffers to the TDX Module, we cannot directly use userspace pointers. So we allocate these intermediary buffers in the TDX guest driver and use it to copy the data from/to user pointers.

Quoted 4 lines

thanks,

greg k-h

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
#10 lore raw

PATCH v14 2/3 virt: Add TDX guest driver

In reply to Kuppuswamy Sathyanarayanan

TDX guest driver exposes IOCTL interfaces to service TDX guest user-specific requests. Currently, it is only used to allow the user to get the TDREPORT to support TDX attestation.

Details about the TDX attestation process are documented in Documentation/x86/tdx.rst, and the IOCTL details are documented in Documentation/virt/coco/tdx-guest.rst.

Operations like getting TDREPORT involves sending a blob of data as input and getting another blob of data as output. It was considered to use a sysfs interface for this, but it doesn't fit well into the standard sysfs model for configuring values. It would be possible to do read/write on files, but it would need multiple file descriptors, which would be somewhat messy. IOCTLs seems to be the best fitting and simplest model for this use case. The AMD sev-guest driver also uses IOCTL interface to support attestation.

---

Changes since v13:
* Converted the driver from built-in to a driver module as per Greg's suggestion.
* Moved the driver to drivers/virt/coco to match AMD SEV.
* Added support to autoload the driver based on X86_FEATURE_TDX_GUEST CPU feature.
* Squashed patch titled "Documentation/x86: Document TDX attestation process" with this patch.
* Since the attestation process is already documented in Documentation/x86/tdx.rst, remove it from the commit log.
* Modified the commit log to match the new format.
* Explicitly included the required header files.
* Fixed magic number usage in reserved member check.

Changes since v13:
* Fixed the commit log as per review suggestion.
* Explicitly included the required header files.
* Fixed magic number usage in reserved member check.

Changes since v12:
* Added check to ensure reserved entries are set as 0.

Changes since v11:
* Renamed DRIVER_NAME to TDX_GUEST_DEVICE and moved it to arch/x86/include/uapi/asm/tdx.h.
* Fixed default error number in tdx_guest_ioctl().
* Moved tdx_misc_dev definition out of tdx_guest_init() as per Greg's suggestion.
* Reordered struct tdx_report_req to avoid holes and added required padding.

Changes since v10:
* Replaced TD/TD Guest usage with TDX Guest or Guest.
* Removed unnecessary comments.
* Added more validation to user input in tdx_get_report().
* Used u64_to_user_ptr when reading user u64 pointers.
* Fixed commit log as per review comments.

Changes since v9:
* Dropped the cover letter. Since this patch set only adds TDREPORT support, the commit log itself has all the required details.
* Dropped the Quote support and event IRQ support as per Dave's review suggestion.
* Dropped attest.c and moved its contents to tdx.c
* Updated commit log and comments to reflect latest changes.

Changes since v8:
* Please refer to https://lore.kernel.org/all/ \
20220728034420.648314-1-sathyanarayanan.kuppuswamy@linux.intel.com/

 Documentation/virt/coco/tdx-guest.rst   |  42 ++++++++
 Documentation/virt/index.rst            |   1 +
 Documentation/x86/tdx.rst               |  43 ++++++++
 arch/x86/include/asm/tdx.h              |   1 +
 drivers/virt/Kconfig                    |   2 +
 drivers/virt/Makefile                   |   1 +
 drivers/virt/coco/tdx-guest/Kconfig     |  10 ++
 drivers/virt/coco/tdx-guest/Makefile    |   2 +
 drivers/virt/coco/tdx-guest/tdx-guest.c | 131 ++++++++++++++++++++++++
 include/uapi/linux/tdx-guest.h          |  53 ++++++++++
 10 files changed, 286 insertions(+)
 create mode 100644 Documentation/virt/coco/tdx-guest.rst
 create mode 100644 drivers/virt/coco/tdx-guest/Kconfig
 create mode 100644 drivers/virt/coco/tdx-guest/Makefile
 create mode 100644 drivers/virt/coco/tdx-guest/tdx-guest.c
 create mode 100644 include/uapi/linux/tdx-guest.h
Documentation/virt/coco/tdx-guest.rst new file +42 -0
new file mode 100644
index 000000000000..4fe72829bdd0
@@ -0,0 +1,42 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===================================================================
+TDX Guest API Documentation
+===================================================================
+
+1. General description
+======================
+
+The TDX guest driver exposes IOCTL interfaces via /dev/tdx-guest misc
+device to allow userspace to get certain TDX guest specific details.
+
+2. API description
+==================
+
+In this section, for each supported IOCTL, following information is
+provided along with a generic description.
+
+:Input parameters: Parameters passed to the IOCTL and related details.
+:Output: Details about output data and return value (with details about the non
+         common error values).
+
+2.1 TDX_CMD_GET_REPORT
+----------------------
+
+:Input parameters: struct tdx_report_req
+:Output: Upon successful execution, TDREPORT data is copied to
+         tdx_report_req.tdreport and return 0. Return -EIO on
+         TDCALL failure or standard error number on other common
+         failures.
+
+The TDX_CMD_GET_REPORT IOCTL can be used by the attestation software to
+get the TDREPORT from the TDX module using TDCALL[TDG.MR.REPORT].
+
+Reference
+---------
+
+TDX reference material is collected here:
+
+https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html
+
+The driver is based on TDX module specification v1.0 and TDX GHCI specification v1.0.
Documentation/virt/index.rst +1 -0
index 2f1cffa87b1b..56e003ff28ff 100644
@@ -14,6 +14,7 @@ Linux Virtualization Support
    ne_overview
    acrn/index
    coco/sev-guest
+   coco/tdx-guest
    hyperv/index
 
 .. only:: html and subproject
Documentation/x86/tdx.rst +43 -0

49 lines not on this page · raw message

arch/x86/include/asm/tdx.h +1 -0
index 34c00d8a5263..f710035a0bdb 100644
@@ -21,6 +21,7 @@
 /* TDX module Call Leaf IDs */
 #define TDX_GET_INFO			1
 #define TDX_GET_VEINFO			3
+#define TDX_GET_REPORT			4
 #define TDX_ACCEPT_PAGE			6
 
 #ifndef __ASSEMBLY__
drivers/virt/Kconfig +2 -0
index 87ef258cec64..f79ab13a5c28 100644
@@ -52,4 +52,6 @@ source "drivers/virt/coco/efi_secret/Kconfig"
 
 source "drivers/virt/coco/sev-guest/Kconfig"
 
+source "drivers/virt/coco/tdx-guest/Kconfig"
+
 endif
drivers/virt/Makefile +1 -0
index 093674e05c40..e9aa6fc96fab 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_NITRO_ENCLAVES)	+= nitro_enclaves/
 obj-$(CONFIG_ACRN_HSM)		+= acrn/
 obj-$(CONFIG_EFI_SECRET)	+= coco/efi_secret/
 obj-$(CONFIG_SEV_GUEST)		+= coco/sev-guest/
+obj-$(CONFIG_INTEL_TDX_GUEST)	+= coco/tdx-guest/
drivers/virt/coco/tdx-guest/Kconfig new file +10 -0
new file mode 100644
index 000000000000..14246fc2fb02
@@ -0,0 +1,10 @@
+config TDX_GUEST_DRIVER
+	tristate "TDX Guest driver"
+	depends on INTEL_TDX_GUEST
+	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.
drivers/virt/coco/tdx-guest/Makefile new file +2 -0
new file mode 100644
index 000000000000..4396ec319589
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.o
drivers/virt/coco/tdx-guest/tdx-guest.c new file +131 -0

131 lines not on this page · raw message

include/uapi/linux/tdx-guest.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 407 lines · Kuppuswamy Sathyanarayanan

TDX guest driver exposes IOCTL interfaces to service TDX guest user-specific requests. Currently, it is only used to allow the user to get the TDREPORT to support TDX attestation.

Details about the TDX attestation process are documented in Documentation/x86/tdx.rst, and the IOCTL details are documented in Documentation/virt/coco/tdx-guest.rst.

Operations like getting TDREPORT involves sending a blob of data as input and getting another blob of data as output. It was considered to use a sysfs interface for this, but it doesn't fit well into the standard sysfs model for configuring values. It would be possible to do read/write on files, but it would need multiple file descriptors, which would be somewhat messy. IOCTLs seems to be the best fitting and simplest model for this use case. The AMD sev-guest driver also uses IOCTL interface to support attestation.

---

Changes since v13:
* Converted the driver from built-in to a driver module as per Greg's suggestion.
* Moved the driver to drivers/virt/coco to match AMD SEV.
* Added support to autoload the driver based on X86_FEATURE_TDX_GUEST CPU feature.
* Squashed patch titled "Documentation/x86: Document TDX attestation process" with this patch.
* Since the attestation process is already documented in Documentation/x86/tdx.rst, remove it from the commit log.
* Modified the commit log to match the new format.
* Explicitly included the required header files.
* Fixed magic number usage in reserved member check.

Changes since v13:
* Fixed the commit log as per review suggestion.
* Explicitly included the required header files.
* Fixed magic number usage in reserved member check.

Changes since v12:
* Added check to ensure reserved entries are set as 0.

Changes since v11:
* Renamed DRIVER_NAME to TDX_GUEST_DEVICE and moved it to arch/x86/include/uapi/asm/tdx.h.
* Fixed default error number in tdx_guest_ioctl().
* Moved tdx_misc_dev definition out of tdx_guest_init() as per Greg's suggestion.
* Reordered struct tdx_report_req to avoid holes and added required padding.

Changes since v10:
* Replaced TD/TD Guest usage with TDX Guest or Guest.
* Removed unnecessary comments.
* Added more validation to user input in tdx_get_report().
* Used u64_to_user_ptr when reading user u64 pointers.
* Fixed commit log as per review comments.

Changes since v9:
* Dropped the cover letter. Since this patch set only adds TDREPORT support, the commit log itself has all the required details.
* Dropped the Quote support and event IRQ support as per Dave's review suggestion.
* Dropped attest.c and moved its contents to tdx.c
* Updated commit log and comments to reflect latest changes.

Changes since v8:

 * Please refer to https://lore.kernel.org/all/ \
   20220728034420.648314-1-sathyanarayanan.kuppuswamy@linux.intel.com/
 Documentation/virt/coco/tdx-guest.rst   |  42 ++++++++
 Documentation/virt/index.rst            |   1 +
 Documentation/x86/tdx.rst               |  43 ++++++++
 arch/x86/include/asm/tdx.h              |   1 +
 drivers/virt/Kconfig                    |   2 +
 drivers/virt/Makefile                   |   1 +
 drivers/virt/coco/tdx-guest/Kconfig     |  10 ++
 drivers/virt/coco/tdx-guest/Makefile    |   2 +
 drivers/virt/coco/tdx-guest/tdx-guest.c | 131 ++++++++++++++++++++++++
 include/uapi/linux/tdx-guest.h          |  53 ++++++++++
 10 files changed, 286 insertions(+)
 create mode 100644 Documentation/virt/coco/tdx-guest.rst
 create mode 100644 drivers/virt/coco/tdx-guest/Kconfig
 create mode 100644 drivers/virt/coco/tdx-guest/Makefile
 create mode 100644 drivers/virt/coco/tdx-guest/tdx-guest.c
 create mode 100644 include/uapi/linux/tdx-guest.h
Documentation/virt/coco/tdx-guest.rst new file +42 -0
new file mode 100644
index 000000000000..4fe72829bdd0
@@ -0,0 +1,42 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===================================================================
+TDX Guest API Documentation
+===================================================================
+
+1. General description
+======================
+
+The TDX guest driver exposes IOCTL interfaces via /dev/tdx-guest misc
+device to allow userspace to get certain TDX guest specific details.
+
+2. API description
+==================
+
+In this section, for each supported IOCTL, following information is
+provided along with a generic description.
+
+:Input parameters: Parameters passed to the IOCTL and related details.
+:Output: Details about output data and return value (with details about the non
+         common error values).
+
+2.1 TDX_CMD_GET_REPORT
+----------------------
+
+:Input parameters: struct tdx_report_req
+:Output: Upon successful execution, TDREPORT data is copied to
+         tdx_report_req.tdreport and return 0. Return -EIO on
+         TDCALL failure or standard error number on other common
+         failures.
+
+The TDX_CMD_GET_REPORT IOCTL can be used by the attestation software to
+get the TDREPORT from the TDX module using TDCALL[TDG.MR.REPORT].
+
+Reference
+---------
+
+TDX reference material is collected here:
+
+https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html
+
+The driver is based on TDX module specification v1.0 and TDX GHCI specification v1.0.
Documentation/virt/index.rst +1 -0
index 2f1cffa87b1b..56e003ff28ff 100644
@@ -14,6 +14,7 @@ Linux Virtualization Support
    ne_overview
    acrn/index
    coco/sev-guest
+   coco/tdx-guest
    hyperv/index
 
 .. only:: html and subproject
Documentation/x86/tdx.rst +43 -0
index b8fa4329e1a5..014b769923a4 100644
@@ -210,6 +210,49 @@ converted to shared on boot.
 For coherent DMA allocation, the DMA buffer gets converted on the
 allocation. Check force_dma_unencrypted() for details.
 
+Attestation
+===========
+
+Attestation is used to verify the TDX guest trustworthiness to other
+entities before provisioning secrets to the guest. For example, a key
+server may want to use attestation to verify that the guest is the
+desired one before releasing the encryption keys to mount the encrypted
+rootfs or secondary drive.
+
+The TDX module records the state of the TDX guest in various stages of
+the guest boot process using build time measurement register (MRTD) and
+runtime measurement registers (RTMR). Measurements related to guest
+initial configuration and firmware image are recorded in the MRTD
+register. Measurements related to initial state, kernel image, firmware
+image, command line options, initrd, ACPI tables, etc are recorded in
+RTMR registers. For more details as an example, please refer to TDX
+Virtual Firmware design specification, sec titled "TD Measurement". At
+TDX guest runtime, the attestation process is used to attest to these
+measurements.
+
+The attestation process consists of two steps: TDREPORT generation and
+Quote generation.
+
+TDX guest uses TDCALL[TDG.MR.REPORT] to get the TDREPORT (TDREPORT_STRUCT)
+from the TDX module. TDREPORT is a fixed-size data structure generated by
+the TDX module which contains guest-specific information (such as build
+and boot measurements), platform security version, and the MAC to protect
+the integrity of the TDREPORT. A user-provided 64-Byte REPORTDATA is used
+as input and included in the TDREPORT. Typically it can be some nonce
+provided by attestation service so the TDREPORT can be verified uniquely.
+More details about the TDREPORT can be found in Intel TDX Module
+specification, section titled "TDG.MR.REPORT Leaf".
+
+After getting the TDREPORT, the second step of the attestation process
+is to send it to the Quoting Enclave (QE) to generate the Quote. TDREPORT
+by design can only be verified on the local platform as the MAC key is
+bound to the platform. To support remote verification of the TDREPORT,
+TDX leverages Intel SGX Quoting Enclave to verify the TDREPORT locally
+and convert it to a remotely verifiable Quote. Method of sending TDREPORT
+to QE is implementation specific. Attestation software can choose
+whatever communication channel available (i.e. vsock or TCP/IP) to
+send the TDREPORT to QE and receive the Quote.
+
 References
 ==========
 
arch/x86/include/asm/tdx.h +1 -0
index 34c00d8a5263..f710035a0bdb 100644
@@ -21,6 +21,7 @@
 /* TDX module Call Leaf IDs */
 #define TDX_GET_INFO			1
 #define TDX_GET_VEINFO			3
+#define TDX_GET_REPORT			4
 #define TDX_ACCEPT_PAGE			6
 
 #ifndef __ASSEMBLY__
drivers/virt/Kconfig +2 -0
index 87ef258cec64..f79ab13a5c28 100644
@@ -52,4 +52,6 @@ source "drivers/virt/coco/efi_secret/Kconfig"
 
 source "drivers/virt/coco/sev-guest/Kconfig"
 
+source "drivers/virt/coco/tdx-guest/Kconfig"
+
 endif
drivers/virt/Makefile +1 -0
index 093674e05c40..e9aa6fc96fab 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_NITRO_ENCLAVES)	+= nitro_enclaves/
 obj-$(CONFIG_ACRN_HSM)		+= acrn/
 obj-$(CONFIG_EFI_SECRET)	+= coco/efi_secret/
 obj-$(CONFIG_SEV_GUEST)		+= coco/sev-guest/
+obj-$(CONFIG_INTEL_TDX_GUEST)	+= coco/tdx-guest/
drivers/virt/coco/tdx-guest/Kconfig new file +10 -0
new file mode 100644
index 000000000000..14246fc2fb02
@@ -0,0 +1,10 @@
+config TDX_GUEST_DRIVER
+	tristate "TDX Guest driver"
+	depends on INTEL_TDX_GUEST
+	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.
drivers/virt/coco/tdx-guest/Makefile new file +2 -0
new file mode 100644
index 000000000000..4396ec319589
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.o
drivers/virt/coco/tdx-guest/tdx-guest.c new file +131 -0
new file mode 100644
index 000000000000..3a4aa5590963
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * TDX guest user interface driver
+ *
+ * Copyright (C) 2022 Intel Corporation
+ */
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/string.h>
+#include <linux/uaccess.h>
+
+#include <uapi/linux/tdx-guest.h>
+
+#include <asm/cpu_device_id.h>
+#include <asm/tdx.h>
+
+static long tdx_get_report(void __user *argp)
+{
+	u8 *reportdata, *tdreport;
+	struct tdx_report_req req;
+	long ret;
+
+	if (copy_from_user(&req, argp, sizeof(req)))
+		return -EFAULT;
+
+	/*
+	 * Per TDX Module 1.0 specification, section titled
+	 * "TDG.MR.REPORT", REPORTDATA length is fixed as
+	 * TDX_REPORTDATA_LEN, TDREPORT length is fixed as
+	 * TDX_REPORT_LEN, and TDREPORT subtype is fixed as 0.
+	 */
+	if (req.subtype || req.rpd_len != TDX_REPORTDATA_LEN ||
+	    req.tdr_len != TDX_REPORT_LEN)
+		return -EINVAL;
+
+	if (memchr_inv(req.reserved, 0, sizeof(req.reserved)))
+		return -EINVAL;
+
+	reportdata = kmalloc(req.rpd_len, GFP_KERNEL);
+	if (!reportdata)
+		return -ENOMEM;
+
+	tdreport = kzalloc(req.tdr_len, GFP_KERNEL);
+	if (!tdreport) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	if (copy_from_user(reportdata, u64_to_user_ptr(req.reportdata),
+			   req.rpd_len)) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	/*
+	 * Generate TDREPORT using "TDG.MR.REPORT" TDCALL.
+	 *
+	 * Get the TDREPORT using REPORTDATA as input. Refer to
+	 * section 22.3.3 TDG.MR.REPORT leaf in the TDX Module 1.0
+	 * Specification for detailed information.
+	 */
+	ret = __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),
+				virt_to_phys(reportdata), req.subtype,
+				0, NULL);
+	if (ret) {
+		ret = -EIO;
+		goto out;
+	}
+
+	if (copy_to_user(u64_to_user_ptr(req.tdreport), tdreport, req.tdr_len))
+		ret = -EFAULT;
+
+out:
+	kfree(reportdata);
+	kfree(tdreport);
+
+	return ret;
+}
+
+static long tdx_guest_ioctl(struct file *file, unsigned int cmd,
+			    unsigned long arg)
+{
+	switch (cmd) {
+	case TDX_CMD_GET_REPORT:
+		return tdx_get_report((void __user *)arg);
+	default:
+		return -ENOTTY;
+	}
+}
+
+static const struct file_operations tdx_guest_fops = {
+	.owner = THIS_MODULE,
+	.unlocked_ioctl = tdx_guest_ioctl,
+	.llseek = no_llseek,
+};
+
+static struct miscdevice tdx_misc_dev = {
+	.name = TDX_GUEST_DEVICE,
+	.minor = MISC_DYNAMIC_MINOR,
+	.fops = &tdx_guest_fops,
+};
+
+static int __init tdx_guest_init(void)
+{
+	if (!cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
+		return -ENODEV;
+
+	return misc_register(&tdx_misc_dev);
+}
+module_init(tdx_guest_init);
+
+static void __exit tdx_guest_exit(void)
+{
+	misc_deregister(&tdx_misc_dev);
+}
+module_exit(tdx_guest_exit);
+
+static const struct x86_cpu_id tdx_guest_ids[] = {
+	X86_MATCH_FEATURE(X86_FEATURE_TDX_GUEST, NULL),
+	{}
+};
+MODULE_DEVICE_TABLE(x86cpu, tdx_guest_ids);
+
+MODULE_AUTHOR("Kuppuswamy Sathyanarayanan <[email protected]>");
+MODULE_DESCRIPTION("TDX Guest Driver");
+MODULE_LICENSE("GPL");
include/uapi/linux/tdx-guest.h new file +0 -0
new file mode 100644
index 000000000000..8a3785eac3de

include/uapi/linux/tdx-guest.h line 8

Quoted 8 lines
include/uapi/linux/tdx-guest.h new file +8 -0
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_TDX_GUEST_H_
+#define _UAPI_LINUX_TDX_GUEST_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#define TDX_GUEST_DEVICE                "tdx-guest"

nit: I think now we can use KBUILD_MODNAME, can't we?

Quoted 49 lines
include/uapi/linux/tdx-guest.h new file +45 -0
+
+/* Length of the REPORTDATA used in TDG.MR.REPORT TDCALL */
+#define TDX_REPORTDATA_LEN              64
+
+/* Length of TDREPORT used in TDG.MR.REPORT TDCALL */
+#define TDX_REPORT_LEN                  1024
+
+/**
+ * struct tdx_report_req - Get TDREPORT using REPORTDATA as input.
+ *
+ * @reportdata: User-defined REPORTDATA to be included into TDREPORT.
+ *	Typically it can be some nonce provided by attestation service,
+ *	so the generated TDREPORT can be uniquely verified.
+ * @tdreport: TDREPORT output from TDCALL[TDG.MR.REPORT].
+ * @rpd_len: Length of the REPORTDATA (fixed as 64 bytes by the TDX
+ *	Module specification, but a parameter is added to handle future
+ *	extension).
+ * @tdr_len: Length of the TDREPORT (fixed as 1024 bytes by the TDX
+ *	Module specification, but a parameter is added to accommodate
+ *	future extension).
+ * @subtype: Subtype of TDREPORT (fixed as 0 by the TDX Module specification,
+ *	but added a parameter to handle future extension).
+ * @reserved: Reserved entries to handle future requirements. Should be
+ *	filled with zeroes.
+ *
+ * Used in TDX_CMD_GET_REPORT IOCTL request.
+ */
+struct tdx_report_req {
+	__u64 reportdata;
+	__u64 tdreport;
+	__u32 rpd_len;
+	__u32 tdr_len;
+	__u8 subtype;
+	__u8 reserved[7];
+};
+
+/*
+ * TDX_CMD_GET_REPORT - Get TDREPORT using TDCALL[TDG.MR.REPORT]
+ *
+ * Return 0 on success, -EIO on TDCALL execution failure, and
+ * standard errno on other general error cases.
+ */
+#define TDX_CMD_GET_REPORT              _IOWR('T', 1, struct tdx_report_req)
+
+#endif /* _UAPI_LINUX_TDX_GUEST_H_ */
Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 3 lines · Wander Lairson Costa
Quoted 1 line

+#define TDX_GUEST_DEVICE "tdx-guest"

nit: I think now we can use KBUILD_MODNAME, can't we?

Yes. We can use it. But I thought user can use this macro and avoid hard coding the device name.

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
#13 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 9 lines · Sathyanarayanan Kuppuswamy
Quoted 3 lines · Wander Lairson Costa
Quoted 1 line

+#define TDX_GUEST_DEVICE "tdx-guest"

nit: I think now we can use KBUILD_MODNAME, can't we?

Yes. We can use it. But I thought user can use this macro and avoid hard coding the device name.

What user? Please use KBUILD_MODNAME now instead.

thanks,

greg k-h

#14 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 4 lines · Greg Kroah-Hartman
Quoted 3 lines · Sathyanarayanan Kuppuswamy

On 9/29/22 11:02 AM, Wander Lairson Costa wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

+#define TDX_GUEST_DEVICE "tdx-guest"

nit: I think now we can use KBUILD_MODNAME, can't we?

Yes. We can use it. But I thought user can use this macro and avoid hard coding the device name.

What user? Please use KBUILD_MODNAME now instead.

Ok. I will change it.

Quoted 4 lines

thanks,

greg k-h

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
maintainer
#15 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

In reply to Kuppuswamy Sathyanarayanan
Quoted 10 lines · Kuppuswamy Sathyanarayanan
drivers/virt/coco/tdx-guest/tdx-guest.c new file +10 -0
+static long tdx_get_report(void __user *argp)
+{
+	u8 *reportdata, *tdreport;
+	struct tdx_report_req req;
+	long ret;
+
+	if (copy_from_user(&req, argp, sizeof(req)))
+		return -EFAULT;
+
+	/*

drivers/virt/coco/tdx-guest/tdx-guest.c line 41

Quoted 10 lines
drivers/virt/coco/tdx-guest/tdx-guest.c new file +10 -0
+	 * Per TDX Module 1.0 specification, section titled
+	 * "TDG.MR.REPORT", REPORTDATA length is fixed as
+	 * TDX_REPORTDATA_LEN, TDREPORT length is fixed as
+	 * TDX_REPORT_LEN, and TDREPORT subtype is fixed as 0.
+	 */
+	if (req.subtype || req.rpd_len != TDX_REPORTDATA_LEN ||
+	    req.tdr_len != TDX_REPORT_LEN)
+		return -EINVAL;
+
+	if (memchr_inv(req.reserved, 0, sizeof(req.reserved)))

I'm guessing we should issue something here to userspace to let it know why the it fails getting the report.

Otherwise it is starting to look good and boring. :)

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#16 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 16 lines · Borislav Petkov
Quoted 15 lines · Kuppuswamy Sathyanarayanan
drivers/virt/coco/tdx-guest/tdx-guest.c new file +15 -0
+static long tdx_get_report(void __user *argp)
+{
+	u8 *reportdata, *tdreport;
+	struct tdx_report_req req;
+	long ret;
+
+	if (copy_from_user(&req, argp, sizeof(req)))
+		return -EFAULT;
+
+	/*
+	 * Per TDX Module 1.0 specification, section titled
+	 * "TDG.MR.REPORT", REPORTDATA length is fixed as
+	 * TDX_REPORTDATA_LEN, TDREPORT length is fixed as
+	 * TDX_REPORT_LEN, and TDREPORT subtype is fixed as 0.
+	 */
Quoted 8 lines

drivers/virt/coco/tdx-guest/tdx-guest.c line 41

Quoted 5 lines
drivers/virt/coco/tdx-guest/tdx-guest.c new file +5 -0
+	if (req.subtype || req.rpd_len != TDX_REPORTDATA_LEN ||
+	    req.tdr_len != TDX_REPORT_LEN)
+		return -EINVAL;
+
+	if (memchr_inv(req.reserved, 0, sizeof(req.reserved)))

I'm guessing we should issue something here to userspace to let it know why the it fails getting the report.

I am fine with adding an error message here. What about the above -EINVAL case? Do you suggest adding it there as well?

Quoted 5 lines

Otherwise it is starting to look good and boring. :)

Thx.

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
maintainer
#17 lore raw

Re: [PATCH v14 2/3] virt: Add TDX guest driver

Quoted 2 lines · Sathyanarayanan Kuppuswamy

I am fine with adding an error message here. What about the above -EINVAL case? Do you suggest adding it there as well?

Right, you could dump the req.* fields it read from luserspace so that one staring at the error message can actually see which of the fields failed the check.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#18 lore raw

PATCH v14 3/3 selftests: tdx: Test TDX attestation GetReport support

In reply to Kuppuswamy Sathyanarayanan

Attestation is used to verify the trustworthiness of a TDX guest. During the guest bring-up, the Intel TDX module measures and records the initial contents and configuration of the guest, and at runtime, guest software uses runtime measurement registers (RMTRs) to measure and record details related to kernel image, command line params, ACPI tables, initrd, etc. At guest runtime, the attestation process is used to attest to these measurements.

The first step in the TDX attestation process is to get the TDREPORT data. It is a fixed size data structure generated by the TDX module which includes the above mentioned measurements data, a MAC ID to protect the integrity of the TDREPORT, and a 64-Byte of user specified data passed during TDREPORT request which can uniquely identify the TDREPORT.

Intel's TDX guest driver exposes TDX_CMD_GET_REPORT IOCTL interface to enable guest userspace to get the TDREPORT.

Add a kernel self test module to test this ABI and verify the validity of the generated TDREPORT.

---

Changes since v13:
* Removed __packed from TDREPORT structs.
* Since the guest driver is moved to drivers/virt/coco, removed tools/arch/x86/include header folder usage.
* Fixed struct comments to match kernel-doc format.
* Fixed commit log as per review comments.
* Fixed some format issues in the code.

Changes since v12:
* Changed #ifdef DEBUG usage with if (DEBUG).
* Initialized reserved entries values to zero.

Changes since v11:
* Renamed devname with TDX_GUEST_DEVNAME.

Changes since v10:
* Replaced TD/TD Guest usage with guest or TDX guest.
* Reworded the subject line.

Changes since v9:
* Copied arch/x86/include/uapi/asm/tdx.h to tools/arch/x86/include to decouple header dependency between kernel source and tools dir.
* Fixed Makefile to adapt to above change.
* Fixed commit log and comments.
* Added __packed to hardware structs.

Changes since v8:
* Please refer to https://lore.kernel.org/all/ \
20220728034420.648314-1-sathyanarayanan.kuppuswamy@linux.intel.com/

 tools/testing/selftests/Makefile             |   1 +
 tools/testing/selftests/tdx/Makefile         |   7 +
 tools/testing/selftests/tdx/config           |   1 +
 tools/testing/selftests/tdx/tdx_guest_test.c | 175 +++++++++++++++++++
 4 files changed, 184 insertions(+)
 create mode 100644 tools/testing/selftests/tdx/Makefile
 create mode 100644 tools/testing/selftests/tdx/config
 create mode 100644 tools/testing/selftests/tdx/tdx_guest_test.c
tools/testing/selftests/Makefile +1 -0
index 10b34bb03bc1..22bdb3d848f5 100644
@@ -70,6 +70,7 @@ TARGETS += sync
 TARGETS += syscall_user_dispatch
 TARGETS += sysctl
 TARGETS += tc-testing
+TARGETS += tdx
 TARGETS += timens
 ifneq (1, $(quicktest))
 TARGETS += timers
tools/testing/selftests/tdx/Makefile new file +7 -0
new file mode 100644
index 000000000000..8dd43517cd55
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+CFLAGS += -O3 -Wl,-no-as-needed -Wall -static
+
+TEST_GEN_PROGS := tdx_guest_test
+
+include ../lib.mk
tools/testing/selftests/tdx/config new file +1 -0
new file mode 100644
index 000000000000..aa1edc829ab6
@@ -0,0 +1 @@
+CONFIG_TDX_GUEST_DRIVER=y
tools/testing/selftests/tdx/tdx_guest_test.c new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.34.1