Skip to content

Maintenance4#5752

Merged
ShadowCurse merged 11 commits intofirecracker-microvm:mainfrom
ShadowCurse:maintenance4
Apr 1, 2026
Merged

Maintenance4#5752
ShadowCurse merged 11 commits intofirecracker-microvm:mainfrom
ShadowCurse:maintenance4

Conversation

@ShadowCurse
Copy link
Copy Markdown
Contributor

Changes

  • use correct function for the host page size in utils
  • satisfy clippy and cargo fmt
  • move pci crate into vmm/pci since this is the only place where it is used

Reason

Maintenance

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 Mar 11, 2026
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Mar 11, 2026
@ShadowCurse ShadowCurse force-pushed the maintenance4 branch 4 times, most recently from 861d9be to e42eba1 Compare March 12, 2026 16:44
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 65.93060% with 108 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.00%. Comparing base (56d0736) to head (902f301).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/vmm/src/pci/mod.rs 27.11% 86 Missing ⚠️
src/vmm/src/devices/virtio/transport/pci/device.rs 74.32% 19 Missing ⚠️
src/vmm/src/pci/msix.rs 88.23% 2 Missing ⚠️
src/vmm/src/pci/configuration.rs 98.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5752      +/-   ##
==========================================
- Coverage   83.04%   83.00%   -0.05%     
==========================================
  Files         276      275       -1     
  Lines       29466    29396      -70     
==========================================
- Hits        24471    24401      -70     
  Misses       4995     4995              
