vmm: Introduce MemoryManager

The memory manager is responsible for setting up the guest memory and in
the long term will also handle addition of guest memory.

In this commit move code for creating the backing memory and populating
the allocator into the new implementation trying to make as minimal
changes to other code as possible.

Follow on commits will further reduce some of the duplicated code.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2019-12-19 15:47:36 +00:00
parent bcfe546ea2
commit 260cebb8cf
4 changed files with 259 additions and 199 deletions

View File

@@ -416,7 +416,7 @@ pub struct DeviceManager {
impl DeviceManager {
pub fn new(
vm_info: &VmInfo,
allocator: SystemAllocator,
allocator: Arc<Mutex<SystemAllocator>>,
mut mem_slots: u32,
_exit_evt: &EventFd,
reset_evt: &EventFd,
@@ -435,7 +435,7 @@ impl DeviceManager {
let mut virt_iommu: Option<(u32, Vec<u32>)> = None;
let address_manager = Arc::new(AddressManager {
allocator: Arc::new(Mutex::new(allocator)),
allocator,
io_bus: Arc::new(io_bus),
mmio_bus: Arc::new(mmio_bus),
#[cfg(feature = "pci_support")]