From b9ba81c30d7ff02134c126d77f4206f67e4d55fc Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 11 May 2020 16:19:32 +0100 Subject: [PATCH] arch, vmm: Don't build mptable when using ACPI Use the ACPI feature to control whether to build the mptable. This is necessary as the mptable and ACPI RSDP table can easily overwrite each other leading to it failing to boot. TEST=Compile with default features and see that --cpus boot=48 now works, try with --no-default-features --features "pci" and observe the --cpus boot=48 also continues to work. Fixes: #1132 Signed-off-by: Rob Bradford --- arch/Cargo.toml | 1 + arch/src/x86_64/mod.rs | 7 +++++-- vmm/Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/Cargo.toml b/arch/Cargo.toml index 4e0cfbf17..ad7054525 100644 --- a/arch/Cargo.toml +++ b/arch/Cargo.toml @@ -5,6 +5,7 @@ authors = ["The Chromium OS Authors"] [features] default = [] +acpi = ["acpi_tables"] [dependencies] byteorder = "1.3.4" diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index 1986886d0..5c8ce9a2f 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -10,6 +10,7 @@ mod gdt; pub mod interrupts; pub mod layout; +#[cfg(not(feature = "acpi"))] mod mptable; pub mod regs; @@ -90,6 +91,7 @@ unsafe impl ByteValued for BootParamsWrapper {} pub enum Error { /// Invalid e820 setup params. E820Configuration, + #[cfg(not(feature = "acpi"))] /// Error writing MP table to memory. MpTableSetup(mptable::Error), } @@ -161,13 +163,14 @@ pub fn configure_system( cmdline_addr: GuestAddress, cmdline_size: usize, initramfs: &Option, - num_cpus: u8, + _num_cpus: u8, setup_hdr: Option, rsdp_addr: Option, boot_prot: BootProtocol, ) -> super::Result<()> { // Note that this puts the mptable at the last 1k of Linux's 640k base RAM - mptable::setup_mptable(guest_mem, num_cpus).map_err(Error::MpTableSetup)?; + #[cfg(not(feature = "acpi"))] + mptable::setup_mptable(guest_mem, _num_cpus).map_err(Error::MpTableSetup)?; // Check that the RAM is not smaller than the RSDP start address if let Some(rsdp_addr) = rsdp_addr { diff --git a/vmm/Cargo.toml b/vmm/Cargo.toml index de7259964..87e875d8c 100644 --- a/vmm/Cargo.toml +++ b/vmm/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [features] default = [] -acpi = ["acpi_tables","devices/acpi"] +acpi = ["acpi_tables","devices/acpi", "arch/acpi"] pci_support = ["pci", "vfio", "vm-virtio/pci_support"] mmio_support = ["vm-virtio/mmio_support"] cmos = ["devices/cmos"]