Skip to content

Conversation

Manciukic
Copy link
Contributor

Changes

Add a dummy implementation for virtio-mem device.
Add PUT and GET APIs for /hotplug/memory.

Reason

Support for Virtio Mem

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.

@Manciukic Manciukic changed the title Add dummy implementation for virtio-mem [feature/virtio-mem] Add dummy implementation for virtio-mem Aug 12, 2025
@Manciukic Manciukic force-pushed the virtio-mem/dummy branch 2 times, most recently from 891017d to 904b043 Compare August 12, 2025 17:03
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

❌ Patch coverage is 77.37430% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.37%. Comparing base (acb79a2) to head (6971326).
⚠️ Report is 10 commits behind head on feature/virtio-mem.

Files with missing lines Patch % Lines
src/vmm/src/devices/virtio/mem/device.rs 83.83% 27 Missing ⚠️
src/vmm/src/rpc_interface.rs 0.00% 16 Missing ⚠️
src/vmm/src/devices/virtio/mem/event_handler.rs 83.60% 10 Missing ⚠️
src/vmm/src/resources.rs 25.00% 9 Missing ⚠️
src/vmm/src/builder.rs 73.33% 8 Missing ⚠️
src/firecracker/src/api_server/parsed_request.rs 0.00% 5 Missing ⚠️
src/vmm/src/lib.rs 0.00% 5 Missing ⚠️
src/vmm/src/vmm_config/memory_hotplug.rs 97.67% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/virtio-mem    #5365      +/-   ##
======================================================
- Coverage               82.41%   82.37%   -0.04%     
======================================================
  Files                     266      270       +4     
  Lines                   30571    30919     +348     
======================================================
+ Hits                    25194    25469     +275     
- Misses                   5377     5450      +73     
Flag Coverage Δ
5.10-c5n.metal 82.32% <77.37%> (-0.06%) ⬇️
5.10-m5n.metal 82.32% <77.37%> (-0.06%) ⬇️
5.10-m6a.metal 81.60% <77.37%> (-0.06%) ⬇️
5.10-m6g.metal 78.99% <77.37%> (+<0.01%) ⬆️
5.10-m6i.metal 82.32% <77.37%> (-0.06%) ⬇️
5.10-m7a.metal-48xl 81.59% <77.37%> (-0.05%) ⬇️
5.10-m7g.metal 78.99% <77.37%> (+<0.01%) ⬆️
5.10-m7i.metal-24xl 82.29% <77.37%> (-0.06%) ⬇️
5.10-m7i.metal-48xl 82.28% <77.37%> (-0.06%) ⬇️
5.10-m8g.metal-24xl 78.99% <77.37%> (+<0.01%) ⬆️
5.10-m8g.metal-48xl 78.99% <77.37%> (+<0.01%) ⬆️
6.1-c5n.metal 82.36% <77.37%> (-0.06%) ⬇️
6.1-m5n.metal 82.36% <77.37%> (-0.06%) ⬇️
6.1-m6a.metal 81.65% <77.37%> (-0.05%) ⬇️
6.1-m6g.metal 78.99% <77.37%> (+<0.01%) ⬆️
6.1-m6i.metal 82.36% <77.37%> (-0.06%) ⬇️
6.1-m7a.metal-48xl 81.64% <77.37%> (-0.04%) ⬇️
6.1-m7g.metal 78.99% <77.37%> (+<0.01%) ⬆️
6.1-m7i.metal-24xl 82.37% <77.37%> (-0.06%) ⬇️
6.1-m7i.metal-48xl 82.37% <77.37%> (-0.06%) ⬇️
6.1-m8g.metal-24xl 78.99% <77.37%> (+<0.01%) ⬆️
6.1-m8g.metal-48xl 78.99% <77.37%> (+<0.01%) ⬆️

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.

Update the Kconfig to enable support for virtio-mem in the guest.

Signed-off-by: Riccardo Mancini <[email protected]>
virtio-mem requires a new Kconfig, so I've rebuilt the artifacts and now
I'm making the devctr point to those.

Signed-off-by: Riccardo Mancini <[email protected]>
Automatically generate bindings for virtio-mem.

Signed-off-by: Riccardo Mancini <[email protected]>
Create the new module for the virtio-mem device.

Signed-off-by: Riccardo Mancini <[email protected]>
@Manciukic Manciukic force-pushed the virtio-mem/dummy branch 3 times, most recently from 454ab3e to c7b001b Compare August 19, 2025 17:09
@Manciukic Manciukic marked this pull request as ready for review August 20, 2025 08:24
@Manciukic Manciukic added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Aug 20, 2025
Allow to configure the virtio-mem device from the VmmConfig and the PUT
API to /hotplug/memory.

Signed-off-by: Riccardo Mancini <[email protected]>
Test the freshly added PUT API to /hotplug/memory.

Signed-off-by: Riccardo Mancini <[email protected]>
Add a dummy virtio-mem device that is detected by the guest driver.
The device is configured with total_size, block_size, and slot_size, and
uses a fixed address after the MMIO64 memory zone.

Signed-off-by: Riccardo Mancini <[email protected]>
Check that the driver correctly detects the virtio-mem device, with the
correct parameters.

Signed-off-by: Riccardo Mancini <[email protected]>
Add support for GET /hotplug/memory that returns the current status of
the virtio-mem device.

This API can only be called after boot.

Signed-off-by: Riccardo Mancini <[email protected]>
Add new API to swagger and device-api.md

Signed-off-by: Riccardo Mancini <[email protected]>
@Manciukic
Copy link
Contributor Author

I agree with all patrick comments, we discussed offline that since they're all nits we could have a commit to address them in the next PR.

@Manciukic Manciukic merged commit 832e565 into firecracker-microvm:feature/virtio-mem Aug 22, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants