[VFIO] Chapter 2, Section 5: Wire it all up - #6219
Open
ShadowCurse wants to merge 8 commits into
Open
ShadowCurse wants to merge 8 commits into
ShadowCurse wants to merge 8 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/vfio #6219 +/- ##
================================================
- Coverage 82.35% 81.99% -0.37%
================================================
Files 280 280
Lines 32112 32293 +181
================================================
+ Hits 26446 26478 +32
- Misses 5666 5815 +149
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ShadowCurse
force-pushed
the
vfio_part_2_5
branch
5 times, most recently
from
September 17, 2026 15:52
4438b37 to
b387a96
Compare
We already ensure that the Msix is present in the device. The `vfio_calculate_bar_areas` was one weird place that still was accepting it as an `Option` Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add utility functions for DMA mapping guest memory to the device. This must be done only once on first device setup/teardown. PciMng will be handling this in the future commits. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add functions for creation of KVM VFIO device and VFIO container. These will need to be created once on the first device init. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add logic to the PciDevices to create new VFIO devices. As an additional step in VFIO device setup, guest RAM regions are mapped into the VFIO container's IOMMU so the device can DMA directly to guest memory. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Since `device-passthrough` API is now connected, we need to not set dummy values for it before starting the VM. Otherwise the VM startup will fail. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Current device passthrough implementation has some restrictions: - Does not work without PCI since VFIO devices are PCI devices - Does not work with virtio-mem device since we don't update DMA mappings on hot-plug/unplug - Does not work with virtio-balloon since it can `fadvise` on memory In order to prevent VMs being launched with invalid configurations, implement multiple checks for invalid configurations: - At API level, prevent adding of incompatible combinations (VFIO after balloon/mem or in reverse) - At VM creation or snapshot restoration since they get VmResources from other sources. Checks are a bit spread out. Most are in the `rpc_interface.rs` but there is one in the `device_manager.rs` as well. This is just an annoyance of dealing with `VmResources`. In the future we should delete `VmResources` and add devices directly to the `DeviceManager` which can implement all necessary compatibility checks. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Passthrough device state is opaque to the VMM and cannot be serialized or restored. Add these devices to the list of snapshot-incompatible devices so that snapshot requests are rejected with a clear error instead of producing a corrupt snapshot. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
During runtime VFIO devices will use pread64/pwrite64 syscalls on Vcpu thread to interact with BARs. During teardown VFIO device is reset and vfio-ioctls does additional syscalls to clean it up. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
ShadowCurse
force-pushed
the
vfio_part_2_5
branch
from
September 18, 2026 16:26
b387a96 to
d8bbe1e
Compare
ShadowCurse
marked this pull request as ready for review
September 18, 2026 16:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
This PR finally wires all the parts of VFIO together and allows VM to boot with VFIO devices attached
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyle --no-clippyto verify that the PRpasses the automated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.