mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor, vmm: Add KVM SEV_{INIT2, SNP_LAUNCH_START} support
Introduce the SevFd abstraction that wraps /dev/sev and implements the KVM_SEV_INIT2 and KVM_SEV_SNP_LAUNCH_START ioctls for SEV-SNP VM initialization on KVM. Key changes: - Add sev.rs with KvmSevInit and KvmSevSnpLaunchStart ioctl structs matching the kernel layout (linux/arch/x86/include/uapi/asm/kvm.h) - Implement KVM_SEV_INIT2 and KVM_SEV_SNP_LAUNCH_START ioctls - Set KVM_MEMORY_ATTRIBUTE_PRIVATE on newly created memory regions when guest_memfd is supported - Widen SevSnpPageAccessProxy cfg gates from mshv-only to all sev_snp-enabled builds - Make sev_snp_init a required trait method (remove default impl) - Include KVM_SEV_SNP_LAUNCH_START in the seccomp allowlist - Parse VMSA SEV features from IGVM and include them in the KVM_SEV_INIT2 ioctl Co-authored-by: Keith Adler <kadler@cloudflare.com> Signed-off-by: Keith Adler <kadler@cloudflare.com> Co-authored-by: Alex Orozco <aorozco@google.com> Signed-off-by: Alex Orozco <aorozco@google.com> Co-authored-by: Rob Bradford <rbradford@meta.com> Signed-off-by: Rob Bradford <rbradford@meta.com> Signed-off-by: Ruben Hakobyan <hruben@meta.com>
This commit is contained in:
committed by
Rob Bradford
parent
425609a8b5
commit
2e004521e0
+10
-4
@@ -1327,10 +1327,16 @@ impl Vm {
|
||||
.map_err(Error::IgvmLoad)?
|
||||
};
|
||||
|
||||
let vm = Self::create_hypervisor_vm(
|
||||
hypervisor.as_ref(),
|
||||
vm_config.as_ref().lock().unwrap().deref().into(),
|
||||
)?;
|
||||
let vm = {
|
||||
#[allow(unused_mut)]
|
||||
let mut hv_config: hypervisor::HypervisorVmConfig =
|
||||
vm_config.as_ref().lock().unwrap().deref().into();
|
||||
#[cfg(all(feature = "igvm", feature = "sev_snp"))]
|
||||
if let Some(ref igvm) = igvm_file {
|
||||
hv_config.vmsa_features = igvm_loader::extract_sev_features(igvm);
|
||||
}
|
||||
Self::create_hypervisor_vm(hypervisor.as_ref(), hv_config)?
|
||||
};
|
||||
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
if vm_config.lock().unwrap().max_apic_id() > MAX_SUPPORTED_CPUS_LEGACY {
|
||||
|
||||
Reference in New Issue
Block a user