Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CV-Bowen
Copy link
Contributor

@CV-Bowen CV-Bowen commented Oct 8, 2024

  • virtio.h: add new api virtio_has_feature()
virtio_has_feature() can be easily used to heck 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.
  • virtio.h: add new feature bit VIRTIO_F_ANY_LAYOUT
Follow the virtio spec, this feature bit indicates that the device
accepts arbitrary descriptor layouts.

@CV-Bowen CV-Bowen force-pushed the virtio-config branch 2 times, most recently from 0d9c1ce to c1646fb Compare October 8, 2024 13:41
@CV-Bowen CV-Bowen force-pushed the virtio-config branch 4 times, most recently from 217ee1d to 56c5db1 Compare October 10, 2024 02:59
@CV-Bowen
Copy link
Contributor Author

@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 MACRO_ARG_REUSE: Macro argument reuse '_ptr' - possible side-effects?
So can we use typeof to avoid this issue?

lib/include/openamp/virtio.h Show resolved Hide resolved
lib/include/openamp/virtio.h Outdated Show resolved Hide resolved
lib/include/openamp/virtio.h Outdated Show resolved Hide resolved
@CV-Bowen CV-Bowen force-pushed the virtio-config branch 2 times, most recently from 60c1fc3 to 3cb3e9c Compare October 18, 2024 11:24
@CV-Bowen
Copy link
Contributor Author

@glneo @arnopo Please review again.

lib/include/openamp/virtio.h Show resolved Hide resolved
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]>
@CV-Bowen
Copy link
Contributor Author

@arnopo Done, please review again.

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