Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: TDX: Report supported optional TDVMCALLs in TDX capabilities

Allow userspace to advertise TDG.VP.VMCALL subfunctions that the
kernel also supports. For each output register of GetTdVmCallInfo's
leaf 1, add two fields to KVM_TDX_CAPABILITIES: one for kernel-supported
TDVMCALLs (userspace can set those blindly) and one for user-supported
TDVMCALLs (userspace can set those if it knows how to handle them).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+28 -2
+14 -1
Documentation/virt/kvm/x86/intel-tdx.rst
··· 79 79 struct kvm_tdx_capabilities { 80 80 __u64 supported_attrs; 81 81 __u64 supported_xfam; 82 - __u64 reserved[254]; 82 + 83 + /* TDG.VP.VMCALL hypercalls executed in kernel and forwarded to 84 + * userspace, respectively 85 + */ 86 + __u64 kernel_tdvmcallinfo_1_r11; 87 + __u64 user_tdvmcallinfo_1_r11; 88 + 89 + /* TDG.VP.VMCALL instruction executions subfunctions executed in kernel 90 + * and forwarded to userspace, respectively 91 + */ 92 + __u64 kernel_tdvmcallinfo_1_r12; 93 + __u64 user_tdvmcallinfo_1_r12; 94 + 95 + __u64 reserved[250]; 83 96 84 97 /* Configurable CPUID bits for userspace */ 85 98 struct kvm_cpuid2 cpuid;
+7 -1
arch/x86/include/uapi/asm/kvm.h
··· 965 965 struct kvm_tdx_capabilities { 966 966 __u64 supported_attrs; 967 967 __u64 supported_xfam; 968 - __u64 reserved[254]; 968 + 969 + __u64 kernel_tdvmcallinfo_1_r11; 970 + __u64 user_tdvmcallinfo_1_r11; 971 + __u64 kernel_tdvmcallinfo_1_r12; 972 + __u64 user_tdvmcallinfo_1_r12; 973 + 974 + __u64 reserved[250]; 969 975 970 976 /* Configurable CPUID bits for userspace */ 971 977 struct kvm_cpuid2 cpuid;
+7
arch/x86/kvm/vmx/tdx.c
··· 173 173 tdx_clear_unsupported_cpuid(entry); 174 174 } 175 175 176 + #define TDVMCALLINFO_GET_QUOTE BIT(0) 177 + #define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT BIT(1) 178 + 176 179 static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf, 177 180 struct kvm_tdx_capabilities *caps) 178 181 { ··· 190 187 return -EIO; 191 188 192 189 caps->cpuid.nent = td_conf->num_cpuid_config; 190 + 191 + caps->user_tdvmcallinfo_1_r11 = 192 + TDVMCALLINFO_GET_QUOTE | 193 + TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT; 193 194 194 195 for (i = 0; i < td_conf->num_cpuid_config; i++) 195 196 td_init_cpuid_entry2(&caps->cpuid.entries[i], i);