@@ -6645,7 +6645,8 @@ to the byte array.
66456645.. note ::
66466646
66476647 For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR, KVM_EXIT_XEN,
6648- KVM_EXIT_EPR, KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding
6648+ KVM_EXIT_EPR, KVM_EXIT_HYPERCALL, KVM_EXIT_TDX,
6649+ KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR the corresponding
66496650 operations are complete (and guest state is consistent) only after userspace
66506651 has re-entered the kernel with KVM_RUN. The kernel side will first finish
66516652 incomplete operations and then check for pending signals.
@@ -7174,6 +7175,62 @@ The valid value for 'flags' is:
71747175 - KVM_NOTIFY_CONTEXT_INVALID -- the VM context is corrupted and not valid
71757176 in VMCS. It would run into unknown result if resume the target VM.
71767177
7178+ ::
7179+
7180+ /* KVM_EXIT_TDX */
7181+ struct {
7182+ __u64 flags;
7183+ __u64 nr;
7184+ union {
7185+ struct {
7186+ u64 ret;
7187+ u64 data[5];
7188+ } unknown;
7189+ struct {
7190+ u64 ret;
7191+ u64 gpa;
7192+ u64 size;
7193+ } get_quote;
7194+ struct {
7195+ u64 ret;
7196+ u64 leaf;
7197+ u64 r11, r12, r13, r14;
7198+ } get_tdvmcall_info;
7199+ };
7200+ } tdx;
7201+
7202+ Process a TDVMCALL from the guest. KVM forwards select TDVMCALL based
7203+ on the Guest-Hypervisor Communication Interface (GHCI) specification;
7204+ KVM bridges these requests to the userspace VMM with minimal changes,
7205+ placing the inputs in the union and copying them back to the guest
7206+ on re-entry.
7207+
7208+ Flags are currently always zero, whereas ``nr `` contains the TDVMCALL
7209+ number from register R11. The remaining field of the union provide the
7210+ inputs and outputs of the TDVMCALL. Currently the following values of
7211+ ``nr `` are defined:
7212+
7213+ * ``TDVMCALL_GET_QUOTE ``: the guest has requested to generate a TD-Quote
7214+ signed by a service hosting TD-Quoting Enclave operating on the host.
7215+ Parameters and return value are in the ``get_quote `` field of the union.
7216+ The ``gpa `` field and ``size `` specify the guest physical address
7217+ (without the shared bit set) and the size of a shared-memory buffer, in
7218+ which the TDX guest passes a TD Report. The ``ret `` field represents
7219+ the return value of the GetQuote request. When the request has been
7220+ queued successfully, the TDX guest can poll the status field in the
7221+ shared-memory area to check whether the Quote generation is completed or
7222+ not. When completed, the generated Quote is returned via the same buffer.
7223+
7224+ * ``TDVMCALL_GET_TD_VM_CALL_INFO ``: the guest has requested the support
7225+ status of TDVMCALLs. The output values for the given leaf should be
7226+ placed in fields from ``r11 `` to ``r14 `` of the ``get_tdvmcall_info ``
7227+ field of the union.
7228+
7229+ KVM may add support for more values in the future that may cause a userspace
7230+ exit, even without calls to ``KVM_ENABLE_CAP `` or similar. In this case,
7231+ it will enter with output fields already valid; in the common case, the
7232+ ``unknown.ret `` field of the union will be ``TDVMCALL_STATUS_SUBFUNC_UNSUPPORTED ``.
7233+ Userspace need not do anything if it does not wish to support a TDVMCALL.
71777234::
71787235
71797236 /* Fix the size of the union. */
0 commit comments