sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget*/translations/zh_CN/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/zh_TW/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/it_IT/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ja_JP/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ko_KR/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/pt_BR/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/sp_SP/virt/kvm/x86/intel-tdxmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhD/var/lib/git/docbuild/linux/Documentation/virt/kvm/x86/intel-tdx.rsthKubhsection)}(hhh](htitle)}(h#Intel Trust Domain Extensions (TDX)h]h#Intel Trust Domain Extensions (TDX)}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXIntel's Trust Domain Extensions (TDX) protect confidential guest VMs from the host and physical attacks. A CPU-attested software module called 'the TDX module' runs inside a new CPU isolated range to provide the functionalities to manage and run protected VMs, a.k.a, TDX guests or TDs.h]hX%Intel’s Trust Domain Extensions (TDX) protect confidential guest VMs from the host and physical attacks. A CPU-attested software module called ‘the TDX module’ runs inside a new CPU isolated range to provide the functionalities to manage and run protected VMs, a.k.a, TDX guests or TDs.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hKPlease refer to [1] for the whitepaper, specifications and other resources.h]hKPlease refer to [1] for the whitepaper, specifications and other resources.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThis documentation describes TDX-specific KVM ABIs. The TDX module needs to be initialized before it can be used by KVM to run any TDX guests. The host core-kernel provides the support of initializing the TDX module, which is described in the Documentation/arch/x86/tdx.rst.h]hXThis documentation describes TDX-specific KVM ABIs. The TDX module needs to be initialized before it can be used by KVM to run any TDX guests. The host core-kernel provides the support of initializing the TDX module, which is described in the Documentation/arch/x86/tdx.rst.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hAPI descriptionh]hAPI description}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"hhhhhKubh)}(hhh](h)}(hKVM_MEMORY_ENCRYPT_OPh]hKVM_MEMORY_ENCRYPT_OP}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hhhhhKubh field_list)}(hhh]hfield)}(hhh](h field_name)}(hTypeh]hType}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjKhhhKubh field_body)}(hvm ioctl, vcpu ioctl h]h)}(hvm ioctl, vcpu ioctlh]hvm ioctl, vcpu ioctl}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj`ubah}(h]h ]h"]h$]h&]uh1j^hjKubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjFhhubah}(h]h ]h"]h$]h&]uh1jDhj3hhhhhKubh)}(htFor TDX operations, KVM_MEMORY_ENCRYPT_OP is re-purposed to be generic ioctl with TDX specific sub-ioctl() commands.h]htFor TDX operations, KVM_MEMORY_ENCRYPT_OP is re-purposed to be generic ioctl with TDX specific sub-ioctl() commands.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj3hhubh literal_block)}(hX,/* Trust Domain Extensions sub-ioctl() commands. */ enum kvm_tdx_cmd_id { KVM_TDX_CAPABILITIES = 0, KVM_TDX_INIT_VM, KVM_TDX_INIT_VCPU, KVM_TDX_INIT_MEM_REGION, KVM_TDX_FINALIZE_VM, KVM_TDX_GET_CPUID, KVM_TDX_CMD_NR_MAX, }; struct kvm_tdx_cmd { /* enum kvm_tdx_cmd_id */ __u32 id; /* flags for sub-command. If sub-command doesn't use this, set zero. */ __u32 flags; /* * data for each sub-command. An immediate or a pointer to the actual * data in process virtual address. If sub-command doesn't use it, * set zero. */ __u64 data; /* * Auxiliary error code. The sub-command may return TDX SEAMCALL * status code in addition to -Exxx. */ __u64 hw_error; };h]hX,/* Trust Domain Extensions sub-ioctl() commands. */ enum kvm_tdx_cmd_id { KVM_TDX_CAPABILITIES = 0, KVM_TDX_INIT_VM, KVM_TDX_INIT_VCPU, KVM_TDX_INIT_MEM_REGION, KVM_TDX_FINALIZE_VM, KVM_TDX_GET_CPUID, KVM_TDX_CMD_NR_MAX, }; struct kvm_tdx_cmd { /* enum kvm_tdx_cmd_id */ __u32 id; /* flags for sub-command. If sub-command doesn't use this, set zero. */ __u32 flags; /* * data for each sub-command. An immediate or a pointer to the actual * data in process virtual address. If sub-command doesn't use it, * set zero. */ __u64 data; /* * Auxiliary error code. The sub-command may return TDX SEAMCALL * status code in addition to -Exxx. */ __u64 hw_error; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK!hj3hhubeh}(h]kvm-memory-encrypt-opah ]h"]kvm_memory_encrypt_opah$]h&]uh1hhj"hhhhhKubh)}(hhh](h)}(hKVM_TDX_CAPABILITIESh]hKVM_TDX_CAPABILITIES}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK@ubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(hvm ioctlh]h)}(hjh]hvm ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKAhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKBhjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKAubh)}(hReturn the TDX capabilities that current KVM supports with the specific TDX module loaded in the system. It reports what features/capabilities are allowed to be configured to the TDX guest.h]hReturn the TDX capabilities that current KVM supports with the specific TDX module loaded in the system. It reports what features/capabilities are allowed to be configured to the TDX guest.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjhhubh bullet_list)}(hhh](h list_item)}(hid: KVM_TDX_CAPABILITIESh]h)}(hj8h]hid: KVM_TDX_CAPABILITIES}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhj6ubah}(h]h ]h"]h$]h&]uh1j4hj1hhhhhNubj5)}(hflags: must be 0h]h)}(hjOh]hflags: must be 0}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjMubah}(h]h ]h"]h$]h&]uh1j4hj1hhhhhNubj5)}(h,data: pointer to struct kvm_tdx_capabilitiesh]h)}(hjfh]h,data: pointer to struct kvm_tdx_capabilities}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjdubah}(h]h ]h"]h$]h&]uh1j4hj1hhhhhNubj5)}(hhw_error: must be 0 h]h)}(hhw_error: must be 0h]hhw_error: must be 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhj{ubah}(h]h ]h"]h$]h&]uh1j4hj1hhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1j/hhhKHhjhhubj)}(hX\struct kvm_tdx_capabilities { __u64 supported_attrs; __u64 supported_xfam; /* TDG.VP.VMCALL hypercalls executed in kernel and forwarded to * userspace, respectively */ __u64 kernel_tdvmcallinfo_1_r11; __u64 user_tdvmcallinfo_1_r11; /* TDG.VP.VMCALL instruction executions subfunctions executed in kernel * and forwarded to userspace, respectively */ __u64 kernel_tdvmcallinfo_1_r12; __u64 user_tdvmcallinfo_1_r12; __u64 reserved[250]; /* Configurable CPUID bits for userspace */ struct kvm_cpuid2 cpuid; };h]hX\struct kvm_tdx_capabilities { __u64 supported_attrs; __u64 supported_xfam; /* TDG.VP.VMCALL hypercalls executed in kernel and forwarded to * userspace, respectively */ __u64 kernel_tdvmcallinfo_1_r11; __u64 user_tdvmcallinfo_1_r11; /* TDG.VP.VMCALL instruction executions subfunctions executed in kernel * and forwarded to userspace, respectively */ __u64 kernel_tdvmcallinfo_1_r12; __u64 user_tdvmcallinfo_1_r12; __u64 reserved[250]; /* Configurable CPUID bits for userspace */ struct kvm_cpuid2 cpuid; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKOhjhhubeh}(h]kvm-tdx-capabilitiesah ]h"]kvm_tdx_capabilitiesah$]h&]uh1hhj"hhhhhK@ubh)}(hhh](h)}(hKVM_TDX_INIT_VMh]hKVM_TDX_INIT_VM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKgubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(hvm ioctlh]h)}(hjh]hvm ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKihjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKhubh)}(hsPerform TDX specific VM initialization. This needs to be called after KVM_CREATE_VM and before creating any VCPUs.h]hsPerform TDX specific VM initialization. This needs to be called after KVM_CREATE_VM and before creating any VCPUs.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjhhubj0)}(hhh](j5)}(hid: KVM_TDX_INIT_VMh]h)}(hj;h]hid: KVM_TDX_INIT_VM}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhj9ubah}(h]h ]h"]h$]h&]uh1j4hj6hhhhhNubj5)}(hflags: must be 0h]h)}(hjRh]hflags: must be 0}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjPubah}(h]h ]h"]h$]h&]uh1j4hj6hhhhhNubj5)}(h'data: pointer to struct kvm_tdx_init_vmh]h)}(hjih]h'data: pointer to struct kvm_tdx_init_vm}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKphjgubah}(h]h ]h"]h$]h&]uh1j4hj6hhhhhNubj5)}(hhw_error: must be 0 h]h)}(hhw_error: must be 0h]hhw_error: must be 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhj~ubah}(h]h ]h"]h$]h&]uh1j4hj6hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKnhjhhubj)}(hXstruct kvm_tdx_init_vm { __u64 attributes; __u64 xfam; __u64 mrconfigid[6]; /* sha384 digest */ __u64 mrowner[6]; /* sha384 digest */ __u64 mrownerconfig[6]; /* sha384 digest */ /* The total space for TD_PARAMS before the CPUIDs is 256 bytes */ __u64 reserved[12]; /* * Call KVM_TDX_INIT_VM before vcpu creation, thus before * KVM_SET_CPUID2. * This configuration supersedes KVM_SET_CPUID2s for VCPUs because the * TDX module directly virtualizes those CPUIDs without VMM. The user * space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with * those values. If it doesn't, KVM may have wrong idea of vCPUIDs of * the guest, and KVM may wrongly emulate CPUIDs or MSRs that the TDX * module doesn't virtualize. */ struct kvm_cpuid2 cpuid; };h]hXstruct kvm_tdx_init_vm { __u64 attributes; __u64 xfam; __u64 mrconfigid[6]; /* sha384 digest */ __u64 mrowner[6]; /* sha384 digest */ __u64 mrownerconfig[6]; /* sha384 digest */ /* The total space for TD_PARAMS before the CPUIDs is 256 bytes */ __u64 reserved[12]; /* * Call KVM_TDX_INIT_VM before vcpu creation, thus before * KVM_SET_CPUID2. * This configuration supersedes KVM_SET_CPUID2s for VCPUs because the * TDX module directly virtualizes those CPUIDs without VMM. The user * space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with * those values. If it doesn't, KVM may have wrong idea of vCPUIDs of * the guest, and KVM may wrongly emulate CPUIDs or MSRs that the TDX * module doesn't virtualize. */ struct kvm_cpuid2 cpuid; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKuhjhhubeh}(h]kvm-tdx-init-vmah ]h"]kvm_tdx_init_vmah$]h&]uh1hhj"hhhhhKgubh)}(hhh](h)}(hKVM_TDX_INIT_VCPUh]hKVM_TDX_INIT_VCPU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h vcpu ioctlh]h)}(hjh]h vcpu ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKubh)}(h)Perform TDX specific VCPU initialization.h]h)Perform TDX specific VCPU initialization.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj0)}(hhh](j5)}(hid: KVM_TDX_INIT_VCPUh]h)}(hj<h]hid: KVM_TDX_INIT_VCPU}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:ubah}(h]h ]h"]h$]h&]uh1j4hj7hhhhhNubj5)}(hflags: must be 0h]h)}(hjSh]hflags: must be 0}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjQubah}(h]h ]h"]h$]h&]uh1j4hj7hhhhhNubj5)}(h,data: initial value of the guest TD VCPU RCXh]h)}(hjjh]h,data: initial value of the guest TD VCPU RCX}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhubah}(h]h ]h"]h$]h&]uh1j4hj7hhhhhNubj5)}(hhw_error: must be 0 h]h)}(hhw_error: must be 0h]hhw_error: must be 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hj7hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjhhubeh}(h]kvm-tdx-init-vcpuah ]h"]kvm_tdx_init_vcpuah$]h&]uh1hhj"hhhhhKubh)}(hhh](h)}(hKVM_TDX_INIT_MEM_REGIONh]hKVM_TDX_INIT_MEM_REGION}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h vcpu ioctlh]h)}(hjh]h vcpu ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKubh)}(hInitialize @nr_pages TDX guest private memory starting from @gpa with userspace provided data from @source_addr. @source_addr must be PAGE_SIZE-aligned.h]hInitialize @nr_pages TDX guest private memory starting from @gpa with userspace provided data from @source_addr. @source_addr must be PAGE_SIZE-aligned.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hNote, before calling this sub command, memory attribute of the range [gpa, gpa + nr_pages] needs to be private. Userspace can use KVM_SET_MEMORY_ATTRIBUTES to set the attribute.h]hNote, before calling this sub command, memory attribute of the range [gpa, gpa + nr_pages] needs to be private. Userspace can use KVM_SET_MEMORY_ATTRIBUTES to set the attribute.}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hPIf KVM_TDX_MEASURE_MEMORY_REGION flag is specified, it also extends measurement.h]hPIf KVM_TDX_MEASURE_MEMORY_REGION flag is specified, it also extends measurement.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj0)}(hhh](j5)}(hid: KVM_TDX_INIT_MEM_REGIONh]h)}(hjKh]hid: KVM_TDX_INIT_MEM_REGION}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjIubah}(h]h ]h"]h$]h&]uh1j4hjFhhhhhNubj5)}(h>flags: currently only KVM_TDX_MEASURE_MEMORY_REGION is definedh]h)}(hjbh]h>flags: currently only KVM_TDX_MEASURE_MEMORY_REGION is defined}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj`ubah}(h]h ]h"]h$]h&]uh1j4hjFhhhhhNubj5)}(h/data: pointer to struct kvm_tdx_init_mem_regionh]h)}(hjyh]h/data: pointer to struct kvm_tdx_init_mem_region}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwubah}(h]h ]h"]h$]h&]uh1j4hjFhhhhhNubj5)}(hhw_error: must be 0 h]h)}(hhw_error: must be 0h]hhw_error: must be 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjFhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjhhubj)}(h#define KVM_TDX_MEASURE_MEMORY_REGION (1UL << 0) struct kvm_tdx_init_mem_region { __u64 source_addr; __u64 gpa; __u64 nr_pages; };h]h#define KVM_TDX_MEASURE_MEMORY_REGION (1UL << 0) struct kvm_tdx_init_mem_region { __u64 source_addr; __u64 gpa; __u64 nr_pages; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h]kvm-tdx-init-mem-regionah ]h"]kvm_tdx_init_mem_regionah$]h&]uh1hhj"hhhhhKubh)}(hhh](h)}(hKVM_TDX_FINALIZE_VMh]hKVM_TDX_FINALIZE_VM}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(hvm ioctlh]h)}(hjh]hvm ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKubh)}(hIComplete measurement of the initial TD contents and mark it ready to run.h]hIComplete measurement of the initial TD contents and mark it ready to run.}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj0)}(hhh](j5)}(hid: KVM_TDX_FINALIZE_VMh]h)}(hjLh]hid: KVM_TDX_FINALIZE_VM}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjJubah}(h]h ]h"]h$]h&]uh1j4hjGhhhhhNubj5)}(hflags: must be 0h]h)}(hjch]hflags: must be 0}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjaubah}(h]h ]h"]h$]h&]uh1j4hjGhhhhhNubj5)}(hdata: must be 0h]h)}(hjzh]hdata: must be 0}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjxubah}(h]h ]h"]h$]h&]uh1j4hjGhhhhhNubj5)}(hhw_error: must be 0 h]h)}(hhw_error: must be 0h]hhw_error: must be 0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjGhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjhhubeh}(h]kvm-tdx-finalize-vmah ]h"]kvm_tdx_finalize_vmah$]h&]uh1hhj"hhhhhKubh)}(hhh](h)}(hKVM_TDX_GET_CPUIDh]hKVM_TDX_GET_CPUID}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjE)}(hhh](jJ)}(hhh](jO)}(hTypeh]hType}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h vcpu ioctlh]h)}(hjh]h vcpu ioctl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubjJ)}(hhh](jO)}(hReturnsh]hReturns}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jNhjhhhKubj_)}(h0 on success, <0 on error h]h)}(h0 on success, <0 on errorh]h0 on success, <0 on error}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1jIhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jDhjhhhhhKubh)}(hGet the CPUID values that the TDX module virtualizes for the TD guest. When it returns -E2BIG, the user space should allocate a larger buffer and retry. The minimum buffer size is updated in the nent field of the struct kvm_cpuid2.h]hGet the CPUID values that the TDX module virtualizes for the TD guest. When it returns -E2BIG, the user space should allocate a larger buffer and retry. The minimum buffer size is updated in the nent field of the struct kvm_cpuid2.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj0)}(hhh](j5)}(hid: KVM_TDX_GET_CPUIDh]h)}(hj?h]hid: KVM_TDX_GET_CPUID}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj=ubah}(h]h ]h"]h$]h&]uh1j4hj:hhhhhNubj5)}(hflags: must be 0h]h)}(hjVh]hflags: must be 0}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjTubah}(h]h ]h"]h$]h&]uh1j4hj:hhhhhNubj5)}(h+data: pointer to struct kvm_cpuid2 (in/out)h]h)}(hjmh]h+data: pointer to struct kvm_cpuid2 (in/out)}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjkubah}(h]h ]h"]h$]h&]uh1j4hj:hhhhhNubj5)}(hhw_error: must be 0 (out) h]h)}(hhw_error: must be 0 (out)h]hhw_error: must be 0 (out)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hj:hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjhhubj)}(hX3struct kvm_cpuid2 { __u32 nent; __u32 padding; struct kvm_cpuid_entry2 entries[0]; }; struct kvm_cpuid_entry2 { __u32 function; __u32 index; __u32 flags; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding[3]; };h]hX3struct kvm_cpuid2 { __u32 nent; __u32 padding; struct kvm_cpuid_entry2 entries[0]; }; struct kvm_cpuid_entry2 { __u32 function; __u32 index; __u32 flags; __u32 eax; __u32 ebx; __u32 ecx; __u32 edx; __u32 padding[3]; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h]kvm-tdx-get-cpuidah ]h"]kvm_tdx_get_cpuidah$]h&]uh1hhj"hhhhhKubeh}(h]api-descriptionah ]h"]api descriptionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hKVM TDX creation flowh]hKVM TDX creation flow}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hhIn addition to the standard KVM flow, new TDX ioctls need to be called. The control flow is as follows:h]hhIn addition to the standard KVM flow, new TDX ioctls need to be called. The control flow is as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhenumerated_list)}(hhh](j5)}(hvCheck system wide capability * KVM_CAP_VM_TYPES: Check if VM type is supported and if KVM_X86_TDX_VM is supported. h](h)}(hCheck system wide capabilityh]hCheck system wide capability}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj0)}(hhh]j5)}(hTKVM_CAP_VM_TYPES: Check if VM type is supported and if KVM_X86_TDX_VM is supported. h]h)}(hSKVM_CAP_VM_TYPES: Check if VM type is supported and if KVM_X86_TDX_VM is supported.h]hSKVM_CAP_VM_TYPES: Check if VM type is supported and if KVM_X86_TDX_VM is supported.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjubah}(h]h ]h"]h$]h&]j*uh1j/hhhKhjubeh}(h]h ]h"]h$]h&]uh1j4hjhhhNhNubj5)}(hXCreate VM * KVM_CREATE_VM * KVM_TDX_CAPABILITIES: Query TDX capabilities for creating TDX guests. * KVM_CHECK_EXTENSION(KVM_CAP_MAX_VCPUS): Query maximum VCPUs the TD can support at VM level (TDX has its own limitation on this). * KVM_SET_TSC_KHZ: Configure TD's TSC frequency if a different TSC frequency than host is desired. This is Optional. * KVM_TDX_INIT_VM: Pass TDX specific VM parameters. h](h)}(h Create VMh]h Create VM}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj0)}(hhh](j5)}(h KVM_CREATE_VMh]h)}(hj3h]h KVM_CREATE_VM}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1ubah}(h]h ]h"]h$]h&]uh1j4hj.ubj5)}(hEKVM_TDX_CAPABILITIES: Query TDX capabilities for creating TDX guests.h]h)}(hjJh]hEKVM_TDX_CAPABILITIES: Query TDX capabilities for creating TDX guests.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjHubah}(h]h ]h"]h$]h&]uh1j4hj.ubj5)}(hKVM_CHECK_EXTENSION(KVM_CAP_MAX_VCPUS): Query maximum VCPUs the TD can support at VM level (TDX has its own limitation on this).h]h)}(hKVM_CHECK_EXTENSION(KVM_CAP_MAX_VCPUS): Query maximum VCPUs the TD can support at VM level (TDX has its own limitation on this).h]hKVM_CHECK_EXTENSION(KVM_CAP_MAX_VCPUS): Query maximum VCPUs the TD can support at VM level (TDX has its own limitation on this).}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj_ubah}(h]h ]h"]h$]h&]uh1j4hj.ubj5)}(hsKVM_SET_TSC_KHZ: Configure TD's TSC frequency if a different TSC frequency than host is desired. This is Optional.h]h)}(hsKVM_SET_TSC_KHZ: Configure TD's TSC frequency if a different TSC frequency than host is desired. This is Optional.h]huKVM_SET_TSC_KHZ: Configure TD’s TSC frequency if a different TSC frequency than host is desired. This is Optional.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwubah}(h]h ]h"]h$]h&]uh1j4hj.ubj5)}(h2KVM_TDX_INIT_VM: Pass TDX specific VM parameters. h]h)}(h1KVM_TDX_INIT_VM: Pass TDX specific VM parameters.h]h1KVM_TDX_INIT_VM: Pass TDX specific VM parameters.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hj.ubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjubeh}(h]h ]h"]h$]h&]uh1j4hjhhhNhNubj5)}(hCreate VCPU * KVM_CREATE_VCPU * KVM_TDX_INIT_VCPU: Pass TDX specific VCPU parameters. * KVM_SET_CPUID2: Configure TD's CPUIDs. * KVM_SET_MSRS: Configure TD's MSRs. h](h)}(h Create VCPUh]h Create VCPU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj0)}(hhh](j5)}(hKVM_CREATE_VCPUh]h)}(hjh]hKVM_CREATE_VCPU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjubj5)}(h5KVM_TDX_INIT_VCPU: Pass TDX specific VCPU parameters.h]h)}(hjh]h5KVM_TDX_INIT_VCPU: Pass TDX specific VCPU parameters.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjubj5)}(h&KVM_SET_CPUID2: Configure TD's CPUIDs.h]h)}(hjh]h(KVM_SET_CPUID2: Configure TD’s CPUIDs.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j4hjubj5)}(h#KVM_SET_MSRS: Configure TD's MSRs. h]h)}(h"KVM_SET_MSRS: Configure TD's MSRs.h]h$KVM_SET_MSRS: Configure TD’s MSRs.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1j4hjubeh}(h]h ]h"]h$]h&]jjuh1j/hhhKhjubeh}(h]h ]h"]h$]h&]uh1j4hjhhhNhNubj5)}(hInitialize initial guest memory * Prepare content of initial guest memory. * KVM_TDX_INIT_MEM_REGION: Add initial guest memory. * KVM_TDX_FINALIZE_VM: Finalize the measurement of the TDX guest. h](h)}(hInitialize initial guest memoryh]hInitialize initial guest memory}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj1 ubj0)}(hhh](j5)}(h(Prepare content of initial guest memory.h]h)}(hjH h]h(Prepare content of initial guest memory.}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjF ubah}(h]h ]h"]h$]h&]uh1j4hjC ubj5)}(h2KVM_TDX_INIT_MEM_REGION: Add initial guest memory.h]h)}(hj_ h]h2KVM_TDX_INIT_MEM_REGION: Add initial guest memory.}(hja hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj] ubah}(h]h ]h"]h$]h&]uh1j4hjC ubj5)}(h@KVM_TDX_FINALIZE_VM: Finalize the measurement of the TDX guest. h]h)}(h?KVM_TDX_FINALIZE_VM: Finalize the measurement of the TDX guest.h]h?KVM_TDX_FINALIZE_VM: Finalize the measurement of the TDX guest.}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjt ubah}(h]h ]h"]h$]h&]uh1j4hjC ubeh}(h]h ]h"]h$]h&]jjuh1j/hhhMhj1 ubeh}(h]h ]h"]h$]h&]uh1j4hjhhhNhNubj5)}(h Run VCPU h]h)}(hRun VCPUh]hRun VCPU}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j4hjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jhjhhhhhKubeh}(h]kvm-tdx-creation-flowah ]h"]kvm tdx creation flowah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Referencesh]h References}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM ubh)}(hbhttps://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/documentation.htmlh]h reference)}(hj h]hbhttps://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/documentation.html}(hj hhhNhNubah}(h]h ]h"]h$]h&]refurij uh1j hj ubah}(h]h ]h"]h$]h&]uh1hhhhM hj hhubeh}(h] referencesah ]h"] referencesah$]h&]uh1hhhhhhhhM ubeh}(h]!intel-trust-domain-extensions-tdxah ]h"]#intel trust domain extensions (tdx)ah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj! error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j jjjjjjjjjjjjjjjjjjj j j j u nametypes}(j jjjjjjjjjj j uh}(j hjhjj"jj3jjjjjjjjjjjjj jj j u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.