From d6db2fdf96e2df4afcb16131a94de3c675b5b13d Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 3 Mar 2021 11:58:54 +0100 Subject: [PATCH] vmm: memory_manager: Add ACPI hotplug region to default memory zone When memory is resized through ACPI, a new region is added to the guest memory. This region must also be added to the corresponding memory zone in order to keep everything in sync. Signed-off-by: Sebastien Boeuf --- vmm/src/memory_manager.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index 76e64bbe8..ed863432f 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -1152,6 +1152,12 @@ impl MemoryManager { let region = self.add_ram_region(start_addr, size)?; + // Add region to the list of regions associated with the default + // memory zone. + if let Some(memory_zone) = self.memory_zones.get_mut(DEFAULT_MEMORY_ZONE) { + memory_zone.regions.push(Arc::clone(®ion)); + } + // Tell the allocator self.allocator .lock()