From fc6cfb3472030a16ddfcb485eb505e2cd3b7fa16 Mon Sep 17 00:00:00 2001 From: jackabald Date: Wed, 31 Jul 2024 00:23:47 -0500 Subject: [PATCH] write fdt to memory in configure_system From: jackabald - removes writing to memory in create_fdt - add functionality of writing to memory in configure_system - uses previously unused return value of create_fdt to write fdt to memory Signed-off-by: jackabald Signed-off-by: Patrick Roy --- src/vmm/src/arch/aarch64/fdt.rs | 12 ++++-------- src/vmm/src/arch/aarch64/mod.rs | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/vmm/src/arch/aarch64/fdt.rs b/src/vmm/src/arch/aarch64/fdt.rs index 71dc401fb32b..82963d1b0862 100644 --- a/src/vmm/src/arch/aarch64/fdt.rs +++ b/src/vmm/src/arch/aarch64/fdt.rs @@ -14,10 +14,9 @@ use vm_memory::GuestMemoryError; use super::super::{DeviceType, InitrdConfig}; use super::cache_info::{read_cache_config, CacheEntry}; -use super::get_fdt_addr; use super::gic::GICDevice; use crate::devices::acpi::vmgenid::{VmGenId, VMGENID_MEM_SIZE}; -use crate::vstate::memory::{Address, Bytes, GuestAddress, GuestMemory, GuestMemoryMmap}; +use crate::vstate::memory::{Address, GuestMemory, GuestMemoryMmap}; // This is a value for uniquely identifying the FDT node declaring the interrupt controller. const GIC_PHANDLE: u32 = 1; @@ -65,11 +64,11 @@ pub enum FdtError { } /// Creates the flattened device tree for this aarch64 microVM. -pub fn create_fdt( +pub fn create_fdt( guest_mem: &GuestMemoryMmap, vcpu_mpidr: Vec, cmdline: CString, - device_info: &HashMap<(DeviceType, String), T, S>, + device_info: &HashMap<(DeviceType, String), T>, gic_device: &GICDevice, vmgenid: &Option, initrd: &Option, @@ -106,10 +105,6 @@ pub fn create_fdt Vec<(GuestAddress, usize)> { /// * `device_info` - A hashmap containing the attached devices for building FDT device nodes. /// * `gic_device` - The GIC device. /// * `initrd` - Information about an optional initrd. -pub fn configure_system( +pub fn configure_system( guest_mem: &GuestMemoryMmap, cmdline_cstring: CString, vcpu_mpidr: Vec, - device_info: &HashMap<(DeviceType, String), T, S>, + device_info: &HashMap<(DeviceType, String), T>, gic_device: &GICDevice, vmgenid: &Option, initrd: &Option, ) -> Result<(), ConfigurationError> { - fdt::create_fdt( + let fdt = fdt::create_fdt( guest_mem, vcpu_mpidr, cmdline_cstring, @@ -73,6 +77,10 @@ pub fn configure_system