mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
arch, devices, vmm: Remove "acpi" feature gate
Compile this feature in by default as it's well supported on both aarch64 and x86_64 and we only officially support using it (no non-acpi binaries are available.) Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||
//
|
||||
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
use crate::config::NumaConfig;
|
||||
use crate::config::{
|
||||
add_to_config, DeviceConfig, DiskConfig, FsConfig, HotplugMethod, NetConfig, PmemConfig,
|
||||
@@ -40,7 +39,6 @@ use arch::x86_64::tdx::TdvfSection;
|
||||
use arch::EntryPoint;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use arch::PciSpaceInfo;
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
use arch::{NumaNode, NumaNodes};
|
||||
use devices::AcpiNotificationFlags;
|
||||
#[cfg(all(target_arch = "x86_64", feature = "gdb"))]
|
||||
@@ -59,7 +57,6 @@ use signal_hook::{
|
||||
iterator::Signals,
|
||||
};
|
||||
use std::cmp;
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
@@ -240,9 +237,6 @@ pub enum Error {
|
||||
/// Cannot activate virtio devices
|
||||
ActivateVirtioDevices(device_manager::DeviceManagerError),
|
||||
|
||||
/// Power button not supported
|
||||
PowerButtonNotSupported,
|
||||
|
||||
/// Error triggering power button
|
||||
PowerButton(device_manager::DeviceManagerError),
|
||||
|
||||
@@ -535,7 +529,7 @@ pub struct Vm {
|
||||
vm: Arc<dyn hypervisor::Vm>,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
saved_clock: Option<hypervisor::ClockData>,
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
|
||||
numa_nodes: NumaNodes,
|
||||
seccomp_action: SeccompAction,
|
||||
exit_evt: EventFd,
|
||||
@@ -567,7 +561,6 @@ impl Vm {
|
||||
info!("Booting VM from config: {:?}", &config);
|
||||
|
||||
// Create NUMA nodes based on NumaConfig.
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
let numa_nodes =
|
||||
Self::create_numa_nodes(config.lock().unwrap().numa.clone(), &memory_manager)?;
|
||||
|
||||
@@ -588,7 +581,6 @@ impl Vm {
|
||||
&exit_evt,
|
||||
&reset_evt,
|
||||
seccomp_action.clone(),
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
numa_nodes.clone(),
|
||||
&activate_evt,
|
||||
force_iommu,
|
||||
@@ -635,7 +627,6 @@ impl Vm {
|
||||
vm_ops,
|
||||
#[cfg(feature = "tdx")]
|
||||
tdx_enabled,
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
&numa_nodes,
|
||||
)
|
||||
.map_err(Error::CpuManager)?;
|
||||
@@ -673,7 +664,7 @@ impl Vm {
|
||||
vm,
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
saved_clock: None,
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
|
||||
numa_nodes,
|
||||
seccomp_action: seccomp_action.clone(),
|
||||
exit_evt,
|
||||
@@ -683,7 +674,6 @@ impl Vm {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "aarch64", feature = "acpi"))]
|
||||
fn create_numa_nodes(
|
||||
configs: Option<Vec<NumaConfig>>,
|
||||
memory_manager: &Arc<Mutex<MemoryManager>>,
|
||||
@@ -1107,7 +1097,7 @@ impl Vm {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn configure_system(&mut self, #[cfg(feature = "acpi")] rsdp_addr: GuestAddress) -> Result<()> {
|
||||
fn configure_system(&mut self, rsdp_addr: GuestAddress) -> Result<()> {
|
||||
info!("Configuring system");
|
||||
let mem = self.memory_manager.lock().unwrap().boot_guest_memory();
|
||||
|
||||
@@ -1117,12 +1107,7 @@ impl Vm {
|
||||
};
|
||||
|
||||
let boot_vcpus = self.cpu_manager.lock().unwrap().boot_vcpus();
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
let rsdp_addr = Some(rsdp_addr);
|
||||
#[cfg(not(feature = "acpi"))]
|
||||
let rsdp_addr = None;
|
||||
|
||||
let sgx_epc_region = self
|
||||
.memory_manager
|
||||
.lock()
|
||||
@@ -1144,10 +1129,7 @@ impl Vm {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
fn configure_system(
|
||||
&mut self,
|
||||
#[cfg(feature = "acpi")] _rsdp_addr: GuestAddress,
|
||||
) -> Result<()> {
|
||||
fn configure_system(&mut self, _rsdp_addr: GuestAddress) -> Result<()> {
|
||||
let cmdline = self.get_cmdline()?;
|
||||
let vcpu_mpidrs = self.cpu_manager.lock().unwrap().get_mpidrs();
|
||||
let vcpu_topology = self.cpu_manager.lock().unwrap().get_vcpu_topology();
|
||||
@@ -1919,7 +1901,7 @@ impl Vm {
|
||||
.map_err(Error::PopulateHob)?;
|
||||
|
||||
// Loop over the ACPI tables and copy them to the HOB.
|
||||
#[cfg(feature = "acpi")]
|
||||
|
||||
for acpi_table in crate::acpi::create_acpi_tables_tdx(
|
||||
&self.device_manager,
|
||||
&self.cpu_manager,
|
||||
@@ -2016,7 +1998,7 @@ impl Vm {
|
||||
// Creates ACPI tables
|
||||
// In case of TDX being used, this is a no-op since the tables will be
|
||||
// created and passed when populating the HOB.
|
||||
#[cfg(feature = "acpi")]
|
||||
|
||||
fn create_acpi_tables(&self) -> Option<GuestAddress> {
|
||||
#[cfg(feature = "tdx")]
|
||||
if self.config.lock().unwrap().tdx.is_some() {
|
||||
@@ -2088,7 +2070,6 @@ impl Vm {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
let rsdp_addr = self.create_acpi_tables();
|
||||
|
||||
// Configuring the TDX regions requires that the vCPUs are created.
|
||||
@@ -2105,10 +2086,7 @@ impl Vm {
|
||||
.map(|_| {
|
||||
// Safe to unwrap rsdp_addr as we know it can't be None when
|
||||
// the entry_point is Some.
|
||||
self.configure_system(
|
||||
#[cfg(feature = "acpi")]
|
||||
rsdp_addr.unwrap(),
|
||||
)
|
||||
self.configure_system(rsdp_addr.unwrap())
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
@@ -2434,15 +2412,12 @@ impl Vm {
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn power_button(&self) -> Result<()> {
|
||||
#[cfg(feature = "acpi")]
|
||||
return self
|
||||
.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.notify_power_button()
|
||||
.map_err(Error::PowerButton);
|
||||
#[cfg(not(feature = "acpi"))]
|
||||
Err(Error::PowerButtonNotSupported)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
|
||||
Reference in New Issue
Block a user