Skip to content

Commit ac5d55c

Browse files
committed
allocate and register io memory if initial_swiotlb_size != 0
Allocate the swiotlb region if requested via the /machine-config API endpoint. Signed-off-by: Patrick Roy <[email protected]>
1 parent b1e4f15 commit ac5d55c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/vmm/src/builder.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ pub fn build_microvm_for_boot(
236236
.allocate_guest_memory()
237237
.map_err(StartMicrovmError::GuestMemory)?;
238238

239+
let io_memory = vm_resources
240+
.allocate_io_memory()
241+
.map_err(StartMicrovmError::GuestMemory)?;
242+
239243
// Clone the command-line so that a failed boot doesn't pollute the original.
240244
#[allow(unused_mut)]
241245
let mut boot_cmdline = boot_config.cmdline.clone();
@@ -260,6 +264,13 @@ pub fn build_microvm_for_boot(
260264
.map_err(StartMicrovmError::Internal)?;
261265
}
262266

267+
if let Some(io_memory) = io_memory {
268+
vmm.vm
269+
.register_io_region(io_memory)
270+
.map_err(VmmError::Vm)
271+
.map_err(StartMicrovmError::Internal)?;
272+
}
273+
263274
let entry_point = load_kernel(boot_config, vmm.guest_memory())?;
264275
let initrd = load_initrd_from_config(boot_config, vmm.guest_memory())?;
265276

0 commit comments

Comments
 (0)