-
Notifications
You must be signed in to change notification settings - Fork 295
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
virtio.h: add some user-friendly apis #622
base: main
Are you sure you want to change the base?
Conversation
CV-Bowen
commented
Oct 8, 2024
•
edited
Loading
edited
- virtio.h: add new api virtio_has_feature()
- virtio.h: add new feature bit VIRTIO_F_ANY_LAYOUT
0d9c1ce
to
c1646fb
Compare
217ee1d
to
56c5db1
Compare
@arnopo Hi, I meet a CI issue: #define virtio_read_config_member(vdev, structname, member, _ptr) \
virtio_read_config((vdev), metal_offset_of(structname, member), \
_ptr, sizeof(*(_ptr))) This code reports |
60c1fc3
to
3cb3e9c
Compare
3cb3e9c
to
d4c0152
Compare
Follow the virtio spec, this feature bit indicates that the device accepts arbitrary descriptor layouts. Signed-off-by: Bowen Wang <[email protected]>
virtio_has_feature() can be easily used to check if the virtio device support a specific feature. And assgin feature to vdev->feature for virtio device role when get features, so the virtio device side can use virtio_has_featrue() to check weather the virtio device support a feature. Signed-off-by: Bowen Wang <[email protected]>
d4c0152
to
1b4cb95
Compare
@arnopo Done, please review again. |
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.
My apologies for this late review. Don't hesitate to ping us if you don't see activity after 2 or 3 weeks.
In addition of my comment could you please rework your commit title
replacing virtio.h
by lib: virtio
{ | ||
uint32_t features; | ||
|
||
if (!vdev) |
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.
We should also check the feature_bit value. For time being we support only up to 32 features bit
so we should check that feature_bit < sizeof(features)