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: divide shram to TX shram & RX shram #375

Merged
merged 1 commit into from
Oct 14, 2022
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
11 changes: 9 additions & 2 deletions lib/include/openamp/rpmsg_virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ struct rpmsg_virtio_shm_pool {
*
* @h2r_buf_size: the size of the buffer used to send data from host to remote
* @r2h_buf_size: the size of the buffer used to send data from remote to host
* @split_shpool: the flag that splitting share memory pool to TX and RX
*/
struct rpmsg_virtio_config {
uint32_t h2r_buf_size;
uint32_t r2h_buf_size;
bool split_shpool;
arnopo marked this conversation as resolved.
Show resolved Hide resolved
};

/**
Expand Down Expand Up @@ -196,8 +198,13 @@ int rpmsg_init_vdev(struct rpmsg_virtio_device *rvdev,
* @param ns_bind_cb - callback handler for name service announcement without
* local endpoints waiting to bind.
* @param shm_io - pointer to the share memory I/O region.
* @param shpool - pointer to shared memory pool. rpmsg_virtio_init_shm_pool has
* to be called first to fill this structure.
* @param shpool - pointer to shared memory pool array.
* If the config->split_shpool is turn on, the array will contain
* two elements, the shpool of txshpool and rxshpool, Otherwise,
* the array has only one element, and txshpool rxshpool shares
* a shpool.
* And rpmsg_virtio_init_shm_pool has to be called first to fill
* each shpool in this array.
* @param config - pointer to configuration structure
*
* @return - status of function execution
Expand Down
5 changes: 3 additions & 2 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
(&(const struct rpmsg_virtio_config) { \
.h2r_buf_size = RPMSG_BUFFER_SIZE, \
.r2h_buf_size = RPMSG_BUFFER_SIZE, \
.split_shpool = false, \
})
#else
#define RPMSG_VIRTIO_DEFAULT_CONFIG NULL
Expand Down Expand Up @@ -689,11 +690,11 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
* Since device is RPMSG Remote so we need to manage the
* shared buffers. Create shared memory pool to handle buffers.
*/
rvdev->shpool = config->split_shpool ? shpool + 1 : shpool;
edmooring marked this conversation as resolved.
Show resolved Hide resolved
if (!shpool)
return RPMSG_ERR_PARAM;
if (!shpool->size)
if (!shpool->size || !rvdev->shpool->size)
return RPMSG_ERR_NO_BUFF;
rvdev->shpool = shpool;

vq_names[0] = "rx_vq";
vq_names[1] = "tx_vq";
Expand Down