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

remoteproc_virtio: add shm_io for remoteproc virtio #542

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions lib/include/openamp/remoteproc_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ struct remoteproc_virtio {
/** Metal I/O region of vdev_info, can be NULL */
struct metal_io_region *vdev_rsc_io;

/** Metal I/O region of vdev share memory */
struct metal_io_region *shm_io;

/** Notification function */
rpvdev_notify_func notify;

Expand Down Expand Up @@ -88,6 +91,17 @@ rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid,
*/
void rproc_virtio_remove_vdev(struct virtio_device *vdev);

/**
* @brief Set the remoteproc virtio device share memory I/O region
*
* @param vdev Pointer to the virtio device
* @param shm_io Metal I/O region to set
*
* @return 0 for success, negative value for failure.
*/
int rproc_virtio_set_shm_io(struct virtio_device *vdev,
struct metal_io_region *shm_io);

/**
* @brief Initialize rproc virtio vring
*
Expand Down
14 changes: 14 additions & 0 deletions lib/remoteproc/remoteproc_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,20 @@ rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid,
return NULL;
}

int rproc_virtio_set_shm_io(struct virtio_device *vdev,
struct metal_io_region *shm_io)
{
struct remoteproc_virtio *rpvdev;

if (!vdev || !shm_io)
return -RPROC_EINVAL;

rpvdev = metal_container_of(vdev, struct remoteproc_virtio, vdev);
rpvdev->shm_io = shm_io;

return 0;
}

void rproc_virtio_remove_vdev(struct virtio_device *vdev)
{
struct remoteproc_virtio *rpvdev;
Expand Down