-
Notifications
You must be signed in to change notification settings - Fork 87
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
fix(virtio-pci): next_ptr
+ cfg_ptr
offsets
#1218
Conversation
8c42956
to
7cd62fd
Compare
src/drivers/virtio/transport/pci.rs
Outdated
); | ||
let notify_off_multiplier = cap | ||
.device | ||
.read_register(u16::try_from(cap.origin.cfg_ptr).unwrap() + 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do is 16 correct and cap.origin.cap_struct.cap_len wrong?
Is the following line also wrong?
https://github.com/hermit-os/kernel/blob/main/src/drivers/virtio/transport/pci.rs#L950-L952
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to read the last 4 bytes of the struct. Adding cap_len
results in reading the first byte of the next struct. Likely that the other calculation is also incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed the other two uses of cfg_ptr
too in the latest commits. Could you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little verbose, but looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we squash the commits if they don't pass CI individually? :)
Before merging, can sbdy test if this breaks something with QEMU? I don't have a test setup at hand |
CI passes and we test virtio-net-pci there, so everything should be fine, I think? |
cfg_ptr
cfg_ptr
Bugfix: Use correct pointer in PCI capability, not the one to the proceeding element Bugfix: Virtio Capabilities - use correct offsets from `cfg_ptr` Co-authored-by: Martin Kröning <[email protected]> Signed-off-by: Martin Kröning <[email protected]>
cfg_ptr
next_ptr
+ cfg_ptr
offsets
These are two Bugs, where I am wondering how Hermit has event worked before... 🤔