Flag Coverage Δ
5.10-m5n.metal 83.28% <64.66%> (-0.05%) ⬇️
5.10-m6a.metal 82.60% <64.66%> (-0.06%) ⬇️
5.10-m6g.metal 79.90% <65.93%> (-0.06%) ⬇️
5.10-m6i.metal 83.27% <64.66%> (-0.06%) ⬇️
5.10-m7a.metal-48xl 82.59% <64.66%> (-0.06%) ⬇️
5.10-m7g.metal 79.90% <65.93%> (-0.06%) ⬇️
5.10-m7i.metal-24xl 83.24% <64.66%> (-0.06%) ⬇️
5.10-m7i.metal-48xl 83.25% <64.66%> (-0.06%) ⬇️
5.10-m8g.metal-24xl 79.90% <65.93%> (-0.06%) ⬇️
5.10-m8g.metal-48xl 79.90% <65.93%> (-0.06%) ⬇️
5.10-m8i.metal-48xl 83.24% <64.66%> (-0.07%) ⬇️
5.10-m8i.metal-96xl 83.25% <64.66%> (-0.06%) ⬇️
6.1-m5n.metal 83.30% <64.66%> (-0.06%) ⬇️
6.1-m6a.metal 82.62% <64.66%> (-0.06%) ⬇️
6.1-m6g.metal 79.90% <65.93%> (-0.06%) ⬇️
6.1-m6i.metal 83.30% <64.66%> (-0.06%) ⬇️
6.1-m7a.metal-48xl 82.61% <64.66%> (-0.06%) ⬇️
6.1-m7g.metal 79.90% <65.93%> (-0.06%) ⬇️
6.1-m7i.metal-24xl 83.31% <64.66%> (-0.06%) ⬇️
6.1-m7i.metal-48xl 83.31% <64.66%> (-0.06%) ⬇️
6.1-m8g.metal-24xl 79.90% <65.93%> (-0.06%) ⬇️
6.1-m8g.metal-48xl 79.90% <65.93%> (-0.06%) ⬇️
6.1-m8i.metal-48xl 83.31% <64.66%> (-0.06%) ⬇️
6.1-m8i.metal-96xl 83.31% <64.66%> (-0.06%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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 maintenance4 branch 2 times, most recently from f0ac26e to 938e640 Compare March 12, 2026 17:30
Copy link
Copy Markdown
Contributor

@Manciukic Manciukic left a comment

Choose a reason for hiding this comment

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

mostly LGTM, just trying to understand why are we using #[allow(clippy::cast_possible_truncation)] rather than explicitly try+unwrap/expect

@ShadowCurse ShadowCurse force-pushed the maintenance4 branch 2 times, most recently from f9cd251 to d88ee1b Compare March 16, 2026 17:14
@ilstam
Copy link
Copy Markdown
Contributor

ilstam commented Mar 20, 2026

I'm happy with this but need to see the new revision of the last commit before approving

@ShadowCurse ShadowCurse mentioned this pull request Mar 23, 2026
11 tasks
@ShadowCurse ShadowCurse force-pushed the maintenance4 branch 4 times, most recently from 31dd2ee to cb6b8a2 Compare March 23, 2026 14:26
@ilstam
Copy link
Copy Markdown
Contributor

ilstam commented Mar 24, 2026

LGTM, ready to approve once the small nitpick in the last patch is addressed (splitting it into 2).

@ShadowCurse ShadowCurse force-pushed the maintenance4 branch 3 times, most recently from cf788d4 to faddbdc Compare March 25, 2026 12:57
ilstam
ilstam previously approved these changes Mar 25, 2026
@ShadowCurse ShadowCurse force-pushed the maintenance4 branch 2 times, most recently from 42b981d to 7219a56 Compare March 26, 2026 13:57
ilstam
ilstam previously approved these changes Mar 26, 2026
Manciukic
Manciukic previously approved these changes Apr 1, 2026
ilstam
ilstam previously approved these changes Apr 1, 2026
On nightly toolchain it seems more cargofmt options
are implemented, so future proof us a bit.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Instead of `get_page_size` use easier to use `host_page_size`
which never errors out.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
BDF is just a `u32`, so there is no need for all the complicated
scaffolding built for it.
- Remove PciBdfVisitor and related methods. Derive serde traits instead
- Remove conversion to/from u16. They are never used.
- Make Display trait just call the Debug since the formatting is the
  same.
- Remove parsing BDF from string since there is no use for it.
- Remove corresponding unit tests for above changes and for derived
  traits like PartialEq.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
These are not used anywhere, so delete them.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Update enum variants with concrete values from the
official resource and back the enum by u8 to make separate
function to convert to u8 redundant.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
There is no reason to use traits and dynamic dispatch
to convert an enum to u8.
Switch all subclass enums to be backed by u8 type
and just convert to u8 on use.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
In the next commit these types will be moved into
vmm/pci/mod.rs and so they will need to have at least Debug
trait implemented for them. Take this opportunity to clean up
derives for these types. Also we require types to have docs
attached to them, but these enums are standard PCI names,
so docs are not required.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse ShadowCurse enabled auto-merge (rebase) April 1, 2026 16:00
The pci crate had only one file with couple of types
only used in the vmm crate. And vmm crate already has
pci module as well, so move pci/mod.rs into vmm/pci/mod.rs.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
When working with PCI, types used to represent different parts
of the spec can use small integer types like u8/u16 instead of
usize. Usage of smaller types makes it harder to make mistakes
in the code and prevents accidental overflows.
This commit tries to replace most of the PCI used types to the
smallest ones which are enough to represent the valid range of
values required. This prevents the `try_from().unwrap()` logic
which can be error prone. Instead it only tries to widen the
type if necessary with safe `::from` functions. In minority of
cases the `#[allow(clippy::cast_possible_truncation)]` is used
with an additional `assert` or other check is used to ensure the
value is within correct range.

No functional changes intended.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Normal BDF is 16bit value, but in linux, it is extended with a `segment`
parameter and becomes 32bit. Rename the type to `PciSBDF` to better show
this difference. Also rename some fields and variables following same
naming.

No functional changes intended.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Fix all the places where the SBDF value was passed as a raw u32 to
refer to the correct PciSBDF type instead. Also fix names if needed.

No functional changes intended.

Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
@ShadowCurse ShadowCurse dismissed stale reviews from ilstam and Manciukic via 902f301 April 1, 2026 16:04
@ShadowCurse ShadowCurse merged commit 15f2ad8 into firecracker-microvm:main Apr 1, 2026
5 of 7 checks passed
@ShadowCurse ShadowCurse deleted the maintenance4 branch April 1, 2026 16:38
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