mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
vmm, arch, devices: Put ACPI support behind a default feature
Put the ACPI support behind a feature and ensure that the code compiles without that feature by adding an extra build to Travis. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
bb2e7bb942
commit
9e764fc091
@ -9,6 +9,7 @@ before_script:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- cargo build --release
|
- cargo build --release
|
||||||
|
- cargo build --release --no-default-features
|
||||||
- cargo test
|
- cargo test
|
||||||
- cargo clippy --all-targets --all-features -- -D warnings
|
- cargo clippy --all-targets --all-features -- -D warnings
|
||||||
- find . -name "*.rs" | xargs rustfmt --check
|
- find . -name "*.rs" | xargs rustfmt --check
|
||||||
|
@ -3,13 +3,17 @@ name = "arch"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["The Chromium OS Authors"]
|
authors = ["The Chromium OS Authors"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["acpi"]
|
||||||
|
acpi = ["acpi_tables"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1.3.2"
|
byteorder = "1.3.2"
|
||||||
kvm-bindings = "0.1.1"
|
kvm-bindings = "0.1.1"
|
||||||
kvm-ioctls = { git = "https://github.com/rust-vmm/kvm-ioctls", branch = "master" }
|
kvm-ioctls = { git = "https://github.com/rust-vmm/kvm-ioctls", branch = "master" }
|
||||||
libc = "0.2.60"
|
libc = "0.2.60"
|
||||||
|
|
||||||
acpi_tables = { path ="../acpi_tables" }
|
acpi_tables = { path = "../acpi_tables", optional = true }
|
||||||
arch_gen = { path = "../arch_gen" }
|
arch_gen = { path = "../arch_gen" }
|
||||||
|
|
||||||
[dependencies.vm-memory]
|
[dependencies.vm-memory]
|
||||||
|
@ -48,7 +48,7 @@ struct PCIRangeEntry {
|
|||||||
pub segment: u16,
|
pub segment: u16,
|
||||||
pub start: u8,
|
pub start: u8,
|
||||||
pub end: u8,
|
pub end: u8,
|
||||||
_reserved: u32
|
_reserved: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_dsdt_table(serial_enabled: bool) -> SDT {
|
pub fn create_dsdt_table(serial_enabled: bool) -> SDT {
|
||||||
|
@ -183,8 +183,11 @@ pub fn configure_system(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rsdp_addr = acpi::create_acpi_tables(guest_mem, num_cpus, serial_enabled);
|
#[cfg(feature = "acpi")]
|
||||||
params.0.acpi_rsdp_addr = rsdp_addr.0;
|
{
|
||||||
|
let rsdp_addr = acpi::create_acpi_tables(guest_mem, num_cpus, serial_enabled);
|
||||||
|
params.0.acpi_rsdp_addr = rsdp_addr.0;
|
||||||
|
}
|
||||||
|
|
||||||
let zero_page_addr = layout::ZERO_PAGE_START;
|
let zero_page_addr = layout::ZERO_PAGE_START;
|
||||||
guest_mem
|
guest_mem
|
||||||
|
@ -15,3 +15,7 @@ vmm-sys-util = { git = "https://github.com/rust-vmm/vmm-sys-util" }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["acpi"]
|
||||||
|
acpi = []
|
@ -19,11 +19,13 @@ extern crate vmm_sys_util;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::{io, result};
|
use std::{io, result};
|
||||||
|
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
mod acpi;
|
mod acpi;
|
||||||
mod bus;
|
mod bus;
|
||||||
pub mod ioapic;
|
pub mod ioapic;
|
||||||
pub mod legacy;
|
pub mod legacy;
|
||||||
|
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
pub use self::acpi::AcpiShutdownDevice;
|
pub use self::acpi::AcpiShutdownDevice;
|
||||||
pub use self::bus::{Bus, BusDevice, Error as BusError};
|
pub use self::bus::{Bus, BusDevice, Error as BusError};
|
||||||
|
|
||||||
|
@ -4,8 +4,12 @@ version = "0.1.0"
|
|||||||
authors = ["The Cloud Hypervisor Authors"]
|
authors = ["The Cloud Hypervisor Authors"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["acpi"]
|
||||||
|
acpi = ["acpi_tables"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
acpi_tables = { path = "../acpi_tables" }
|
acpi_tables = { path = "../acpi_tables", optional = true }
|
||||||
arch = { path = "../arch" }
|
arch = { path = "../arch" }
|
||||||
devices = { path = "../devices" }
|
devices = { path = "../devices" }
|
||||||
epoll = "4.1.0"
|
epoll = "4.1.0"
|
||||||
|
@ -619,6 +619,7 @@ struct DeviceManager {
|
|||||||
// i8042 device for i8042 reset
|
// i8042 device for i8042 reset
|
||||||
i8042: Arc<Mutex<devices::legacy::I8042Device>>,
|
i8042: Arc<Mutex<devices::legacy::I8042Device>>,
|
||||||
|
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
// ACPI device for reboot/shutdwon
|
// ACPI device for reboot/shutdwon
|
||||||
acpi_device: Arc<Mutex<devices::AcpiShutdownDevice>>,
|
acpi_device: Arc<Mutex<devices::AcpiShutdownDevice>>,
|
||||||
|
|
||||||
@ -700,6 +701,8 @@ impl DeviceManager {
|
|||||||
let i8042 = Arc::new(Mutex::new(devices::legacy::I8042Device::new(
|
let i8042 = Arc::new(Mutex::new(devices::legacy::I8042Device::new(
|
||||||
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
let acpi_device = Arc::new(Mutex::new(devices::AcpiShutdownDevice::new(
|
let acpi_device = Arc::new(Mutex::new(devices::AcpiShutdownDevice::new(
|
||||||
exit_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
exit_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
||||||
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
|
||||||
@ -755,6 +758,7 @@ impl DeviceManager {
|
|||||||
serial,
|
serial,
|
||||||
console_input: console,
|
console_input: console,
|
||||||
i8042,
|
i8042,
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
acpi_device,
|
acpi_device,
|
||||||
exit_evt,
|
exit_evt,
|
||||||
reset_evt,
|
reset_evt,
|
||||||
@ -1303,6 +1307,7 @@ impl DeviceManager {
|
|||||||
.insert(self.i8042.clone(), 0x61, 0x4)
|
.insert(self.i8042.clone(), 0x61, 0x4)
|
||||||
.map_err(Error::BusError)?;
|
.map_err(Error::BusError)?;
|
||||||
|
|
||||||
|
#[cfg(feature = "acpi")]
|
||||||
self.io_bus
|
self.io_bus
|
||||||
.insert(self.acpi_device.clone(), 0x3c0, 0x4)
|
.insert(self.acpi_device.clone(), 0x3c0, 0x4)
|
||||||
.map_err(Error::BusError)?;
|
.map_err(Error::BusError)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user