From 3ae6bf9f72beb3c28aa4dd73e95e3bae15f194e0 Mon Sep 17 00:00:00 2001 From: Tyler Fanelli Date: Wed, 11 Dec 2024 22:57:35 -0500 Subject: [PATCH] amd-sev: Create KVM_X86_SNP_VM type KVM requires a VM intended to be run with SEV-SNP encryption to be created with the KVM_X86_SNP_VM type. Signed-off-by: Tyler Fanelli --- src/vmm/src/linux/vstate.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vmm/src/linux/vstate.rs b/src/vmm/src/linux/vstate.rs index 77726880..e755fc56 100644 --- a/src/vmm/src/linux/vstate.rs +++ b/src/vmm/src/linux/vstate.rs @@ -507,8 +507,12 @@ impl Vm { #[cfg(feature = "amd-sev")] pub fn new(kvm: &Kvm, tee_config: &TeeConfig) -> Result { + const KVM_X86_SNP_VM: u64 = 4; + //create fd for interacting with kvm-vm specific functions - let vm_fd = kvm.create_vm().map_err(Error::VmFd)?; + let vm_fd = kvm + .create_vm_with_type(KVM_X86_SNP_VM) + .map_err(Error::VmFd)?; let supported_cpuid = kvm .get_supported_cpuid(KVM_MAX_CPUID_ENTRIES)