Skip to content

Commit c91b8a4

Browse files
committed
test: add PCI VirtIO transport unit tests
Add unit tests that ensure our logic for handling the interaction with guest VirtIO drivers over the PCI transport is correct. Also, drop some dead code and fix some of the handling of various fields. A list of logic fixes we found while writing the tests: * We found some effectively dead code. As VirtIO stipulates that accesses to 64bit configuration fields MUST happen with two individual 32bit reads, so drop the code that was actually handling the 64bit accesses. * There were fields that the code was handling as write-only, when the specification declares them read-write. This was not an issue, since the Linux driver apparently never reads them, but add the read handling, so that we are spec compliant. * The specification mentions that the driver MUST NOT write a value of 0 in the queue_enable field. Enforce it. Signed-off-by: Babis Chalios <[email protected]>
1 parent e9c95b0 commit c91b8a4

File tree

2 files changed

+388
-112
lines changed

2 files changed

+388
-112
lines changed

src/vmm/src/devices/virtio/transport/mmio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ pub(crate) mod tests {
511511
}
512512
}
513513

514-
fn set_avail_features(&mut self, avail_features: u64) {
514+
pub fn set_avail_features(&mut self, avail_features: u64) {
515515
self.avail_features = avail_features;
516516
}
517517
}

0 commit comments

Comments
 (0)