Skip to content

Conversation

@dancrossnyc
Copy link
Contributor

No description provided.

@dancrossnyc dancrossnyc requested review from citrus-it, iximeow and papertigers and removed request for papertigers December 23, 2025 02:17
@dancrossnyc
Copy link
Contributor Author

Cc @papertigers @rcgoodfellow

@askfongjojo askfongjojo added this to the 18 milestone Dec 29, 2025
Copy link
Contributor

@citrus-it citrus-it left a comment

Choose a reason for hiding this comment

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

I've reviewed this mostly from a VirtIO/viona perspective.

#[derive(Default)]
pub struct vioc_intr_poll {
pub vip_nrings: u16,
pub vip_status: [u32; howmany(VIONA_MAX_QPAIRS, 32)],
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you have the padding explicitly shown in other structures here do you want to do the same for the hole here?


#[repr(C)]
#[derive(Default)]
pub struct vioc_nofity_mmio {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub struct vioc_nofity_mmio {
pub struct vioc_notify_mmio {

}

pub const VIONA_MIN_QPAIRS: usize = 1;
pub const VIONA_MAX_QPAIRS: usize = 0x100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a comment here to say that this limit comes from viona and is deliberately far lower than that allowed by the spec (0x8000)? 256 queue pairs should be enough for anyone.. or something

| VNA_IOC_GET_MTU
| VNA_IOC_SET_MTU
| VNA_IOC_SET_PAIRS
| VNA_IOC_SET_USEPAIRS,
Copy link
Contributor

Choose a reason for hiding this comment

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

Both GET_PAIRS and GET_USEPAIRS should also be safe in terms of not requiring copyin/copyout.
I appreciate they are probably not used.

/// polling.
V6 = 6,

/// Adds support for VirtIO 1.2 (modern) virtqueues.
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically modern queues came in with VirtIO 1.0

CommonConfigReg::QueueSize => {
let state = self.state.lock().unwrap();
let offered =
VqSize::try_from(wo.read_u16()).expect("bad queue size");
Copy link
Contributor

Choose a reason for hiding this comment

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

If a guest sends a nonsensical queue size here (such as 0 or something which is not a power of two) we probably ought not panic.

CommonConfigReg::QueueNotifyData => {
// Read-only for driver
}
CommonConfigReg::QueueReset => self.set_needs_reset(dev),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a register for per-queue reset, not entire device. Since we aren't advertising VIRTIO_F_RING_RESET we never expect to see it and setting the reset-required bit is probably not an unreasonable response!

// logic) is kept well aware
// interested in the placement of those BARs (such as the notify
// logic) is configured properly.
self.bar_update(ps.bar(pci::BarN::BAR0).unwrap());
Copy link
Contributor

Choose a reason for hiding this comment

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

Although we aren't using it yet, the BAR creation logic only creates BAR0 if "Legacy" or "Transitional" mode was selected. We probably need the same existence check as for BAR2 here.

used.used_idx = Wrapping(info.used_idx);
}

/// Accummulates a sequence of available descrptors into a `Chain`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Accummulates a sequence of available descrptors into a `Chain`.
/// Accummulates a sequence of available descriptors into a `Chain`.

}
}

impl MigrateMulti for PciVirtioViona {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we'll need to push at least the number of selected queue pairs into the migration state here.

@papertigers papertigers self-requested a review December 30, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants