Skip to content

Commit 10e2dd8

Browse files
committed
legacy_apps: zynqmp_r5: init rpmsg vdev with config
Current rpmsg device is not initialized with the config space. Initialze the rpmsg device with the vdev config parameters from the resource table. This configures tx and rx buffer size. Host can read this configuration and configure tx and rx buffer size accordingly. Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
1 parent d43f672 commit 10e2dd8

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

examples/legacy_apps/machine/xlnx/zynqmp_r5/platform_info.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
408408
void (*rst_cb)(struct virtio_device *vdev),
409409
rpmsg_ns_bind_cb ns_bind_cb)
410410
{
411+
struct remote_resource_table *rsc_tbl;
411412
struct remoteproc *rproc = platform;
412413
struct rpmsg_virtio_device *rpmsg_vdev;
413414
struct virtio_device *vdev;
@@ -417,6 +418,8 @@ platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
417418

418419
restore_initial_rsc_table();
419420

421+
rsc_tbl = rproc->rsc_table;
422+
420423
rpmsg_vdev = metal_allocate_memory(sizeof(*rpmsg_vdev));
421424
if (!rpmsg_vdev)
422425
return NULL;
@@ -440,9 +443,9 @@ platform_create_rpmsg_vdev(void *platform, unsigned int vdev_index,
440443

441444
metal_dbg("initializing rpmsg vdev\r\n");
442445
/* RPMsg virtio device can set shared buffers pool argument to NULL */
443-
ret = rpmsg_init_vdev(rpmsg_vdev, vdev, ns_bind_cb,
444-
shbuf_io,
445-
&shpool);
446+
ret = rpmsg_init_vdev_with_config(rpmsg_vdev, vdev, ns_bind_cb,
447+
shbuf_io, &shpool,
448+
&rsc_tbl->vdev_config);
446449
if (ret) {
447450
metal_err("failed rpmsg_init_vdev\r\n");
448451
goto err2;

examples/legacy_apps/machine/xlnx/zynqmp_r5/rsc_table.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
#define RSC_TBL_XLNX_MAGIC ((uint32_t)'x' << 24 | (uint32_t)'a' << 16 | \
2323
(uint32_t)'m' << 8 | (uint32_t)'p')
24-
25-
#define RPMSG_VDEV_DFEATURES (1 << VIRTIO_RPMSG_F_NS)
24+
25+
#define RPMSG_VDEV_DFEATURES (1 << VIRTIO_RPMSG_F_NS | \
26+
1 << VIRTIO_RPMSG_F_BUFSZ)
2627

2728
/* VirtIO rpmsg device id */
2829
#define VIRTIO_ID_RPMSG_ 7
@@ -70,9 +71,9 @@ struct remote_resource_table __resource resources = {
7071
/* vdev config space */
7172
.vdev_config = {
7273
.version = 1,
73-
.size = (uint16_t)sizeof(struct rpmsg_virtio_config)
74-
.h2r_buf_size = 256, /* host to remote, i.e. tx for host */
75-
.r2h_buf_size = 128, /* remote to host, i.e. rx for host */
74+
.size = (uint16_t)sizeof(struct rpmsg_virtio_config),
75+
.h2r_buf_size = 512, /* host to remote, i.e. tx for host */
76+
.r2h_buf_size = 512, /* remote to host, i.e. rx for host */
7677
.split_shpool = false
7778
},
7879
/* trace buffer for logs, accessible via debugfs */

0 commit comments

Comments
 (0)