Skip to content

[VFIO] Chapter 2, Section 2: Caps and Bars - #6085

Merged
ShadowCurse merged 3 commits into
firecracker-microvm:feature/vfiofrom
ShadowCurse:vfio_part_2_2
Aug 18, 2026
Merged

ShadowCurse merged 3 commits into
firecracker-microvm:feature/vfiofrom
ShadowCurse:vfio_part_2_2

Conversation

@ShadowCurse

@ShadowCurse ShadowCurse commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Changes

First 3 commits from the #6055 PR. Add functions and types to handle parsing device PCI caps and BARs information. None of these are used yet.

Part of #5679

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

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

@ShadowCurse ShadowCurse self-assigned this Aug 6, 2026
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Aug 6, 2026
@codecov

codecov Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.99187% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.86%. Comparing base (2dea21c) to head (b6c6107).

Files with missing lines Patch % Lines
src/vmm/src/vfio.rs 86.44% 32 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           feature/vfio    #6085      +/-   ##
================================================
+ Coverage         82.78%   82.86%   +0.07%     
================================================
  Files               279      280       +1     
  Lines             30871    31115     +244     
================================================
+ Hits              25558    25782     +224     
- Misses             5313     5333      +20     
Flag Coverage Δ
5.10-m5n.metal 83.09% <86.99%> (+0.06%) ⬆️
5.10-m6a.metal 82.46% <86.99%> (+0.08%) ⬆️
5.10-m6g.metal 79.93% <86.99%> (+0.09%) ⬆️
5.10-m6i.metal 83.09% <86.99%> (+0.06%) ⬆️
5.10-m7a.metal-48xl 82.45% <86.99%> (+0.08%) ⬆️
5.10-m7g.metal 79.93% <86.99%> (+0.10%) ⬆️
5.10-m7i.metal-24xl 83.07% <86.99%> (+0.07%) ⬆️
5.10-m7i.metal-48xl 83.07% <86.99%> (+0.07%) ⬆️
5.10-m8g.metal-24xl 79.93% <86.99%> (+0.09%) ⬆️
5.10-m8g.metal-48xl 79.93% <86.99%> (+0.09%) ⬆️
5.10-m8i.metal-48xl 83.07% <86.99%> (+0.06%) ⬆️
5.10-m8i.metal-96xl 83.07% <86.99%> (+0.07%) ⬆️
6.1-m5n.metal 83.12% <86.99%> (+0.06%) ⬆️
6.1-m6a.metal 82.48% <86.99%> (+0.07%) ⬆️
6.1-m6g.metal 79.93% <86.99%> (+0.10%) ⬆️
6.1-m6i.metal 83.12% <86.99%> (+0.07%) ⬆️
6.1-m7a.metal-48xl 82.47% <86.99%> (+0.08%) ⬆️
6.1-m7g.metal 79.93% <86.99%> (+0.09%) ⬆️
6.1-m7i.metal-24xl 83.13% <86.99%> (+0.07%) ⬆️
6.1-m7i.metal-48xl 83.14% <86.99%> (+0.07%) ⬆️
6.1-m8g.metal-24xl 79.92% <86.99%> (+0.09%) ⬆️
6.1-m8g.metal-48xl 79.93% <86.99%> (+0.10%) ⬆️
6.1-m8i.metal-48xl 83.13% <86.99%> (+0.06%) ⬆️
6.1-m8i.metal-96xl 83.14% <86.99%> (+0.07%) ⬆️
6.18-m5n.metal 83.11% <86.99%> (+0.06%) ⬆️
6.18-m6a.metal 82.48% <86.99%> (+0.08%) ⬆️
6.18-m6g.metal 79.93% <86.99%> (+0.10%) ⬆️
6.18-m6i.metal 83.12% <86.99%> (+0.06%) ⬆️
6.18-m7a.metal-48xl 82.47% <86.99%> (+0.08%) ⬆️
6.18-m7g.metal 79.93% <86.99%> (+0.09%) ⬆️
6.18-m7i.metal-24xl 83.14% <86.99%> (+0.07%) ⬆️
6.18-m7i.metal-48xl 83.12% <86.99%> (+0.06%) ⬆️
6.18-m8g.metal-24xl 79.93% <86.99%> (+0.09%) ⬆️
6.18-m8g.metal-48xl 79.93% <86.99%> (+0.10%) ⬆️
6.18-m8i.metal-48xl 83.13% <86.99%> (+0.07%) ⬆️
6.18-m8i.metal-96xl 83.13% <86.99%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ShadowCurse
ShadowCurse force-pushed the vfio_part_2_2 branch 2 times, most recently from 51f2279 to 04e6c17 Compare August 7, 2026 10:56
Add dependencies for the vfio implementation

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse
ShadowCurse force-pushed the vfio_part_2_2 branch 2 times, most recently from d79eb85 to b940f85 Compare August 7, 2026 12:46
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated

@Manciukic Manciukic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functionally LGTM, but it's still very hard go grok. The structs are an improvement over the previous design, but it'd prefer to use impl blocks to logically group and confine the operations on the different structs you introduced, following a more OOD pattern.

Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/Cargo.toml
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
Comment thread src/vmm/src/vfio.rs Outdated
@ShadowCurse
ShadowCurse force-pushed the vfio_part_2_2 branch 9 times, most recently from ce8ff52 to 921a9d3 Compare August 13, 2026 14:00
Manciukic
Manciukic previously approved these changes Aug 17, 2026
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs
Comment thread src/vmm/src/vfio.rs Outdated
@ShadowCurse
ShadowCurse force-pushed the vfio_part_2_2 branch 3 times, most recently from 400c457 to e6f6a96 Compare August 18, 2026 10:54
Scan device config space in search of it's capabilities and extended
capabilities. Only interesting legacy capabilities are: Msix and
PciExpress. Out of all extended capabilities search for ARI, ReBAR and
SR-IOV caps and mask them out since we either don't support those
features or they contain host information we don't want to provide to
the guest.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Gather information about BARs the device has and allocate space for them
in the guest memory.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse
ShadowCurse enabled auto-merge (rebase) August 18, 2026 16:18
@ShadowCurse
ShadowCurse merged commit 8c8fc63 into firecracker-microvm:feature/vfio Aug 18, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants