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 <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-05-11 16:19:32 +01:00
parent 16ac24d8f7
commit b9ba81c30d
3 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,7 @@ authors = ["The Chromium OS Authors"]
[features]
default = []
acpi = ["acpi_tables"]
[dependencies]
byteorder = "1.3.4"

View File

@ -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<InitramfsConfig>,
num_cpus: u8,
_num_cpus: u8,
setup_hdr: Option<setup_header>,
rsdp_addr: Option<GuestAddress>,
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 {

View File

@ -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"]