The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Fang <peter.fang@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	"Sean Christopherson" <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
	<linux-coco@lists.linux.dev>, <kvm@vger.kernel.org>,
	Xu Yilun <yilun.xu@linux.intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Tony Lindgren <tony.lindgren@linux.intel.com>,
	Chao Gao <chao.gao@intel.com>, Xiaoyao Li <xiaoyao.li@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	Sohil Mehta <sohil.mehta@intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Kishen Maloor" <kishen.maloor@intel.com>,
	Nikolay Borisov <nik.borisov@suse.com>,
	Elena Reshetova <elena.reshetova@intel.com>,
	Peter Fang <peter.fang@intel.com>
Subject: [PATCH v3 6/8] KVM: TDX: Document KVM_TDX_GET_QUOTE
Date: Fri,  4 Dec 2026 10:18:27 -0800	[thread overview]
Message-ID: <20261204182022.324230-7-peter.fang@intel.com> (raw)
In-Reply-To: <20261204182022.324230-1-peter.fang@intel.com>

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@intel.com>
---
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


  parent reply	other threads:[~2026-12-04 18:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 18:18 [PATCH v3 0/8] Enable DICE-based TDX quoting Peter Fang
2026-12-04 18:18 ` [PATCH v3 1/8] x86/virt/tdx: Add interface to generate a Quote Peter Fang
2026-12-04 19:15   ` Dave Hansen
2026-12-04 18:18 ` [PATCH v3 2/8] x86/virt/tdx: Add interface to check quoting capabilities Peter Fang
2026-12-04 18:18 ` [PATCH v3 3/8] KVM: TDX: Require at least one quoting session and thread per CPU Peter Fang
2026-12-04 18:18 ` [PATCH v3 4/8] KVM: TDX: Add KVM_TDX_GET_QUOTE sub-ioctl for quoting Peter Fang
2026-12-04 18:18 ` [PATCH v3 5/8] KVM: TDX: Report maximum Quote size in TDX capabilities Peter Fang
2026-12-04 18:18 ` Peter Fang [this message]
2026-12-04 18:18 ` [PATCH v3 7/8] x86/virt/tdx: Enable the quoting extension Peter Fang
2026-12-04 18:18 ` [PATCH v3 8/8] x86/virt/tdx: Add documentation for DICE-based quoting Peter Fang
2026-12-04 18:40 ` [PATCH v3 0/8] Enable DICE-based TDX quoting Jason Gunthorpe
2026-12-04 18:47   ` Edgecombe, Rick P
2026-12-04 18:50     ` Jason Gunthorpe
2026-12-04 19:11       ` Edgecombe, Rick P

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=20261204182022.324230-7-peter.fang@intel.com \
    --to=peter.fang@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=elena.reshetova@intel.com \
    --cc=hpa@zytor.com \
    --cc=jgg@nvidia.com \
    --cc=kas@kernel.org \
    --cc=kishen.maloor@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nik.borisov@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@kernel.org \
    --cc=tony.lindgren@linux.intel.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    --cc=yilun.xu@linux.intel.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