From a90260ffb6d43f35d51e3ca3aee71265d034a191 Mon Sep 17 00:00:00 2001 From: Jiaqi Gao Date: Sat, 28 Aug 2021 01:13:42 +0800 Subject: [PATCH] hypervisor: kvm: Update TDX command INIT_VM Definition of kvm_tdx_init_vm used by INIT_VM has been updated in latest kernel, needing an update on the Cloud Hypervisor side as well. Update structure TdxInitVm to fit this change and avoid -EINVAL to be returned by the kernel. Signed-off-by: Jiaqi Gao Signed-off-by: Sebastien Boeuf --- hypervisor/src/kvm/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index ae205bfc5..58b27faa3 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -486,15 +486,23 @@ impl vm::Vm for KvmVm { #[repr(C)] struct TdxInitVm { max_vcpus: u32, - reserved: u32, + tsc_khz: u32, attributes: u64, cpuid: u64, + mrconfigid: [u64; 6], + mrowner: [u64; 6], + mrownerconfig: [u64; 6], + reserved: [u64; 43], } let data = TdxInitVm { max_vcpus, - reserved: 0, + tsc_khz: 0, attributes: 1, // TDX1_TD_ATTRIBUTE_DEBUG, cpuid: cpuid.as_fam_struct_ptr() as u64, + mrconfigid: [0; 6], + mrowner: [0; 6], + mrownerconfig: [0; 6], + reserved: [0; 43], }; tdx_command(