vmm: tdx: Reject attempt to use --kernel with --tdx

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-05-10 13:12:12 +00:00
parent c400702272
commit 30b74e74cd

View File

@ -126,6 +126,9 @@ pub enum ValidationError {
// CPU Hotplug not permitted with TDX
#[cfg(feature = "tdx")]
TdxNoCpuHotplug,
// Specifying kernel not permitted with TDX
#[cfg(feature = "tdx")]
TdxKernelSpecified,
// Insuffient vCPUs for queues
TooManyQueues,
}
@ -168,6 +171,10 @@ impl fmt::Display for ValidationError {
TdxNoCpuHotplug => {
write!(f, "CPU hotplug not possible with TDX")
}
#[cfg(feature = "tdx")]
TdxKernelSpecified => {
write!(f, "Direct kernel boot not possible with TDX")
}
TooManyQueues => {
write!(f, "Number of vCPUs is insufficient for number of queues")
}
@ -1751,6 +1758,9 @@ impl VmConfig {
if tdx_enabled && (self.cpus.max_vcpus != self.cpus.boot_vcpus) {
return Err(ValidationError::TdxNoCpuHotplug);
}
if tdx_enabled && self.kernel.is_some() {
return Err(ValidationError::TdxKernelSpecified);
}
}
if self.console.mode == ConsoleOutputMode::Tty && self.serial.mode == ConsoleOutputMode::Tty