Skip to content

Commit 5fbbab4

Browse files
committed
add logging about virtq and swiotlb region placement
This will make it easier to validate in an integration test that virt queues are actually placed in the swiotlb region, as a sort of sanity check that on Firecracker's side the swiotlb regions are actually passed to the virtio devices, and that the guest is honoring the request to place virtio stuff into the swiotlb regions. Signed-off-by: Patrick Roy <[email protected]>
1 parent fa3afe1 commit 5fbbab4

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/vmm/src/arch/aarch64/fdt.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ fn create_memory_node(
257257
fdt.property_array_u64("reg", &[region.start_addr().0, region.len()])?;
258258
fdt.end_node(dma)?;
259259
fdt.end_node(rmem)?;
260+
261+
log::info!(
262+
"Placed swiotlb region at [{}, {})",
263+
region.start_addr().0,
264+
region.start_addr().0 + region.len()
265+
);
260266
}
261267

262268
Ok(())

src/vmm/src/devices/virtio/queue.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ impl Queue {
308308
Ok(slice.ptr_guard_mut().as_ptr())
309309
}
310310

311+
fn log_queue_component_address(component: &'static str, addr: GuestAddress, size: usize) {
312+
log::info!(
313+
"Placed virt queue {} at [{}, {})",
314+
component,
315+
addr.0,
316+
addr.0 + size as u64
317+
);
318+
}
319+
311320
/// Set up pointers to the queue objects in the guest memory
312321
/// and mark memory dirty for those objects
313322
pub fn initialize<M: GuestMemory>(&mut self, mem: &M) -> Result<(), QueueError> {
@@ -353,6 +362,22 @@ impl Queue {
353362
));
354363
}
355364

365+
Self::log_queue_component_address(
366+
"descriptor table",
367+
self.desc_table_address,
368+
self.desc_table_size(),
369+
);
370+
Self::log_queue_component_address(
371+
"avail ring",
372+
self.avail_ring_address,
373+
self.avail_ring_size(),
374+
);
375+
Self::log_queue_component_address(
376+
"used ring",
377+
self.used_ring_address,
378+
self.used_ring_size(),
379+
);
380+
356381
Ok(())
357382
}
358383

0 commit comments

Comments
 (0)