vmm: Store boot guest memory and use it for boot sequence

In order to differentiate the 'boot' memory regions from the virtio-mem
regions, we store what we call 'boot_guest_memory'. This is useful to
provide the adequate list of regions to the configure_system() function
as it expects only the list of regions that should be exposed through
the e820 table.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-09-14 17:24:42 +02:00
parent 9d8672afc6
commit 66fc557015
2 changed files with 13 additions and 7 deletions

View File

@@ -86,6 +86,7 @@ impl MemoryZone {
pub type MemoryZones = HashMap<String, MemoryZone>;
pub struct MemoryManager {
boot_guest_memory: GuestMemoryMmap,
guest_memory: GuestMemoryAtomic<GuestMemoryMmap>,
next_memory_slot: u32,
start_of_device_area: GuestAddress,
@@ -504,6 +505,8 @@ impl MemoryManager {
let guest_memory =
GuestMemoryMmap::from_arc_regions(mem_regions).map_err(Error::GuestMemory)?;
let boot_guest_memory = guest_memory.clone();
let end_of_device_area = GuestAddress(mmio_address_space_size() - 1);
let mut start_of_device_area = MemoryManager::start_addr(guest_memory.last_addr(), false);
@@ -580,6 +583,7 @@ impl MemoryManager {
));
let memory_manager = Arc::new(Mutex::new(MemoryManager {
boot_guest_memory,
guest_memory: guest_memory.clone(),
next_memory_slot: 0,
start_of_device_area,
@@ -995,6 +999,10 @@ impl MemoryManager {
self.guest_memory.clone()
}
pub fn boot_guest_memory(&self) -> GuestMemoryMmap {
self.boot_guest_memory.clone()
}
pub fn allocator(&self) -> Arc<Mutex<SystemAllocator>> {
self.allocator.clone()
}