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

openamp/virtio.h: update vdev->features and make final_features optional #610

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/include/openamp/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,15 @@ static inline int virtio_negotiate_features(struct virtio_device *vdev,
uint32_t features,
uint32_t *final_features)
{
if (!vdev || !final_features)
if (!vdev)
return -EINVAL;

if (!vdev->func || !vdev->func->negotiate_features)
return -ENXIO;

*final_features = vdev->func->negotiate_features(vdev, features);
vdev->features = vdev->func->negotiate_features(vdev, features);
if (final_features)
*final_features = vdev->features;
arnopo marked this conversation as resolved.
Show resolved Hide resolved
return 0;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/remoteproc/remoteproc_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ static void rproc_virtio_set_features(struct virtio_device *vdev,
static uint32_t rproc_virtio_negotiate_features(struct virtio_device *vdev,
uint32_t features)
{
uint32_t dfeatures = rproc_virtio_get_dfeatures(vdev);
features = features & rproc_virtio_get_dfeatures(vdev);
rproc_virtio_set_features(vdev, features);

rproc_virtio_set_features(vdev, dfeatures & features);

return 0;
/* return the mask of features successfully negotiated */
return features;
}
#endif

Expand Down
Loading