mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
build: Consolidate sev_snp feature usage
Since igvm is a required feature of sev_snp and also sev_snp is x86-64 only the cfg attributes at build time can be consolidated & simplified. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -105,12 +105,7 @@ use crate::migration::get_vm_snapshot;
|
||||
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
|
||||
use crate::migration::url_to_file;
|
||||
use crate::migration::{SNAPSHOT_CONFIG_FILE, SNAPSHOT_STATE_FILE, url_to_path};
|
||||
#[cfg(all(
|
||||
feature = "kvm",
|
||||
feature = "sev_snp",
|
||||
feature = "fw_cfg",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[cfg(all(feature = "kvm", feature = "sev_snp", feature = "fw_cfg"))]
|
||||
use crate::sev::MeasuredBootInfo;
|
||||
#[cfg(feature = "fw_cfg")]
|
||||
use crate::vm_config::FwCfgConfig;
|
||||
@@ -1566,13 +1561,9 @@ impl Vm {
|
||||
igvm_file: IgvmFile,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
cpu_manager: Arc<Mutex<cpu::CpuManager>>,
|
||||
#[cfg(all(
|
||||
feature = "kvm",
|
||||
feature = "sev_snp",
|
||||
feature = "fw_cfg",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
measured_boot: Option<MeasuredBootInfo>,
|
||||
#[cfg(all(feature = "kvm", feature = "sev_snp", feature = "fw_cfg"))] measured_boot: Option<
|
||||
MeasuredBootInfo,
|
||||
>,
|
||||
#[cfg(feature = "sev_snp")] host_data: &Option<String>,
|
||||
) -> Result<EntryPoint> {
|
||||
// Only reserve bootloader/VMSA regions for KVM + SEV-SNP; other hypervisors
|
||||
@@ -1589,12 +1580,7 @@ impl Vm {
|
||||
memory_manager,
|
||||
cpu_manager.clone(),
|
||||
"",
|
||||
#[cfg(all(
|
||||
feature = "kvm",
|
||||
feature = "sev_snp",
|
||||
feature = "fw_cfg",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[cfg(all(feature = "kvm", feature = "sev_snp", feature = "fw_cfg"))]
|
||||
measured_boot,
|
||||
#[cfg(feature = "sev_snp")]
|
||||
host_data,
|
||||
@@ -1690,12 +1676,7 @@ impl Vm {
|
||||
if payload.igvm.is_some() {
|
||||
let igvm_file =
|
||||
igvm_file.ok_or(Error::IgvmLoad(igvm_loader::Error::MissingIgvm))?;
|
||||
#[cfg(all(
|
||||
feature = "kvm",
|
||||
feature = "sev_snp",
|
||||
feature = "fw_cfg",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[cfg(all(feature = "kvm", feature = "sev_snp", feature = "fw_cfg"))]
|
||||
let measured_boot = if let (true, Some(kernel_path), Some(_cmdline)) = (
|
||||
payload
|
||||
.fw_cfg_config
|
||||
@@ -1738,12 +1719,7 @@ impl Vm {
|
||||
igvm_file,
|
||||
memory_manager,
|
||||
cpu_manager,
|
||||
#[cfg(all(
|
||||
feature = "kvm",
|
||||
feature = "sev_snp",
|
||||
feature = "fw_cfg",
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
#[cfg(all(feature = "kvm", feature = "sev_snp", feature = "fw_cfg"))]
|
||||
measured_boot,
|
||||
#[cfg(feature = "sev_snp")]
|
||||
&payload.host_data,
|
||||
|
||||
Reference in New Issue
Block a user