From 195eba188adf97fceede17aa712532b5b44063ae Mon Sep 17 00:00:00 2001 From: Michael Zhao Date: Mon, 31 May 2021 22:30:24 +0800 Subject: [PATCH] vmm: Split create_gic() from configure_system() Signed-off-by: Michael Zhao --- arch/src/aarch64/mod.rs | 17 ++++------------- vmm/src/vm.rs | 13 +++++++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/arch/src/aarch64/mod.rs b/arch/src/aarch64/mod.rs index 49a78fd7a..ed5d3685b 100644 --- a/arch/src/aarch64/mod.rs +++ b/arch/src/aarch64/mod.rs @@ -131,30 +131,21 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region } /// Configures the system and should be called once per vm before starting vcpu threads. -/// -/// # Arguments -/// -/// * `guest_mem` - The memory to be used by the guest. -/// * `num_cpus` - Number of virtual CPUs the guest will have. -#[allow(clippy::too_many_arguments)] pub fn configure_system( - vm: &Arc, guest_mem: &GuestMemoryMmap, cmdline_cstring: &CStr, - vcpu_count: u64, vcpu_mpidr: Vec, device_info: &HashMap<(DeviceType, String), T, S>, initrd: &Option, pci_space_address: &(u64, u64), -) -> super::Result> { - let gic_device = gic::kvm::create_gic(vm, vcpu_count).map_err(Error::SetupGic)?; - + gic_device: &dyn GicDevice, +) -> super::Result<()> { let fdt_final = fdt::create_fdt( guest_mem, cmdline_cstring, vcpu_mpidr, device_info, - &*gic_device, + gic_device, initrd, pci_space_address, ) @@ -162,7 +153,7 @@ pub fn configure_system