Skip to content

Expose MSI-X configuration #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

devsnek
Copy link

@devsnek devsnek commented May 16, 2025

Expose functions to configure MSI-X interrupt vectors.

field_shared!(self.common_cfg, queue_msix_vector).read()
}

/// Set the MSI-X vector for queue.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before setting MSI-X vectors, the driver will need to check whether the device has the MSI-X capability, and check its MSI-X table size. I guess you either need separate methods for this on the transport, or some method to handle MSI-X setup generally.

I guess the ack_interrupt implementation will also need to change to support MSI-X interrupts when it is being used.

Copy link
Author

Choose a reason for hiding this comment

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

yes code has to read the capability and such. i didn't add code for this because the code in my os for this is done outside of the virtio library, as i support non-virtio devices as well.

the interrupt ack register seems to only be used for "legacy" interrupts, according to the virtio spec.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The isr_status register is only for legacy interrupts, but the Transport::ack_interrupt method should work either way. What I'm saying is that PciTransport should have some logic for negotiating whether MSI-X is being used or not, and if it is used then the behaviour of ack_interrupt should change.

/// Get the underlying transport.
pub fn transport_mut(&mut self) -> &mut T {
&mut self.transport
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these methods needed on every device? I would have thought that the MSI-X configuration would happen during the initial setup of the device, either before passing the transport to the device driver or inside the driver. How do you expect them to be used?

Copy link
Author

Choose a reason for hiding this comment

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

it worked better in my code to set up the interrupt later, after everything else is configured. so i added methods to expose the transport. this seems useful either way?

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.

2 participants