From 8e40413886a8f1665e90d6377c7fc76009f81f8b Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Thu, 2 Oct 2025 14:18:49 -0700 Subject: [PATCH] vmm: validate payload correctly when IGVM is provided While an IGVM is provided validation fails as there is no kernel or firmware. This patch fixes the sev_snp boot failure. Signed-off-by: Muminul Islam --- vmm/src/vm_config.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index 380c20434..70c357902 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -691,6 +691,10 @@ pub enum PayloadConfigError { /// No bootitem provided: neither firmware nor kernel. #[error("No bootitem provided: neither firmware nor kernel")] MissingBootitem, + #[cfg(feature = "igvm")] + /// Specifying a kernel or firmware is not supported when an igvm is provided. + #[error("Specifying a kernel or firmware is not supported when an igvm is provided")] + IgvmPlusOtherPayloads, } #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] @@ -790,6 +794,15 @@ impl PayloadConfig { /// Succeeds if Cloud Hypervisor will be able to boot the configuration. /// Further, warns for some odd configurations. pub fn validate(&mut self) -> Result<(), PayloadConfigError> { + #[cfg(feature = "igvm")] + { + if self.igvm.is_some() { + if self.firmware.is_some() || self.kernel.is_some() { + return Err(PayloadConfigError::IgvmPlusOtherPayloads); + } + return Ok(()); + } + } match (&self.firmware, &self.kernel) { (Some(_firmware), Some(_kernel)) => Err(PayloadConfigError::FirmwarePlusOtherPayloads), (Some(_firmware), None) => {