virtio/mmio: move fw_cfg check into probe_mmio_slots()#948
Merged
stefano-garzarella merged 2 commits intococonut-svsm:mainfrom Jan 27, 2026
Merged
Conversation
msft-jlange
reviewed
Jan 26, 2026
When `virtio-drivers` feature is enabled, but `block` is not enabled
we have the current warnings:
warning: unused variable: `slots`
--> kernel/src/svsm.rs:166:13
|
166 | let mut slots = probe_mmio_slots(config);
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_slots`
|
= note: `#[warn(unused_variables)]` on by default
warning: variable does not need to be mutable
--> kernel/src/svsm.rs:166:9
|
166 | let mut slots = probe_mmio_slots(config);
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
Move `probe_mmio_slots` under `block` feature for now.
Suggested-by: Jon Lange <jlange@microsoft.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Move the fw_cfg availability check from svsm_init() into probe_mmio_slots(), which is the only place where fw_cfg is actually needed. Pass `SvsmConfig` as a parameter to probe_mmio_slots() to perform this check. This prepares for future work where virtio MMIO addresses may be discovered via device tree instead of fw_cfg. By passing `SvsmConfig`, the probe function can internally decide how to discover devices without callers needing to know the details. Also derive Default for MmioSlots to simplify returning empty slot collections. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
7639d5f to
bab0179
Compare
Member
Author
|
v2:
|
msft-jlange
approved these changes
Jan 26, 2026
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.
Move the fw_cfg availability check from svsm_init() into probe_mmio_slots(), which is the only place where fw_cfg is actually needed. Pass
SvsmConfigas a parameter to probe_mmio_slots() to perform this check.This prepares for future work where virtio MMIO addresses may be discovered via device tree instead of fw_cfg. By passing
SvsmConfig, the probe function can internally decide how to discover devices without callers needing to know the details.Also derive Default for MmioSlots to simplify returning empty slot collections.