Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up create_fdt #4707

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/vmm/src/arch/aarch64/fdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub enum FdtError {
}

/// Creates the flattened device tree for this aarch64 microVM.
pub fn create_fdt<T: DeviceInfoForFDT + Clone + Debug, S: std::hash::BuildHasher>(
pub fn create_fdt<T: DeviceInfoForFDT + Clone + Debug>(
guest_mem: &GuestMemoryMmap,
vcpu_mpidr: Vec<u64>,
cmdline: CString,
Expand Down Expand Up @@ -106,10 +106,6 @@ pub fn create_fdt<T: DeviceInfoForFDT + Clone + Debug, S: std::hash::BuildHasher

// Allocate another buffer so we can format and then write fdt to guest.
let fdt_final = fdt_writer.finish()?;

// Write FDT to memory.
let fdt_address = GuestAddress(get_fdt_addr(guest_mem));
guest_mem.write_slice(fdt_final.as_slice(), fdt_address)?;
Ok(fdt_final)
}

Expand Down Expand Up @@ -517,7 +513,7 @@ mod tests {
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
let gic = create_gic(&vm, 1, None).unwrap();
create_fdt(
let fdt_with_devices = create_fdt(
&mem,
vec![0],
CString::new("console=tty0").unwrap(),
Expand All @@ -537,7 +533,7 @@ mod tests {
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
let gic = create_gic(&vm, 1, None).unwrap();
create_fdt(
let fdt_with_vmgenid = create_fdt(
&mem,
vec![0],
CString::new("console=tty0").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/vmm/src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn configure_system<T: DeviceInfoForFDT + Clone + Debug, S: std::hash::Build
vmgenid: &Option<VmGenId>,
initrd: &Option<super::InitrdConfig>,
) -> Result<(), ConfigurationError> {
fdt::create_fdt(
let fdt = fdt::create_fdt(
guest_mem,
vcpu_mpidr,
cmdline_cstring,
Expand Down
Loading