mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
4580dbef5c
commit
28224ef02b
3 changed files with 28 additions and 2 deletions
|
@ -79,7 +79,20 @@ to be configured to the TDX guest.
|
|||
struct kvm_tdx_capabilities {
|
||||
__u64 supported_attrs;
|
||||
__u64 supported_xfam;
|
||||
__u64 reserved[254];
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -965,7 +965,13 @@ struct kvm_tdx_cmd {
|
|||
struct kvm_tdx_capabilities {
|
||||
__u64 supported_attrs;
|
||||
__u64 supported_xfam;
|
||||
__u64 reserved[254];
|
||||
|
||||
__u64 kernel_tdvmcallinfo_1_r11;
|
||||
__u64 user_tdvmcallinfo_1_r11;
|
||||
__u64 kernel_tdvmcallinfo_1_r12;
|
||||
__u64 user_tdvmcallinfo_1_r12;
|
||||
|
||||
__u64 reserved[250];
|
||||
|
||||
/* Configurable CPUID bits for userspace */
|
||||
struct kvm_cpuid2 cpuid;
|
||||
|
|
|
@ -173,6 +173,9 @@ static void td_init_cpuid_entry2(struct kvm_cpuid_entry2 *entry, unsigned char i
|
|||
tdx_clear_unsupported_cpuid(entry);
|
||||
}
|
||||
|
||||
#define TDVMCALLINFO_GET_QUOTE BIT(0)
|
||||
#define TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT BIT(1)
|
||||
|
||||
static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
|
||||
struct kvm_tdx_capabilities *caps)
|
||||
{
|
||||
|
@ -188,6 +191,10 @@ static int init_kvm_tdx_caps(const struct tdx_sys_info_td_conf *td_conf,
|
|||
|
||||
caps->cpuid.nent = td_conf->num_cpuid_config;
|
||||
|
||||
caps->user_tdvmcallinfo_1_r11 =
|
||||
TDVMCALLINFO_GET_QUOTE |
|
||||
TDVMCALLINFO_SETUP_EVENT_NOTIFY_INTERRUPT;
|
||||
|
||||
for (i = 0; i < td_conf->num_cpuid_config; i++)
|
||||
td_init_cpuid_entry2(&caps->cpuid.entries[i], i);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue