From bf102f79e37b51b2767053a97d138ccb17df75aa Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Fri, 14 Jun 2024 11:37:41 +0200 Subject: [PATCH 1/4] lib: virtio: fix zephyr build warning Building the samples/subsys/ipc/openamp_rsc_table/ sample generates the following warning: [24/182] Building C object zephyr/CMakeFiles/zephyr.dir/lib/open-amp/resource_table.c.obj In file included from /zephyrproject/zephyr/lib/open-amp/./resource_table.h:11, from /zephyrproject/zephyr/lib/open-amp/resource_table.c:30: /zephyrproject/modules/lib/open-amp/open-amp/lib/include/openamp/virtio.h:83:2: warning: #warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined" [-Wcpp] 83 | #warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined" | ^~~~~~~ The issue occurs because the project includes the virtio API while VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT is only defined for the open-amp library build. Fix the warning by testing deprecated usage of VIRTIO_DRIVER_ONLY and VIRTIO_DEVICE_ONLY but not under #if !defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT) condition. Signed-off-by: Arnaud Pouliquen --- lib/include/openamp/virtio.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/include/openamp/virtio.h b/lib/include/openamp/virtio.h index 07103488a..f854140af 100644 --- a/lib/include/openamp/virtio.h +++ b/lib/include/openamp/virtio.h @@ -70,21 +70,17 @@ extern "C" { #define VIRTIO_DEV_DRIVER 0UL #define VIRTIO_DEV_DEVICE 1UL -#if !defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT) #ifdef VIRTIO_DRIVER_ONLY #warning "VIRTIO_DRIVER_ONLY is deprecated, please use VIRTIO_DEVICE_SUPPORT=0" #define VIRTIO_DRIVER_SUPPORT 1 #define VIRTIO_DEVICE_SUPPORT 0 -#elif VIRTIO_DEVICE_ONLY +#endif /* VIRTIO_DRIVER_ONLY */ + +#ifdef VIRTIO_DEVICE_ONLY #warning "VIRTIO_DEVICE_ONLY is deprecated, please use VIRTIO_DRIVER_SUPPORT=0" #define VIRTIO_DRIVER_SUPPORT 0 #define VIRTIO_DEVICE_SUPPORT 1 -#else -#warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined" -#define VIRTIO_DRIVER_SUPPORT 1 -#define VIRTIO_DEVICE_SUPPORT 1 -#endif /* VIRTIO_DRIVER_ONLY */ -#endif /*!defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT)*/ +#endif /* VIRTIO_DEVICE_ONLY */ #define VIRTIO_ENABLED(option) (option == 1) From 977d293233f8106db5fd16703ea60a08519ac821 Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Fri, 14 Jun 2024 11:45:12 +0200 Subject: [PATCH 2/4] lib: virtio: Rework macros VIRTIO_ROLE_IS_DEVICE and VIRTIO_ROLE_IS_DRIVER The virtio.h header can be included by applications. In such cases, VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT, which are used to optimize the library, may not be defined in the application. Define default VIRTIO_ROLE_IS_DEVICE and VIRTIO_ROLE_IS_DRIVER macros that do not check for VIRTIO_DEVICE_SUPPORT or VIRTIO_DRIVER_SUPPORT if they are not defined. Signed-off-by: Arnaud Pouliquen --- lib/include/openamp/virtio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/include/openamp/virtio.h b/lib/include/openamp/virtio.h index f854140af..c4d4927be 100644 --- a/lib/include/openamp/virtio.h +++ b/lib/include/openamp/virtio.h @@ -84,10 +84,21 @@ extern "C" { #define VIRTIO_ENABLED(option) (option == 1) +#ifdef VIRTIO_DRIVER_SUPPORT #define VIRTIO_ROLE_IS_DRIVER(vdev) \ (VIRTIO_ENABLED(VIRTIO_DRIVER_SUPPORT) && (vdev->role) == VIRTIO_DEV_DRIVER) +#else +/* Default definition without code size optimization */ +#define VIRTIO_ROLE_IS_DRIVER(vdev) (vdev->role == VIRTIO_DEV_DRIVER) +#endif + +#ifdef VIRTIO_DEVICE_SUPPORT #define VIRTIO_ROLE_IS_DEVICE(vdev) \ (VIRTIO_ENABLED(VIRTIO_DEVICE_SUPPORT) && (vdev->role) == VIRTIO_DEV_DEVICE) +#else +/* Default definition without code size optimization */ +#define VIRTIO_ROLE_IS_DEVICE(vdev) (vdev->role == VIRTIO_DEV_DEVICE) +#endif /** @brief Virtio device identifier. */ struct virtio_device_id { From ce7ea97d241034aa183f302364d28356b6a8fbb8 Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Mon, 24 Jun 2024 19:29:28 +0200 Subject: [PATCH 3/4] lib: rpmsg: Pass endpoint private data during registration This patch fixes the rpmsg_create_ept function passing the endpoint's private data that can be set by the application before the call of rpmsg_create_ept. Signed-off-by: Arnaud Pouliquen --- lib/rpmsg/rpmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rpmsg/rpmsg.c b/lib/rpmsg/rpmsg.c index 7a0e02821..39774bc17 100644 --- a/lib/rpmsg/rpmsg.c +++ b/lib/rpmsg/rpmsg.c @@ -354,7 +354,7 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev, */ } - rpmsg_register_endpoint(rdev, ept, name, addr, dest, cb, unbind_cb, NULL); + rpmsg_register_endpoint(rdev, ept, name, addr, dest, cb, unbind_cb, ept->priv); metal_mutex_release(&rdev->lock); /* Send NS announcement to remote processor */ From d8aab34e33d44f89ccd615c31cc795e4b888f0e5 Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Fri, 14 Jun 2024 11:47:44 +0200 Subject: [PATCH 4/4] release: open-amp 2024.05.1 Set library version to 1.6.1 Signed-off-by: Arnaud Pouliquen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 07f90cb33..a32a5502e 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ VERSION_MAJOR = 1 VERSION_MINOR = 6 -VERSION_PATCH = 0 +VERSION_PATCH = 1