summary refs log tree commit diff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/src/lib.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/src/lib.rs b/arch/src/lib.rs
index db31a9d..8f957a8 100644
--- a/arch/src/lib.rs
+++ b/arch/src/lib.rs
@@ -20,8 +20,8 @@ use acpi_tables::sdt::SDT;
 use devices::split_irqchip_common::GsiRelay;
 use devices::virtio::VirtioDevice;
 use devices::{
-    Bus, BusDevice, BusError, JailedDevice, PciAddress, PciDevice, PciDeviceError, PciInterruptPin,
-    PciRoot,
+    Bus, BusDevice, BusError, JailedDevice, MemoryParams, PciAddress, PciDevice, PciDeviceError,
+    PciInterruptPin, PciRoot,
 };
 use io_jail::Minijail;
 use kvm::{IoeventAddress, Kvm, Vcpu, Vm};
@@ -61,6 +61,17 @@ pub struct VmComponents {
     pub acpi_sdts: Vec<SDT>,
 }
 
+impl VmComponents {
+    pub fn memory_params(&self) -> MemoryParams {
+        MemoryParams {
+            size: self.memory_size,
+
+            #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+            has_bios: matches!(self.vm_image, VmImage::Bios(_)),
+        }
+    }
+}
+
 /// Holds the elements needed to run a Linux VM. Created by `build_vm`.
 pub struct RunnableLinuxVm {
     pub vm: Vm,
@@ -116,6 +127,7 @@ pub trait LinuxArch {
     where
         F: FnOnce(
             &GuestMemory,
+            Self::MemoryParams,
             &mut Vm,
             &mut SystemAllocator,
             &EventFd,