[PATCH v3 6/8] KVM: TDX: Document KVM_TDX_GET_QUOTE
From: Peter Fang
Date: Fri Dec 04 2026 - 13:22:02 EST
Document the KVM_TDX_GET_QUOTE command, which lets userspace request
DICE-based Quotes from the TDX module, without using a Quoting Enclave
on the host.
Signed-off-by: Peter Fang <peter.fang@xxxxxxxxx>
---
v3:
- New patch based on the redesigned Quote generation path.
---
Documentation/virt/kvm/api.rst | 21 ++++++-----
Documentation/virt/kvm/x86/intel-tdx.rst | 47 +++++++++++++++++++++++-
2 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index e95c9cda085d9..f6418e91aa3e4 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -7561,15 +7561,18 @@ inputs and outputs of the TDVMCALL. Currently the following values of
``nr`` are defined:
* ``TDVMCALL_GET_QUOTE``: the guest has requested to generate a TD-Quote
- signed by a service hosting TD-Quoting Enclave operating on the host.
- Parameters and return value are in the ``get_quote`` field of the union.
- The ``gpa`` field and ``size`` specify the guest physical address
- (without the shared bit set) and the size of a shared-memory buffer, in
- which the TDX guest passes a TD Report. The ``ret`` field represents
- the return value of the GetQuote request. When the request has been
- queued successfully, the TDX guest can poll the status field in the
- shared-memory area to check whether the Quote generation is completed or
- not. When completed, the generated Quote is returned via the same buffer.
+ from a TD Report, signed by a certified attestation key. Userspace can
+ get it from a TD-Quoting Enclave on the host. Or, if the TDX module
+ supports quoting, the ``KVM_TDX_GET_QUOTE`` command can generate a
+ DICE-based Quote. Parameters and return value are in the ``get_quote``
+ field of the union. The ``gpa`` field and ``size`` specify the guest
+ physical address (without the shared bit set) and the size of a
+ shared-memory buffer, in which the TDX guest passes a TD Report. The
+ ``ret`` field represents the return value of the GetQuote request. When
+ the request has been queued successfully, the TDX guest can poll the
+ status field in the shared-memory area to check whether the Quote
+ generation is completed or not. When completed, the generated Quote is
+ returned via the same buffer.
* ``TDVMCALL_GET_TD_VM_CALL_INFO``: the guest has requested the support
status of TDVMCALLs. The output values for the given leaf should be
diff --git a/Documentation/virt/kvm/x86/intel-tdx.rst b/Documentation/virt/kvm/x86/intel-tdx.rst
index d8d9409120e61..1bd95f6df49d6 100644
--- a/Documentation/virt/kvm/x86/intel-tdx.rst
+++ b/Documentation/virt/kvm/x86/intel-tdx.rst
@@ -38,6 +38,7 @@ ioctl with TDX specific sub-ioctl() commands.
KVM_TDX_INIT_MEM_REGION,
KVM_TDX_FINALIZE_VM,
KVM_TDX_GET_CPUID,
+ KVM_TDX_GET_QUOTE,
KVM_TDX_CMD_NR_MAX,
};
@@ -92,7 +93,12 @@ to be configured to the TDX guest.
__u64 kernel_tdvmcallinfo_1_r12;
__u64 user_tdvmcallinfo_1_r12;
- __u64 reserved[250];
+ /* Maximum size of a Quote for KVM_TDX_GET_QUOTE, or 0 if quoting isn't
+ * available
+ */
+ __u64 quote_max_size;
+
+ __u64 reserved[249];
/* Configurable CPUID bits for userspace */
struct kvm_cpuid2 cpuid;
@@ -197,6 +203,45 @@ Complete measurement of the initial TD contents and mark it ready to run.
- hw_error: must be 0
+KVM_TDX_GET_QUOTE
+-----------------
+:Type: vm ioctl
+:Returns: 0 on success, <0 on error
+
+Generate a DICE-based Quote from a TD Report. @report_uaddr points to the
+TD Report, and @report_size is its size. @quote_buf_uaddr points to the
+buffer for the Quote, and @quote_buf_size is its size. On success, KVM
+writes the Quote to the buffer, and the size of the Quote to @quote_size.
+This needs to be called after KVM_TDX_FINALIZE_VM succeeds.
+
+@report_uaddr and @quote_buf_uaddr must be page-aligned, and @report_size
+must not exceed the size of a page. @quote_buf_size must be at least the
+quote_max_size reported by KVM_TDX_CAPABILITIES.
+
+When TDs are oversubscribed, i.e. when there are more TDs than logical
+CPUs, KVM returns -EBUSY if there are as many Quote requests in progress
+as logical CPUs, and userspace can retry later. KVM never returns -EBUSY
+when TDs aren't oversubscribed.
+
+- id: KVM_TDX_GET_QUOTE
+- flags: must be 0
+- data: pointer to struct kvm_tdx_get_quote (in/out)
+- hw_error: must be 0 (out)
+
+::
+
+ struct kvm_tdx_get_quote {
+ __u64 report_uaddr;
+ __u64 report_size;
+
+ __u64 quote_buf_uaddr;
+ __u64 quote_buf_size;
+ __u64 quote_size;
+
+ __u64 reserved[27];
+ };
+
+
KVM_TDX_GET_CPUID
-----------------
:Type: vcpu ioctl
--
2.53.0