-
Notifications
You must be signed in to change notification settings - Fork 114
MSI-X support #2101
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
base: main
Are you sure you want to change the base?
MSI-X support #2101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -537,6 +537,49 @@ pub(crate) fn init() { | |
| }); | ||
| } | ||
|
|
||
| /// MSI-X Table entry. | ||
| #[cfg(feature = "msix")] | ||
| #[repr(C)] | ||
| #[derive(volatile::VolatileFieldAccess)] | ||
| pub(crate) struct MsixTableEntry { | ||
| /// Message Address | ||
| message_address: u32, | ||
|
|
||
| /// Message Upper Address | ||
| message_upper_address: u32, | ||
|
|
||
| /// Message Data | ||
| message_data: u32, | ||
|
|
||
| /// Vector Control | ||
| vector_control: u32, | ||
| } | ||
|
cagatay-y marked this conversation as resolved.
Comment on lines
+542
to
+556
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to upstream this to That crate currently does not use any volatile operations at all, though. Is volatile necessary here? Should
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is part of the PCI-e specification, so I may make sense to. Volatile is necessary and |
||
|
|
||
| #[cfg(feature = "msix")] | ||
| impl MsixTableEntry { | ||
| #[cfg(target_arch = "x86_64")] | ||
| pub fn configure(msix_entry: volatile::VolatilePtr<'_, Self>, vector: u8) { | ||
| use MsixTableEntryVolatileFieldAccess; | ||
| use bit_field::BitField; | ||
|
|
||
| // Mask the entry because "[s]oftware must not modify the Address, Data, or Steering Tag fields | ||
| // of an entry while it is unmasked." (PCIe spec. 6.1.4.2) | ||
| msix_entry | ||
| .vector_control() | ||
| .update(|mut control| *control.set_bit(0, true)); | ||
|
|
||
| msix_entry | ||
| .message_address() | ||
| .update(|mut addr_low| *addr_low.set_bits(20..32, 0xfee)); | ||
| msix_entry | ||
| .message_data() | ||
| .update(|mut data| *data.set_bits(0..8, u32::from(vector) + 32)); | ||
| msix_entry | ||
| .vector_control() | ||
| .update(|mut control| *control.set_bit(0, false)); | ||
| } | ||
| } | ||
|
|
||
| /// A module containing PCI specific errors | ||
| /// | ||
| /// Errors include... | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.