Skip to content

Commit 5ac8096

Browse files
committed
rpmsg_virtio: add new virtio feature bit
Introduce new feature bit that allows rpmsg buffer size via virtio device config space. If the feature is available then, driver will set single rpmsg buffer size from virtio device config space in the resource table. Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
1 parent 6def535 commit 5ac8096

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/include/openamp/rpmsg_virtio.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <metal/io.h>
1616
#include <metal/mutex.h>
1717
#include <metal/cache.h>
18+
#include <metal/compiler.h>
1819
#include <openamp/rpmsg.h>
1920
#include <openamp/virtio.h>
2021

@@ -29,6 +30,7 @@ extern "C" {
2930

3031
/* The feature bitmap for virtio rpmsg */
3132
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
33+
#define VIRTIO_RPMSG_F_BUFSZ 1 /* fw provides tx and rx single buf size */
3234

3335
#if defined(VIRTIO_USE_DCACHE)
3436
#define BUFFER_FLUSH(x, s) metal_cache_flush(x, s)
@@ -59,7 +61,11 @@ struct rpmsg_virtio_shm_pool {
5961
* This structure is used by the RPMsg virtio host to configure the virtiio
6062
* layer.
6163
*/
64+
METAL_PACKED_BEGIN
6265
struct rpmsg_virtio_config {
66+
/** version of this struct */
67+
uint16_t version;
68+
6369
/** The size of the buffer used to send data from host to remote */
6470
uint32_t h2r_buf_size;
6571

@@ -68,7 +74,7 @@ struct rpmsg_virtio_config {
6874

6975
/** The flag for splitting shared memory pool to TX and RX */
7076
bool split_shpool;
71-
};
77+
} METAL_PACKED_END;
7278

7379
/** @brief Representation of a RPMsg device based on virtio */
7480
struct rpmsg_virtio_device {

lib/rpmsg/rpmsg_virtio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct vbuff_reclaimer_t {
6262
#if VIRTIO_ENABLED(VIRTIO_DRIVER_SUPPORT)
6363
#define RPMSG_VIRTIO_DEFAULT_CONFIG \
6464
(&(const struct rpmsg_virtio_config) { \
65+
.version = 1, \
6566
.h2r_buf_size = RPMSG_BUFFER_SIZE, \
6667
.r2h_buf_size = RPMSG_BUFFER_SIZE, \
6768
.split_shpool = false, \

0 commit comments

Comments
 (0)