mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 12:49:00 +00:00
openamp: update openamp and libmetal to last release version
and remove somes libmetal and openamp patches that already merged in the OpenAMP and Libmetal community. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
711c58767a
commit
dac8604f5e
29 changed files with 382 additions and 867 deletions
|
|
@ -1,28 +0,0 @@
|
|||
From b7eaa824f0f660825a7c2d601940d59141fb4f83 Mon Sep 17 00:00:00 2001
|
||||
From: wangyongrong <wangyongrong@xiaomi.com>
|
||||
Date: Tue, 2 Jul 2024 10:27:44 +0800
|
||||
Subject: [PATCH 1/5] lib/errno.h: fix compile error
|
||||
|
||||
lib/errno.h: delete defined(__arm__) for use GCC compile
|
||||
|
||||
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/errno.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/errno.h libmetal/lib/errno.h
|
||||
index 2fc4f77..e84a2bc 100644
|
||||
--- a/lib/errno.h
|
||||
+++ libmetal/lib/errno.h
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
# include <metal/compiler/iar/errno.h>
|
||||
-#elif defined(__CC_ARM) || defined(__arm__)
|
||||
+#elif defined(__CC_ARM)
|
||||
# include <metal/compiler/armcc/errno.h>
|
||||
#else
|
||||
# include <errno.h>
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From fad5ddc80345f97a0c7b20c545502ac1f8e321a5 Mon Sep 17 00:00:00 2001
|
||||
From: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
Date: Thu, 18 Dec 2025 17:26:13 +0800
|
||||
Subject: [PATCH] libmetal(cmake):set HAVE_STDATOMIC_H default true in NuttX
|
||||
platform
|
||||
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
cmake/depends.cmake | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/depends.cmake libmetal/cmake/depends.cmake
|
||||
index cb53903..15683f8 100644
|
||||
--- a/cmake/depends.cmake
|
||||
+++ libmetal/cmake/depends.cmake
|
||||
@@ -24,7 +24,13 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
find_package(LibRt REQUIRED)
|
||||
collect (PROJECT_LIB_DEPS "${LIBRT_LIBRARIES}")
|
||||
|
||||
-elseif (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "NuttX")
|
||||
+elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "NuttX")
|
||||
+
|
||||
+ # there is no need to use cmake include detection
|
||||
+ # under NuttX platform
|
||||
+ set(HAVE_STDATOMIC_H true)
|
||||
+
|
||||
+else ()
|
||||
|
||||
# TODO: fix for find_path() to detect stdatomic.h
|
||||
# find_path (HAVE_STDATOMIC_H stdatomic.h)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 5f90973cb572ec8df29ea03550eef29afa48015b Mon Sep 17 00:00:00 2001
|
||||
From a4f6ac1cb1545fdadf7f80cf34f1d31b15d543f7 Mon Sep 17 00:00:00 2001
|
||||
From: Xiang Xiao <xiaoxiang@xiaomi.com>
|
||||
Date: Mon, 7 Jan 2019 02:15:42 +0800
|
||||
Subject: [PATCH 01/14] ns: acknowledge the received creation message
|
||||
Subject: [PATCH 01/10] ns: acknowledge the received creation message
|
||||
|
||||
the two phase handshake make the client could initiate the transfer
|
||||
immediately without the server side send any dummy message first.
|
||||
|
|
@ -17,7 +17,7 @@ Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
|||
5 files changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
|
||||
index f994e1d..b2a9b17 100644
|
||||
index 8871cfef88..0a4b47bae9 100644
|
||||
--- a/lib/include/openamp/rpmsg.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg.h
|
||||
@@ -155,6 +155,9 @@ struct rpmsg_device {
|
||||
|
|
@ -31,7 +31,7 @@ index f994e1d..b2a9b17 100644
|
|||
|
||||
/**
|
||||
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
index 44ac4c0..6d6925f 100644
|
||||
index dbbbbfd245..b738e618cf 100644
|
||||
--- a/lib/include/openamp/rpmsg_virtio.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
@@ -29,6 +29,7 @@ extern "C" {
|
||||
|
|
@ -40,13 +40,13 @@ index 44ac4c0..6d6925f 100644
|
|||
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
|
||||
+#define VIRTIO_RPMSG_F_ACK 1 /* RP supports name service acknowledge */
|
||||
|
||||
#ifdef VIRTIO_CACHED_BUFFERS
|
||||
#warning "VIRTIO_CACHED_BUFFERS is deprecated, please use VIRTIO_USE_DCACHE"
|
||||
#if defined(VIRTIO_USE_DCACHE)
|
||||
#define BUFFER_FLUSH(x, s) metal_cache_flush(x, s)
|
||||
diff --git a/lib/rpmsg/rpmsg.c open-amp/lib/rpmsg/rpmsg.c
|
||||
index 39774bc..8ab59e1 100644
|
||||
index b13e25fd23..28a8de61b3 100644
|
||||
--- a/lib/rpmsg/rpmsg.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg.c
|
||||
@@ -357,10 +357,13 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
|
||||
@@ -362,10 +362,13 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
|
||||
rpmsg_register_endpoint(rdev, ept, name, addr, dest, cb, unbind_cb, ept->priv);
|
||||
metal_mutex_release(&rdev->lock);
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ index 39774bc..8ab59e1 100644
|
|||
if (status)
|
||||
rpmsg_unregister_endpoint(ept);
|
||||
diff --git a/lib/rpmsg/rpmsg_internal.h open-amp/lib/rpmsg/rpmsg_internal.h
|
||||
index 27b0f0d..1011b42 100644
|
||||
index 27b0f0d1b0..3e9ff02cb3 100644
|
||||
--- a/lib/rpmsg/rpmsg_internal.h
|
||||
+++ open-amp/lib/rpmsg/rpmsg_internal.h
|
||||
@@ -44,6 +44,8 @@ enum rpmsg_ns_flags {
|
||||
|
|
@ -75,10 +75,10 @@ index 27b0f0d..1011b42 100644
|
|||
|
||||
/**
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 7baaedd..820227e 100644
|
||||
index ed3f4920c9..d59bad5d79 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -656,7 +656,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
@@ -668,7 +668,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
*/
|
||||
ept_to_release = _ept && _ept->release_cb;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ index 7baaedd..820227e 100644
|
|||
if (_ept)
|
||||
_ept->dest_addr = RPMSG_ADDR_ANY;
|
||||
if (ept_to_release)
|
||||
@@ -671,7 +671,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
@@ -683,7 +683,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
rpmsg_ept_decref(_ept);
|
||||
metal_mutex_release(&rdev->lock);
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ index 7baaedd..820227e 100644
|
|||
if (!_ept) {
|
||||
/*
|
||||
* send callback to application, that can
|
||||
@@ -685,7 +685,14 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
@@ -697,7 +697,14 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
} else {
|
||||
_ept->dest_addr = dest;
|
||||
metal_mutex_release(&rdev->lock);
|
||||
|
|
@ -111,15 +111,15 @@ index 7baaedd..820227e 100644
|
|||
}
|
||||
|
||||
return RPMSG_SUCCESS;
|
||||
@@ -828,6 +835,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
@@ -840,6 +847,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
if (status)
|
||||
return status;
|
||||
rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS));
|
||||
+ rdev->support_ack = !!(features & (1 << VIRTIO_RPMSG_F_ACK));
|
||||
|
||||
if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
|
||||
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
|
||||
/*
|
||||
@@ -926,7 +934,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
@@ -938,7 +946,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
* Create name service announcement endpoint if device supports name
|
||||
* service announcement feature.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
From a12f4359e3d4382e31a0f6f6983184b635fd0611 Mon Sep 17 00:00:00 2001
|
||||
From 4f552ae6fa88eec2a42c3933ea201ab71555838c Mon Sep 17 00:00:00 2001
|
||||
From: anchao <anchao@pinecone.net>
|
||||
Date: Mon, 10 Dec 2018 16:26:39 +0800
|
||||
Subject: [PATCH 02/14] Negotiate individual buffer size dynamically
|
||||
Subject: [PATCH 02/10] Negotiate individual buffer size dynamically
|
||||
|
||||
Change config type from fw_rsc_config to rpmsg_virtio_config
|
||||
to avoid rpmsg_vitio.h couple with remoteproc.h.
|
||||
|
|
@ -19,7 +19,7 @@ Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
|||
3 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/lib/include/openamp/remoteproc.h open-amp/lib/include/openamp/remoteproc.h
|
||||
index 84bf233..abc5481 100644
|
||||
index 29b28ed0ad..aadc7a798f 100644
|
||||
--- a/lib/include/openamp/remoteproc.h
|
||||
+++ open-amp/lib/include/openamp/remoteproc.h
|
||||
@@ -361,6 +361,21 @@ struct fw_rsc_vendor {
|
||||
|
|
@ -45,7 +45,7 @@ index 84bf233..abc5481 100644
|
|||
struct image_store_ops;
|
||||
struct remoteproc_ops;
|
||||
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
index 6d6925f..d9cfa9b 100644
|
||||
index b738e618cf..a757166082 100644
|
||||
--- a/lib/include/openamp/rpmsg_virtio.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
@@ -30,6 +30,7 @@ extern "C" {
|
||||
|
|
@ -54,21 +54,21 @@ index 6d6925f..d9cfa9b 100644
|
|||
#define VIRTIO_RPMSG_F_ACK 1 /* RP supports name service acknowledge */
|
||||
+#define VIRTIO_RPMSG_F_BUFSZ 2 /* RP supports get buffer size from config space */
|
||||
|
||||
#ifdef VIRTIO_CACHED_BUFFERS
|
||||
#warning "VIRTIO_CACHED_BUFFERS is deprecated, please use VIRTIO_USE_DCACHE"
|
||||
#if defined(VIRTIO_USE_DCACHE)
|
||||
#define BUFFER_FLUSH(x, s) metal_cache_flush(x, s)
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 820227e..94c4b95 100644
|
||||
index d59bad5d79..8654e7d8b8 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <metal/sleep.h>
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <metal/sys.h>
|
||||
#include <metal/utilities.h>
|
||||
#include <openamp/rpmsg_virtio.h>
|
||||
+#include <openamp/remoteproc.h>
|
||||
#include <openamp/virtqueue.h>
|
||||
|
||||
#include "rpmsg_internal.h"
|
||||
@@ -790,6 +791,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
@@ -802,6 +803,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
struct rpmsg_device *rdev;
|
||||
const char *vq_names[RPMSG_NUM_VRINGS];
|
||||
vq_callback callback[RPMSG_NUM_VRINGS];
|
||||
|
|
@ -76,7 +76,7 @@ index 820227e..94c4b95 100644
|
|||
uint32_t features;
|
||||
int status;
|
||||
unsigned int i;
|
||||
@@ -836,6 +838,11 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
@@ -848,6 +850,11 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
return status;
|
||||
rdev->support_ns = !!(features & (1 << VIRTIO_RPMSG_F_NS));
|
||||
rdev->support_ack = !!(features & (1 << VIRTIO_RPMSG_F_ACK));
|
||||
|
|
@ -86,7 +86,7 @@ index 820227e..94c4b95 100644
|
|||
+ rvdev->config.r2h_buf_size = fw_config.r2h_buf_size;
|
||||
+ }
|
||||
|
||||
if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
|
||||
if (VIRTIO_ROLE_IS_DRIVER(vdev)) {
|
||||
/*
|
||||
--
|
||||
2.34.1
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
From 6842947d3cd08748b8d44fd771a53a86ddfc8dac Mon Sep 17 00:00:00 2001
|
||||
From: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Date: Fri, 19 Jul 2024 17:40:51 +0800
|
||||
Subject: [PATCH 3/5] atomic.h: fix compiler error
|
||||
|
||||
/home/wyr/work/code/velasim/upgrade/nuttx/include/metal/compiler/gcc/atomic.h:19:13: error: conflicting type qualifiers for 'atomic_flag'
|
||||
19 | typedef int atomic_flag;
|
||||
| ^~~~~~~~~~~
|
||||
In file included from /home/wyr/work/code/velasim/upgrade/nuttx/include/nuttx/net/netdev_lowerhalf.h:38,
|
||||
from virtio/virtio-net.c:33:
|
||||
/home/wyr/work/code/velasim/upgrade/prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/stdatomic.h:233:3: note: previous declaration of 'atomic_flag' with type 'atomic_flag'
|
||||
233 | } atomic_flag;
|
||||
| ^~~~~~~~~~~
|
||||
/home/wyr/work/code/velasim/upgrade/nuttx/include/metal/compiler/gcc/atomic.h:20:14: error: conflicting type qualifiers for 'atomic_char'
|
||||
20 | typedef char atomic_char;
|
||||
| ^~~~~~~~~~~
|
||||
/home/wyr/work/code/velasim/upgrade/prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/stdatomic.h:41:22: note: previous declaration of 'atomic_char' with type 'atomic_char' {aka '_Atomic char'}
|
||||
41 | typedef _Atomic char atomic_char;
|
||||
| ^~~~~~~~~~~
|
||||
/home/wyr/work/code/velasim/upgrade/nuttx/include/metal/compiler/gcc/atomic.h:21:23: error: conflicting type qualifiers for 'atomic_uchar'
|
||||
21 | typedef unsigned char atomic_uchar;
|
||||
| ^~~~~~~~~~~~
|
||||
/home/wyr/work/code/velasim/upgrade/prebuilts/gcc/linux/arm/lib/gcc/arm-none-eabi/13.2.1/include/stdatomic.h:43:31: note: previous declaration of 'atomic_uchar' with type 'atomic_uchar' {aka '_Atomic unsigned char'}
|
||||
43 | typedef _Atomic unsigned char atomic_uchar;
|
||||
| ^~~~~~~~~~~~
|
||||
/home/wyr/work/code/velasim/upgrade/nuttx/include/metal/compiler/gcc/atomic.h:22:15: error: conflicting type qualifiers for 'atomic_short'
|
||||
22 | typedef short atomic_short;
|
||||
|
||||
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/atomic.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/atomic.h libmetal/lib/atomic.h
|
||||
index 2f4ab04..fe2c1e0 100644
|
||||
--- a/lib/atomic.h
|
||||
+++ libmetal/lib/atomic.h
|
||||
@@ -100,8 +100,8 @@ using std::atomic_fetch_and_explicit;
|
||||
using std::atomic_thread_fence;
|
||||
using std::atomic_signal_fence;
|
||||
|
||||
-#elif defined(HAVE_STDATOMIC_H) && !defined(__CC_ARM) && !defined(__arm__) && \
|
||||
- !defined(__STDC_NO_ATOMICS__)
|
||||
+#elif defined(HAVE_STDATOMIC_H) && !defined(__STDC_NO_ATOMICS__) && \
|
||||
+ ((!defined(__CC_ARM) && !defined(__arm__)) || defined(__GNUC__))
|
||||
# include <stdint.h>
|
||||
# include <stdatomic.h>
|
||||
#elif defined(__GNUC__)
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From ccedce5807709d184a9fe89529e611a556f0bf23 Mon Sep 17 00:00:00 2001
|
||||
From 0fd409ef494b47464f57667b24fce91a4f1a5753 Mon Sep 17 00:00:00 2001
|
||||
From: ligd <liguiding1@xiaomi.com>
|
||||
Date: Tue, 19 Oct 2021 19:45:14 +0800
|
||||
Subject: [PATCH 03/14] rpmsg: notify the user when the remote address is
|
||||
Subject: [PATCH 03/10] rpmsg: notify the user when the remote address is
|
||||
received
|
||||
|
||||
Signed-off-by: ligd <liguiding1@xiaomi.com>
|
||||
|
|
@ -12,7 +12,7 @@ Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
|||
2 files changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
|
||||
index b2a9b17..bb1c160 100644
|
||||
index 0a4b47bae9..a0e351af68 100644
|
||||
--- a/lib/include/openamp/rpmsg.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg.h
|
||||
@@ -52,6 +52,7 @@ struct rpmsg_device;
|
||||
|
|
@ -34,10 +34,10 @@ index b2a9b17..bb1c160 100644
|
|||
rpmsg_ns_unbind_cb ns_unbind_cb;
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 94c4b95..ad9a730 100644
|
||||
index 8654e7d8b8..cc6c2fd52f 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -683,17 +683,28 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
@@ -695,17 +695,28 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
|
||||
metal_mutex_release(&rdev->lock);
|
||||
if (rdev->ns_bind_cb)
|
||||
rdev->ns_bind_cb(rdev, name, dest);
|
||||
|
|
|
|||
|
|
@ -1,155 +0,0 @@
|
|||
From f003d671f816b319ad0f8d017022c93b438b78b3 Mon Sep 17 00:00:00 2001
|
||||
From: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Date: Mon, 9 Sep 2024 19:46:37 +0800
|
||||
Subject: [PATCH 4/5] lib/system/nuttx: fix unused parameter compile error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
/home/wyr/work/code/project/cardev/nuttx/openamp/libmetal/lib/system/nuttx/device.c:16:22: error: 'io' undeclared (first use in this function)
|
||||
16 | metal_unused(io);
|
||||
/home/wyr/work/code/project/cardev/nuttx/openamp/libmetal/lib/system/nuttx/device.c:14:53: error: unused parameter 'dev' [-Werror=unused-parameter]
|
||||
14 | int metal_generic_dev_sys_open(struct metal_device *dev)
|
||||
|
||||
error: unused parameter ‘addr’ [-Werror=unused-parameter]
|
||||
25 | static inline void __metal_cache_flush(void *addr, unsigned int len)
|
||||
| ~~~~~~^~~~
|
||||
error: unused parameter ‘len’ [-Werror=unused-parameter]
|
||||
25 | static inline void __metal_cache_flush(void *addr, unsigned int len)
|
||||
| ~~~~~~~~~~~~~^~~
|
||||
|
||||
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/system/nuttx/cache.h | 5 +++++
|
||||
lib/system/nuttx/device.c | 1 +
|
||||
lib/system/nuttx/init.c | 1 +
|
||||
lib/system/nuttx/io.c | 6 ++++++
|
||||
lib/system/nuttx/io.h | 3 +++
|
||||
5 files changed, 16 insertions(+)
|
||||
|
||||
diff --git a/lib/system/nuttx/cache.h libmetal/lib/system/nuttx/cache.h
|
||||
index e3b6052..22b94b4 100644
|
||||
--- a/lib/system/nuttx/cache.h
|
||||
+++ libmetal/lib/system/nuttx/cache.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#ifndef __METAL_NUTTX_CACHE__H__
|
||||
#define __METAL_NUTTX_CACHE__H__
|
||||
|
||||
+#include <metal/utilities.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -24,11 +25,15 @@ extern "C" {
|
||||
|
||||
static inline void __metal_cache_flush(void *addr, unsigned int len)
|
||||
{
|
||||
+ metal_unused(addr);
|
||||
+ metal_unused(len);
|
||||
up_clean_dcache((uintptr_t)addr, (uintptr_t)addr + len);
|
||||
}
|
||||
|
||||
static inline void __metal_cache_invalidate(void *addr, unsigned int len)
|
||||
{
|
||||
+ metal_unused(addr);
|
||||
+ metal_unused(len);
|
||||
up_invalidate_dcache((uintptr_t)addr, (uintptr_t)addr + len);
|
||||
}
|
||||
|
||||
diff --git a/lib/system/nuttx/device.c libmetal/lib/system/nuttx/device.c
|
||||
index 7e66ab3..2c828ab 100644
|
||||
--- a/lib/system/nuttx/device.c
|
||||
+++ libmetal/lib/system/nuttx/device.c
|
||||
@@ -13,5 +13,6 @@
|
||||
|
||||
int metal_generic_dev_sys_open(struct metal_device *dev)
|
||||
{
|
||||
+ metal_unused(dev);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/lib/system/nuttx/init.c libmetal/lib/system/nuttx/init.c
|
||||
index 8d59784..2519dc6 100644
|
||||
--- a/lib/system/nuttx/init.c
|
||||
+++ libmetal/lib/system/nuttx/init.c
|
||||
@@ -19,6 +19,7 @@ int metal_sys_init(const struct metal_init_params *params)
|
||||
{
|
||||
int ret = metal_cntr_irq_init();
|
||||
|
||||
+ metal_unused(params);
|
||||
if (ret >= 0)
|
||||
ret = metal_bus_register(&metal_generic_bus);
|
||||
return ret;
|
||||
diff --git a/lib/system/nuttx/io.c libmetal/lib/system/nuttx/io.c
|
||||
index ab9bc6a..41697a7 100644
|
||||
--- a/lib/system/nuttx/io.c
|
||||
+++ libmetal/lib/system/nuttx/io.c
|
||||
@@ -15,6 +15,7 @@ static uint64_t metal_io_read_(struct metal_io_region *io,
|
||||
{
|
||||
uint64_t value = 0;
|
||||
|
||||
+ metal_unused(order);
|
||||
metal_io_block_read(io, offset, &value, width);
|
||||
return value;
|
||||
}
|
||||
@@ -25,6 +26,7 @@ static void metal_io_write_(struct metal_io_region *io,
|
||||
memory_order order,
|
||||
int width)
|
||||
{
|
||||
+ metal_unused(order);
|
||||
metal_io_block_write(io, offset, &value, width);
|
||||
}
|
||||
|
||||
@@ -36,6 +38,7 @@ static int metal_io_block_read_(struct metal_io_region *io,
|
||||
{
|
||||
void *va = metal_io_virt(io, offset);
|
||||
|
||||
+ metal_unused(order);
|
||||
metal_cache_invalidate(va, len);
|
||||
if (len == 1)
|
||||
*(uint8_t *)dst = *(uint8_t *)va;
|
||||
@@ -60,6 +63,7 @@ static int metal_io_block_write_(struct metal_io_region *io,
|
||||
{
|
||||
void *va = metal_io_virt(io, offset);
|
||||
|
||||
+ metal_unused(order);
|
||||
if (len == 1)
|
||||
*(uint8_t *)va = *(uint8_t *)src;
|
||||
else if (len == 2)
|
||||
@@ -85,12 +89,14 @@ static void metal_io_block_set_(struct metal_io_region *io,
|
||||
{
|
||||
void *va = metal_io_virt(io, offset);
|
||||
|
||||
+ metal_unused(order);
|
||||
memset(va, value, len);
|
||||
metal_cache_flush(va, len);
|
||||
}
|
||||
|
||||
static void metal_io_close_(struct metal_io_region *io)
|
||||
{
|
||||
+ metal_unused(io);
|
||||
}
|
||||
|
||||
static metal_phys_addr_t metal_io_offset_to_phys_(struct metal_io_region *io,
|
||||
diff --git a/lib/system/nuttx/io.h libmetal/lib/system/nuttx/io.h
|
||||
index 7f6508d..743b7b1 100644
|
||||
--- a/lib/system/nuttx/io.h
|
||||
+++ libmetal/lib/system/nuttx/io.h
|
||||
@@ -16,6 +16,8 @@
|
||||
#ifndef __METAL_NUTTX_IO__H__
|
||||
#define __METAL_NUTTX_IO__H__
|
||||
|
||||
+#include <metal/utilities.h>
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -39,6 +41,7 @@ struct metal_io_region *metal_io_get_region(void);
|
||||
*/
|
||||
static inline void metal_sys_io_mem_map(struct metal_io_region *io)
|
||||
{
|
||||
+ metal_unused(io);
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
From 17ca934563b3d62f950f5d1693d89556495d150f Mon Sep 17 00:00:00 2001
|
||||
From: wangyongrong <wangyongrong@xiaomi.com>
|
||||
Date: Tue, 2 Jul 2024 16:33:32 +0800
|
||||
Subject: [PATCH 04/14] openamp/virtio.h: negotiate_features also can be call
|
||||
when final_features is NULL
|
||||
|
||||
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/include/openamp/virtio.h | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/virtio.h open-amp/lib/include/openamp/virtio.h
|
||||
index c4d4927..278d2da 100644
|
||||
--- a/lib/include/openamp/virtio.h
|
||||
+++ open-amp/lib/include/openamp/virtio.h
|
||||
@@ -468,13 +468,15 @@ static inline int virtio_negotiate_features(struct virtio_device *vdev,
|
||||
uint32_t features,
|
||||
uint32_t *final_features)
|
||||
{
|
||||
- if (!vdev || !final_features)
|
||||
+ if (!vdev)
|
||||
return -EINVAL;
|
||||
|
||||
if (!vdev->func || !vdev->func->negotiate_features)
|
||||
return -ENXIO;
|
||||
|
||||
- *final_features = vdev->func->negotiate_features(vdev, features);
|
||||
+ vdev->features = vdev->func->negotiate_features(vdev, features);
|
||||
+ if (final_features)
|
||||
+ *final_features = vdev->features;
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 9ed3332f08c9877deb4dcabb7447b634abe8845e Mon Sep 17 00:00:00 2001
|
||||
From a2c5e7e101392eb8b72acd608b81b525c643cf4a Mon Sep 17 00:00:00 2001
|
||||
From: ligd <liguiding@pinecone.net>
|
||||
Date: Wed, 20 Feb 2019 11:36:57 +0800
|
||||
Subject: [PATCH 06/14] rpmsg: wait ept ready in rpmsg_send
|
||||
Subject: [PATCH 04/10] rpmsg: wait ept ready in rpmsg_send
|
||||
|
||||
since the destination address need time to return from peer
|
||||
|
||||
|
|
@ -9,11 +9,11 @@ Signed-off-by: ligd <liguiding@pinecone.net>
|
|||
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/include/openamp/rpmsg.h | 59 ++++++++++++++++++++++++++-----------
|
||||
lib/rpmsg/rpmsg_virtio.c | 7 -----
|
||||
2 files changed, 42 insertions(+), 24 deletions(-)
|
||||
lib/rpmsg/rpmsg_virtio.c | 6 ----
|
||||
2 files changed, 42 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
|
||||
index bb1c160..cb1a648 100644
|
||||
index a0e351af68..3f4c6c7fc6 100644
|
||||
--- a/lib/include/openamp/rpmsg.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg.h
|
||||
@@ -15,6 +15,7 @@
|
||||
|
|
@ -124,18 +124,10 @@ index bb1c160..cb1a648 100644
|
|||
}
|
||||
#endif
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index db3392e..e6a4969 100644
|
||||
index cc6c2fd52f..0e2885c732 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include <metal/alloc.h>
|
||||
-#include <metal/sleep.h>
|
||||
#include <metal/utilities.h>
|
||||
#include <openamp/rpmsg_virtio.h>
|
||||
#include <openamp/remoteproc.h>
|
||||
@@ -19,12 +18,6 @@
|
||||
@@ -20,12 +20,6 @@
|
||||
|
||||
#define RPMSG_NUM_VRINGS 2
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
From 2b9bd97db33d95c4d6d40e6f0ec1fa388fac3ab0 Mon Sep 17 00:00:00 2001
|
||||
From: xuxin19 <xuxin19@xiaomi.com>
|
||||
Date: Fri, 6 Sep 2024 10:56:49 +0800
|
||||
Subject: [PATCH 5/5] libmetal(cmake):set HAVE_STDATOMIC_H default true in
|
||||
NuttX platform
|
||||
|
||||
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
|
||||
---
|
||||
cmake/depends.cmake | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmake/depends.cmake libmetal/cmake/depends.cmake
|
||||
index 60b9739..15683f8 100644
|
||||
--- a/cmake/depends.cmake
|
||||
+++ libmetal/cmake/depends.cmake
|
||||
@@ -24,7 +24,13 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
find_package(LibRt REQUIRED)
|
||||
collect (PROJECT_LIB_DEPS "${LIBRT_LIBRARIES}")
|
||||
|
||||
-else ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
+elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "NuttX")
|
||||
+
|
||||
+ # there is no need to use cmake include detection
|
||||
+ # under NuttX platform
|
||||
+ set(HAVE_STDATOMIC_H true)
|
||||
+
|
||||
+else ()
|
||||
|
||||
# TODO: fix for find_path() to detect stdatomic.h
|
||||
# find_path (HAVE_STDATOMIC_H stdatomic.h)
|
||||
@@ -33,5 +39,5 @@ else ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
check_include_files (stdatomic.h HAVE_STDATOMIC_H)
|
||||
set (CMAKE_REQUIRED_FLAGS ${_saved_cmake_required_flags})
|
||||
|
||||
-endif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
+endif ()
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 9a8e63285c30026a8fabaf0ed8af323eafd07539 Mon Sep 17 00:00:00 2001
|
||||
From 7c6597d46da6d1c3c085dda33262c89b633707ae Mon Sep 17 00:00:00 2001
|
||||
From: ligd <liguiding1@xiaomi.com>
|
||||
Date: Thu, 23 Jun 2022 00:41:13 +0800
|
||||
Subject: [PATCH 07/14] openamp: add VIRTIO_RING_F_MUST_NOTIFY event
|
||||
Subject: [PATCH 05/10] openamp: add VIRTIO_RING_F_MUST_NOTIFY event
|
||||
|
||||
Signed-off-by: ligd <liguiding1@xiaomi.com>
|
||||
---
|
||||
|
|
@ -10,7 +10,7 @@ Signed-off-by: ligd <liguiding1@xiaomi.com>
|
|||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/lib/include/openamp/virtqueue.h open-amp/lib/include/openamp/virtqueue.h
|
||||
index 8194398..dd42c3a 100644
|
||||
index 7921948c8e..92a4a87f10 100644
|
||||
--- a/lib/include/openamp/virtqueue.h
|
||||
+++ open-amp/lib/include/openamp/virtqueue.h
|
||||
@@ -48,6 +48,9 @@ extern "C" {
|
||||
|
|
@ -20,14 +20,14 @@ index 8194398..dd42c3a 100644
|
|||
+/* Support to can't suppress interrupt. */
|
||||
+#define VIRTIO_RING_F_MUST_NOTIFY (1 << 30)
|
||||
+
|
||||
/* cache invalidation helpers */
|
||||
#define CACHE_FLUSH(x, s) metal_cache_flush(x, s)
|
||||
#define CACHE_INVALIDATE(x, s) metal_cache_invalidate(x, s)
|
||||
#if defined(VIRTIO_USE_DCACHE)
|
||||
#define VRING_FLUSH(x, s) metal_cache_flush(x, s)
|
||||
#define VRING_INVALIDATE(x, s) metal_cache_invalidate(x, s)
|
||||
diff --git a/lib/virtio/virtqueue.c open-amp/lib/virtio/virtqueue.c
|
||||
index 363fda8..7ffe569 100644
|
||||
index ed7af3fccd..d2738faaba 100644
|
||||
--- a/lib/virtio/virtqueue.c
|
||||
+++ open-amp/lib/virtio/virtqueue.c
|
||||
@@ -609,6 +609,9 @@ static int vq_ring_must_notify(struct virtqueue *vq)
|
||||
@@ -633,6 +633,9 @@ static int vq_ring_must_notify(struct virtqueue *vq)
|
||||
{
|
||||
uint16_t new_idx, prev_idx, event_idx;
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
From 8892766fc72db6d607e2057be0cf7386ee7fea14 Mon Sep 17 00:00:00 2001
|
||||
From: wangyongrong <wangyongrong@xiaomi.com>
|
||||
Date: Wed, 3 Jul 2024 10:00:34 +0800
|
||||
Subject: [PATCH 05/14] remoteproc/rpmsg_virtio: change sched_yeild to usleep
|
||||
|
||||
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/remoteproc/remoteproc_virtio.c | 3 ++-
|
||||
lib/rpmsg/rpmsg_virtio.c | 3 +--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/remoteproc/remoteproc_virtio.c open-amp/lib/remoteproc/remoteproc_virtio.c
|
||||
index ef39c49..aae026c 100644
|
||||
--- a/lib/remoteproc/remoteproc_virtio.c
|
||||
+++ open-amp/lib/remoteproc/remoteproc_virtio.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <metal/cpu.h>
|
||||
#include <metal/utilities.h>
|
||||
#include <metal/alloc.h>
|
||||
+#include <metal/sleep.h>
|
||||
|
||||
static void rproc_virtio_delete_virtqueues(struct virtio_device *vdev)
|
||||
{
|
||||
@@ -412,6 +413,6 @@ void rproc_virtio_wait_remote_ready(struct virtio_device *vdev)
|
||||
status = rproc_virtio_get_status(vdev);
|
||||
if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
|
||||
return;
|
||||
- metal_cpu_yield();
|
||||
+ metal_sleep_usec(1000);
|
||||
}
|
||||
}
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index ad9a730..db3392e 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -272,8 +272,7 @@ static int rpmsg_virtio_wait_remote_ready(struct rpmsg_virtio_device *rvdev)
|
||||
} else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
|
||||
return 0;
|
||||
}
|
||||
- /* TODO: clarify metal_cpu_yield usage*/
|
||||
- metal_cpu_yield();
|
||||
+ metal_sleep_usec(1000);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From b9181b30e8fc1c7ee058b34e6cfe2f54c43af665 Mon Sep 17 00:00:00 2001
|
||||
From: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
Date: Wed, 9 Oct 2024 20:54:56 +0800
|
||||
Subject: [PATCH 6/6] lib/system/nuttx/io.c: include <stddef.h> in nuttx/io.c
|
||||
|
||||
Because nuttx/io.c use NULL and NULL is defined in <stddef.h>
|
||||
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/system/nuttx/io.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/system/nuttx/io.c libmetal/lib/system/nuttx/io.c
|
||||
index 41697a7..cc5e0a7 100644
|
||||
--- a/lib/system/nuttx/io.c
|
||||
+++ libmetal/lib/system/nuttx/io.c
|
||||
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
+#include <stddef.h>
|
||||
#include <metal/cache.h>
|
||||
#include <metal/io.h>
|
||||
#include <nuttx/arch.h>
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From b092024f77f34c679b0537f6481947d297bca281 Mon Sep 17 00:00:00 2001
|
||||
From 8dcd7daec66939841c10872a0ca310ac16f10be2 Mon Sep 17 00:00:00 2001
|
||||
From: wangyongrong <wangyongrong@xiaomi.com>
|
||||
Date: Wed, 3 Jul 2024 10:28:31 +0800
|
||||
Subject: [PATCH 08/14] rpmsg_virtio: don't need check status when
|
||||
Subject: [PATCH 06/10] rpmsg_virtio: don't need check status when
|
||||
get_tx_payload
|
||||
|
||||
Signed-off-by: ligd <liguiding1@xiaomi.com>
|
||||
|
|
@ -10,10 +10,10 @@ Signed-off-by: ligd <liguiding1@xiaomi.com>
|
|||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index e6a4969..9dd14b6 100644
|
||||
index 0e2885c732..6df5a52a48 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -352,7 +352,6 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
@@ -355,7 +355,6 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
{
|
||||
struct rpmsg_virtio_device *rvdev;
|
||||
struct rpmsg_hdr *rp_hdr;
|
||||
|
|
@ -21,7 +21,7 @@ index e6a4969..9dd14b6 100644
|
|||
uint16_t idx;
|
||||
int tick_count;
|
||||
int status;
|
||||
@@ -360,11 +359,6 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
@@ -363,11 +362,6 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
/* Get the associated remote device for channel. */
|
||||
rvdev = metal_container_of(rdev, struct rpmsg_virtio_device, rdev);
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
From a120e0e698ff3f7af8bfee34a47051f13b74aac0 Mon Sep 17 00:00:00 2001
|
||||
From: chao an <anchao.archer@bytedance.com>
|
||||
Date: Thu, 9 Oct 2025 19:39:01 +0800
|
||||
Subject: [PATCH] libmetal/nuttx: Update function prototype changes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
clock_systime_timespec() always returns 0, so there is no need to
|
||||
check the return value in the caller code, let us remove the return
|
||||
value directly.
|
||||
|
||||
From:
|
||||
int clock_systime_timespec(FAR struct timespec *ts)
|
||||
To:
|
||||
void clock_systime_timespec(FAR struct timespec *ts)
|
||||
|
||||
Fix build break:
|
||||
|
||||
libmetal/lib/system/nuttx/time.c: In function ‘metal_get_timestamp’:
|
||||
libmetal/lib/system/nuttx/time.c:21:11: error: void value not ignored as it ought to be
|
||||
21 | r = clock_systime_timespec(&tp);
|
||||
| ^
|
||||
make[1]: *** [Makefile:46: libmetal/lib/system/nuttx/time.o] Error 1
|
||||
|
||||
Change-Id: I88443c4a5725bd269a05c8a503bd5095b082bfbe
|
||||
---
|
||||
lib/system/nuttx/time.c | 13 ++++++-------
|
||||
1 file changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/lib/system/nuttx/time.c libmetal/lib/system/nuttx/time.c
|
||||
index 986f1ba..f06725d 100644
|
||||
--- a/lib/system/nuttx/time.c
|
||||
+++ libmetal/lib/system/nuttx/time.c
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
unsigned long long metal_get_timestamp(void)
|
||||
{
|
||||
- unsigned long long t = 0;
|
||||
+ unsigned long long t;
|
||||
struct timespec tp;
|
||||
- int r;
|
||||
|
||||
- r = clock_systime_timespec(&tp);
|
||||
- if (!r) {
|
||||
- t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC;
|
||||
- t += tp.tv_nsec;
|
||||
- }
|
||||
+ clock_systime_timespec(&tp);
|
||||
+
|
||||
+ t = (unsigned long long)tp.tv_sec * NSEC_PER_SEC;
|
||||
+ t += tp.tv_nsec;
|
||||
+
|
||||
return t;
|
||||
}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
From bbaf772058b44a383b4ef81676eccd7a1b503c09 Mon Sep 17 00:00:00 2001
|
||||
From: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
Date: Wed, 20 Nov 2024 10:43:16 +0800
|
||||
Subject: [PATCH 07/10] virtqueue: move virtqueue_nused and virtqueue_navail to
|
||||
public
|
||||
|
||||
Use these two apis to judge whether there is buffers in the virtqueues
|
||||
to be processed.
|
||||
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/include/openamp/virtqueue.h | 18 ++++++++
|
||||
lib/virtio/virtqueue.c | 80 ++++++++++++++++-----------------
|
||||
2 files changed, 57 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/virtqueue.h open-amp/lib/include/openamp/virtqueue.h
|
||||
index 92a4a87f10..2d42219be5 100644
|
||||
--- a/lib/include/openamp/virtqueue.h
|
||||
+++ open-amp/lib/include/openamp/virtqueue.h
|
||||
@@ -428,6 +428,24 @@ static inline int virtqueue_full(struct virtqueue *vq)
|
||||
return (vq->vq_free_cnt == 0);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * @brief Get number of used buffers in virtqueue
|
||||
+ *
|
||||
+ * @param vq Pointer to VirtIO queue control block
|
||||
+ *
|
||||
+ * @return Number of used buffers
|
||||
+ */
|
||||
+int virtqueue_nused(struct virtqueue *vq);
|
||||
+
|
||||
+/**
|
||||
+ * @brief Get number of available buffers in virtqueue
|
||||
+ *
|
||||
+ * @param vq Pointer to VirtIO queue control block
|
||||
+ *
|
||||
+ * @return Number of available buffers
|
||||
+ */
|
||||
+int virtqueue_navail(struct virtqueue *vq);
|
||||
+
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
diff --git a/lib/virtio/virtqueue.c open-amp/lib/virtio/virtqueue.c
|
||||
index d2738faaba..69e3572cd1 100644
|
||||
--- a/lib/virtio/virtqueue.c
|
||||
+++ open-amp/lib/virtio/virtqueue.c
|
||||
@@ -21,8 +21,6 @@ static int vq_ring_enable_interrupt(struct virtqueue *, uint16_t);
|
||||
static void vq_ring_free_chain(struct virtqueue *, uint16_t);
|
||||
static int vq_ring_must_notify(struct virtqueue *vq);
|
||||
static void vq_ring_notify(struct virtqueue *vq);
|
||||
-static int virtqueue_nused(struct virtqueue *vq);
|
||||
-static int virtqueue_navail(struct virtqueue *vq);
|
||||
|
||||
/* Default implementation of P2V based on libmetal */
|
||||
static inline void *virtqueue_phys_to_virt(struct virtqueue *vq,
|
||||
@@ -397,6 +395,45 @@ uint32_t virtqueue_get_desc_size(struct virtqueue *vq)
|
||||
return len;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ *
|
||||
+ * virtqueue_nused
|
||||
+ *
|
||||
+ */
|
||||
+int virtqueue_nused(struct virtqueue *vq)
|
||||
+{
|
||||
+ uint16_t used_idx, nused;
|
||||
+
|
||||
+ /* Used is written by remote */
|
||||
+ VRING_INVALIDATE(&vq->vq_ring.used->idx, sizeof(vq->vq_ring.used->idx));
|
||||
+ used_idx = vq->vq_ring.used->idx;
|
||||
+
|
||||
+ nused = (uint16_t)(used_idx - vq->vq_used_cons_idx);
|
||||
+ VQASSERT(vq, nused <= vq->vq_nentries, "used more than available");
|
||||
+
|
||||
+ return nused;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ *
|
||||
+ * virtqueue_navail
|
||||
+ *
|
||||
+ */
|
||||
+int virtqueue_navail(struct virtqueue *vq)
|
||||
+{
|
||||
+ uint16_t avail_idx, navail;
|
||||
+
|
||||
+ /* Avail is written by driver */
|
||||
+ VRING_INVALIDATE(&vq->vq_ring.avail->idx, sizeof(vq->vq_ring.avail->idx));
|
||||
+
|
||||
+ avail_idx = vq->vq_ring.avail->idx;
|
||||
+
|
||||
+ navail = (uint16_t)(avail_idx - vq->vq_available_idx);
|
||||
+ VQASSERT(vq, navail <= vq->vq_nentries, "avail more than available");
|
||||
+
|
||||
+ return navail;
|
||||
+}
|
||||
+
|
||||
/**************************************************************************
|
||||
* Helper Functions *
|
||||
**************************************************************************/
|
||||
@@ -685,42 +722,3 @@ static void vq_ring_notify(struct virtqueue *vq)
|
||||
if (vq->notify)
|
||||
vq->notify(vq);
|
||||
}
|
||||
-
|
||||
-/*
|
||||
- *
|
||||
- * virtqueue_nused
|
||||
- *
|
||||
- */
|
||||
-static int virtqueue_nused(struct virtqueue *vq)
|
||||
-{
|
||||
- uint16_t used_idx, nused;
|
||||
-
|
||||
- /* Used is written by remote */
|
||||
- VRING_INVALIDATE(&vq->vq_ring.used->idx, sizeof(vq->vq_ring.used->idx));
|
||||
- used_idx = vq->vq_ring.used->idx;
|
||||
-
|
||||
- nused = (uint16_t)(used_idx - vq->vq_used_cons_idx);
|
||||
- VQASSERT(vq, nused <= vq->vq_nentries, "used more than available");
|
||||
-
|
||||
- return nused;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- *
|
||||
- * virtqueue_navail
|
||||
- *
|
||||
- */
|
||||
-static int virtqueue_navail(struct virtqueue *vq)
|
||||
-{
|
||||
- uint16_t avail_idx, navail;
|
||||
-
|
||||
- /* Avail is written by driver */
|
||||
- VRING_INVALIDATE(&vq->vq_ring.avail->idx, sizeof(vq->vq_ring.avail->idx));
|
||||
-
|
||||
- avail_idx = vq->vq_ring.avail->idx;
|
||||
-
|
||||
- navail = (uint16_t)(avail_idx - vq->vq_available_idx);
|
||||
- VQASSERT(vq, navail <= vq->vq_nentries, "avail more than available");
|
||||
-
|
||||
- return navail;
|
||||
-}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
From fc9d645243c585731832ba42aa960a4ebb6656ab Mon Sep 17 00:00:00 2001
|
||||
From: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
Date: Mon, 26 May 2025 21:38:28 +0800
|
||||
Subject: [PATCH 08/10] lib/rpmsg/rpmsg_virtio: add last buffer check to fix
|
||||
low power issue
|
||||
|
||||
add `last` argument to rpmsg_virtio_get_rx_buffer() to know whether
|
||||
current got rx buffer is the last buffer.
|
||||
When this is the last buffer, do not try to access the vring to avoid
|
||||
the low power issue.
|
||||
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/rpmsg/rpmsg_virtio.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 6df5a52a48..4aba94e973 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -216,21 +216,24 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev,
|
||||
* @param rvdev Pointer to rpmsg device
|
||||
* @param len Size of received buffer
|
||||
* @param idx Index of buffer
|
||||
+ * @param last Indicates whether this is the last buffer
|
||||
*
|
||||
* @return Pointer to received buffer
|
||||
*/
|
||||
static void *rpmsg_virtio_get_rx_buffer(struct rpmsg_virtio_device *rvdev,
|
||||
- uint32_t *len, uint16_t *idx)
|
||||
+ uint32_t *len, uint16_t *idx, bool *last)
|
||||
{
|
||||
void *data = NULL;
|
||||
|
||||
if (VIRTIO_ROLE_IS_DRIVER(rvdev->vdev)) {
|
||||
data = virtqueue_get_buffer(rvdev->rvq, len, idx);
|
||||
+ *last = virtqueue_nused(rvdev->rvq) == 0;
|
||||
}
|
||||
|
||||
if (VIRTIO_ROLE_IS_DEVICE(rvdev->vdev)) {
|
||||
data =
|
||||
virtqueue_get_first_avail_buffer(rvdev->rvq, idx, len);
|
||||
+ *last = virtqueue_navail(rvdev->rvq) == 0;
|
||||
}
|
||||
|
||||
/* Invalidate the buffer before returning it */
|
||||
@@ -551,14 +554,15 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
struct rpmsg_endpoint *ept;
|
||||
struct rpmsg_hdr *rp_hdr;
|
||||
bool release = false;
|
||||
+ bool last = false;
|
||||
uint32_t len;
|
||||
uint16_t idx;
|
||||
int status;
|
||||
|
||||
- while (1) {
|
||||
+ while (!last) {
|
||||
/* Process the received data from remote node */
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
- rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx);
|
||||
+ rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx, &last);
|
||||
|
||||
/* No more filled rx buffers */
|
||||
if (!rp_hdr) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
From fc935c6e5abcd0a96e5c3ca3bd5ec272543abc1a Mon Sep 17 00:00:00 2001
|
||||
From: ligd <liguiding1@xiaomi.com>
|
||||
Date: Fri, 7 Apr 2023 12:42:09 +0800
|
||||
Subject: [PATCH 09/14] openamp: swap get_rx_buffer & return_rx_buffer to
|
||||
resolve remote low power.
|
||||
|
||||
Signed-off-by: ligd <liguiding1@xiaomi.com>
|
||||
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/rpmsg/rpmsg_virtio.c | 16 +++++++++++++---
|
||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 9dd14b6..dfd36e3 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -545,17 +545,26 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
struct virtio_device *vdev = vq->vq_dev;
|
||||
struct rpmsg_virtio_device *rvdev = vdev->priv;
|
||||
struct rpmsg_device *rdev = &rvdev->rdev;
|
||||
+ struct rpmsg_hdr *next_hdr = NULL;
|
||||
struct rpmsg_endpoint *ept;
|
||||
struct rpmsg_hdr *rp_hdr;
|
||||
+ uint32_t next_len;
|
||||
+ uint16_t next_idx;
|
||||
uint32_t len;
|
||||
uint16_t idx;
|
||||
int status;
|
||||
|
||||
while (1) {
|
||||
/* Process the received data from remote node */
|
||||
- metal_mutex_acquire(&rdev->lock);
|
||||
- rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx);
|
||||
- metal_mutex_release(&rdev->lock);
|
||||
+ if (!next_hdr) {
|
||||
+ metal_mutex_acquire(&rdev->lock);
|
||||
+ rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx);
|
||||
+ metal_mutex_release(&rdev->lock);
|
||||
+ } else {
|
||||
+ rp_hdr = next_hdr;
|
||||
+ len = next_len;
|
||||
+ idx = next_idx;
|
||||
+ }
|
||||
|
||||
/* No more filled rx buffers */
|
||||
if (!rp_hdr)
|
||||
@@ -587,6 +596,7 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
rpmsg_ept_decref(ept);
|
||||
+ next_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &next_len, &next_idx);
|
||||
if (rpmsg_virtio_buf_held_dec_test(rp_hdr))
|
||||
rpmsg_virtio_release_rx_buffer_nolock(rvdev, rp_hdr);
|
||||
metal_mutex_release(&rdev->lock);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
From 6d2bf800f07a9584ea2445b4046c2d82cddf0c6f Mon Sep 17 00:00:00 2001
|
||||
From 33fca04b5d33b7b501775f2384a6374eef302729 Mon Sep 17 00:00:00 2001
|
||||
From: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Date: Wed, 10 Jul 2024 18:47:33 +0800
|
||||
Subject: [PATCH 11/14] virtio: change feature to 64 bit in all virtio_dispatch
|
||||
Subject: [PATCH 09/10] virtio: change feature to 64 bit in all virtio_dispatch
|
||||
|
||||
The virtio device feature bit has exceeded 32 bits, so change feature
|
||||
to 64 bit like linux does to support more features
|
||||
|
||||
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/include/openamp/rpmsg_virtio.h | 2 +-
|
||||
lib/include/openamp/virtio.h | 20 ++++++-------
|
||||
lib/remoteproc/remoteproc_virtio.c | 14 +++++-----
|
||||
lib/include/openamp/virtio.h | 22 +++++++--------
|
||||
lib/remoteproc/remoteproc_virtio.c | 12 ++++----
|
||||
lib/rpmsg/rpmsg_virtio.c | 2 +-
|
||||
lib/virtio/virtio.c | 2 +-
|
||||
lib/virtio_mmio/virtio_mmio_drv.c | 45 +++++++++++++++---------------
|
||||
6 files changed, 42 insertions(+), 43 deletions(-)
|
||||
5 files changed, 41 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
index d9cfa9b..866e9eb 100644
|
||||
index a757166082..a069bb02b0 100644
|
||||
--- a/lib/include/openamp/rpmsg_virtio.h
|
||||
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
|
||||
@@ -179,7 +179,7 @@ static inline uint8_t rpmsg_virtio_get_status(struct rpmsg_virtio_device *rvdev)
|
||||
@@ -176,7 +176,7 @@ static inline uint8_t rpmsg_virtio_get_status(struct rpmsg_virtio_device *rvdev)
|
||||
* @return The features supported by both the rpmsg driver and rpmsg device.
|
||||
*/
|
||||
__deprecated
|
||||
|
|
@ -30,10 +30,10 @@ index d9cfa9b..866e9eb 100644
|
|||
{
|
||||
return rvdev->vdev->func->get_features(rvdev->vdev);
|
||||
diff --git a/lib/include/openamp/virtio.h open-amp/lib/include/openamp/virtio.h
|
||||
index 278d2da..dd285ac 100644
|
||||
index 5e244f6a01..0c35c45ccf 100644
|
||||
--- a/lib/include/openamp/virtio.h
|
||||
+++ open-amp/lib/include/openamp/virtio.h
|
||||
@@ -156,7 +156,7 @@ struct virtio_dispatch;
|
||||
@@ -163,7 +163,7 @@ struct virtio_memory_ops;
|
||||
/** @brief Device features. */
|
||||
struct virtio_feature_desc {
|
||||
/** Unique feature ID, defined in the virtio specification. */
|
||||
|
|
@ -42,16 +42,7 @@ index 278d2da..dd285ac 100644
|
|||
|
||||
/** Name of the feature (for debug). */
|
||||
const char *vfd_str;
|
||||
@@ -221,7 +221,7 @@ struct virtio_device {
|
||||
const char *virtio_dev_name(uint16_t devid);
|
||||
|
||||
__deprecated void virtio_describe(struct virtio_device *dev, const char *msg,
|
||||
- uint32_t features,
|
||||
+ uint64_t features,
|
||||
struct virtio_feature_desc *feature_desc);
|
||||
|
||||
/**
|
||||
@@ -249,17 +249,17 @@ struct virtio_dispatch {
|
||||
@@ -246,17 +246,17 @@ struct virtio_dispatch {
|
||||
void (*set_status)(struct virtio_device *dev, uint8_t status);
|
||||
|
||||
/** Get the feature exposed by the virtio device. */
|
||||
|
|
@ -73,7 +64,7 @@ index 278d2da..dd285ac 100644
|
|||
|
||||
/**
|
||||
* Read a variable amount from the device specific (ie, network)
|
||||
@@ -422,7 +422,7 @@ static inline int virtio_write_config(struct virtio_device *vdev,
|
||||
@@ -427,7 +427,7 @@ static inline int virtio_write_config(struct virtio_device *vdev,
|
||||
* @return 0 on success, otherwise error code.
|
||||
*/
|
||||
static inline int virtio_get_features(struct virtio_device *vdev,
|
||||
|
|
@ -82,7 +73,7 @@ index 278d2da..dd285ac 100644
|
|||
{
|
||||
if (!vdev || !features)
|
||||
return -EINVAL;
|
||||
@@ -443,7 +443,7 @@ static inline int virtio_get_features(struct virtio_device *vdev,
|
||||
@@ -451,7 +451,7 @@ static inline int virtio_get_features(struct virtio_device *vdev,
|
||||
* @return 0 on success, otherwise error code.
|
||||
*/
|
||||
static inline int virtio_set_features(struct virtio_device *vdev,
|
||||
|
|
@ -91,7 +82,7 @@ index 278d2da..dd285ac 100644
|
|||
{
|
||||
if (!vdev)
|
||||
return -EINVAL;
|
||||
@@ -465,8 +465,8 @@ static inline int virtio_set_features(struct virtio_device *vdev,
|
||||
@@ -473,8 +473,8 @@ static inline int virtio_set_features(struct virtio_device *vdev,
|
||||
* @return 0 on success, otherwise error code.
|
||||
*/
|
||||
static inline int virtio_negotiate_features(struct virtio_device *vdev,
|
||||
|
|
@ -102,8 +93,26 @@ index 278d2da..dd285ac 100644
|
|||
{
|
||||
if (!vdev)
|
||||
return -EINVAL;
|
||||
@@ -566,7 +566,7 @@ static inline int virtio_free_buf(struct virtio_device *vdev, void *buf)
|
||||
static inline bool virtio_has_feature(struct virtio_device *vdev,
|
||||
unsigned int feature_bit)
|
||||
{
|
||||
- uint32_t features;
|
||||
+ uint64_t features;
|
||||
|
||||
if (!vdev && feature_bit >= sizeof(features) * 8)
|
||||
return false;
|
||||
@@ -574,7 +574,7 @@ static inline bool virtio_has_feature(struct virtio_device *vdev,
|
||||
if (!vdev->features)
|
||||
virtio_get_features(vdev, &features);
|
||||
|
||||
- return (vdev->features & (1UL << feature_bit)) != 0;
|
||||
+ return (vdev->features & (1ULL << feature_bit)) != 0;
|
||||
}
|
||||
|
||||
#if defined __cplusplus
|
||||
diff --git a/lib/remoteproc/remoteproc_virtio.c open-amp/lib/remoteproc/remoteproc_virtio.c
|
||||
index aae026c..902fc41 100644
|
||||
index 4eb40768d6..b07c0b3e45 100644
|
||||
--- a/lib/remoteproc/remoteproc_virtio.c
|
||||
+++ open-amp/lib/remoteproc/remoteproc_virtio.c
|
||||
@@ -165,7 +165,7 @@ static uint32_t rproc_virtio_get_dfeatures(struct virtio_device *vdev)
|
||||
|
|
@ -130,7 +139,7 @@ index aae026c..902fc41 100644
|
|||
{
|
||||
struct remoteproc_virtio *rpvdev;
|
||||
struct fw_rsc_vdev *vdev_rsc;
|
||||
@@ -197,17 +197,17 @@ static void rproc_virtio_set_features(struct virtio_device *vdev,
|
||||
@@ -197,13 +197,13 @@ static void rproc_virtio_set_features(struct virtio_device *vdev,
|
||||
io = rpvdev->vdev_rsc_io;
|
||||
metal_io_write32(io,
|
||||
metal_io_virt_to_offset(io, &vdev_rsc->gfeatures),
|
||||
|
|
@ -145,18 +154,13 @@ index aae026c..902fc41 100644
|
|||
+static uint64_t rproc_virtio_negotiate_features(struct virtio_device *vdev,
|
||||
+ uint64_t features)
|
||||
{
|
||||
uint32_t dfeatures = rproc_virtio_get_dfeatures(vdev);
|
||||
|
||||
- rproc_virtio_set_features(vdev, dfeatures & features);
|
||||
+ rproc_virtio_set_features(vdev, dfeatures & (uint32_t)features);
|
||||
|
||||
return 0;
|
||||
}
|
||||
features = features & rproc_virtio_get_dfeatures(vdev);
|
||||
rproc_virtio_set_features(vdev, features);
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index bdf9046..e54155f 100644
|
||||
index 4aba94e973..4bc6fb21cb 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -805,7 +805,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
@@ -807,7 +807,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
|
||||
const char *vq_names[RPMSG_NUM_VRINGS];
|
||||
vq_callback callback[RPMSG_NUM_VRINGS];
|
||||
struct fw_rsc_config fw_config;
|
||||
|
|
@ -165,21 +169,8 @@ index bdf9046..e54155f 100644
|
|||
int status;
|
||||
unsigned int i;
|
||||
|
||||
diff --git a/lib/virtio/virtio.c open-amp/lib/virtio/virtio.c
|
||||
index a442e52..e2ab3d8 100644
|
||||
--- a/lib/virtio/virtio.c
|
||||
+++ open-amp/lib/virtio/virtio.c
|
||||
@@ -51,7 +51,7 @@ const char *virtio_dev_name(unsigned short devid)
|
||||
}
|
||||
|
||||
__deprecated void virtio_describe(struct virtio_device *dev, const char *msg,
|
||||
- uint32_t features, struct virtio_feature_desc *desc)
|
||||
+ uint64_t features, struct virtio_feature_desc *desc)
|
||||
{
|
||||
(void)dev;
|
||||
(void)msg;
|
||||
diff --git a/lib/virtio_mmio/virtio_mmio_drv.c open-amp/lib/virtio_mmio/virtio_mmio_drv.c
|
||||
index 5700471..34f2b67 100644
|
||||
index 9f72f0fe04..45dab76c02 100644
|
||||
--- a/lib/virtio_mmio/virtio_mmio_drv.c
|
||||
+++ open-amp/lib/virtio_mmio/virtio_mmio_drv.c
|
||||
@@ -75,44 +75,43 @@ static void virtio_mmio_read_config(struct virtio_device *vdev,
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From a2f4672050433811aabfcd8abef206c28397276d Mon Sep 17 00:00:00 2001
|
||||
From e201b5ba1fd11bb486a844afb2362d699f915f7f Mon Sep 17 00:00:00 2001
|
||||
From: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
|
||||
Date: Mon, 27 May 2024 20:32:46 +0800
|
||||
Subject: [PATCH 13/14] openamp: add assert when get tx buffer failed
|
||||
Subject: [PATCH 10/10] openamp: add assert when get tx buffer failed
|
||||
|
||||
So we can found the error more eaily
|
||||
|
||||
|
|
@ -11,10 +11,10 @@ Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
|
|||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index 7aeec5b..33c6c33 100644
|
||||
index 4bc6fb21cb..0293d17d24 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -384,6 +384,8 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
@@ -391,6 +391,8 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
From 76fd1e2c7e967ec979a24a49ce1c9626a4279f21 Mon Sep 17 00:00:00 2001
|
||||
From: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Date: Wed, 10 Jul 2024 15:02:01 +0800
|
||||
Subject: [PATCH 10/14] rpmsg_virtio.c: virtqueue_kick after all rx buffer
|
||||
release
|
||||
|
||||
Only kick once when all the rx buffers has been returned to decrease
|
||||
the interrupt times to improve the performance
|
||||
|
||||
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/rpmsg/rpmsg_virtio.c | 20 +++++++++++++-------
|
||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index dfd36e3..bdf9046 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -314,8 +314,6 @@ static bool rpmsg_virtio_release_rx_buffer_nolock(struct rpmsg_virtio_device *rv
|
||||
/* Return buffer on virtqueue. */
|
||||
len = virtqueue_get_buffer_length(rvdev->rvq, idx);
|
||||
rpmsg_virtio_return_buffer(rvdev, rp_hdr, len, idx);
|
||||
- /* Tell peer we returned an rx buffer */
|
||||
- virtqueue_kick(rvdev->rvq);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -330,8 +328,11 @@ static void rpmsg_virtio_release_rx_buffer(struct rpmsg_device *rdev,
|
||||
rp_hdr = RPMSG_LOCATE_HDR(rxbuf);
|
||||
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
- if (rpmsg_virtio_buf_held_dec_test(rp_hdr))
|
||||
+ if (rpmsg_virtio_buf_held_dec_test(rp_hdr)) {
|
||||
rpmsg_virtio_release_rx_buffer_nolock(rvdev, rp_hdr);
|
||||
+ /* Tell peer we returned an rx buffer */
|
||||
+ virtqueue_kick(rvdev->rvq);
|
||||
+ }
|
||||
metal_mutex_release(&rdev->lock);
|
||||
}
|
||||
|
||||
@@ -560,16 +561,21 @@ static void rpmsg_virtio_rx_callback(struct virtqueue *vq)
|
||||
metal_mutex_acquire(&rdev->lock);
|
||||
rp_hdr = rpmsg_virtio_get_rx_buffer(rvdev, &len, &idx);
|
||||
metal_mutex_release(&rdev->lock);
|
||||
+ if (!rp_hdr)
|
||||
+ break;
|
||||
} else {
|
||||
+ /* No more filled rx buffers */
|
||||
+ if (!next_hdr) {
|
||||
+ /* Tell peer we returned some rx buffer */
|
||||
+ virtqueue_kick(rvdev->rvq);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
rp_hdr = next_hdr;
|
||||
len = next_len;
|
||||
idx = next_idx;
|
||||
}
|
||||
|
||||
- /* No more filled rx buffers */
|
||||
- if (!rp_hdr)
|
||||
- break;
|
||||
-
|
||||
rp_hdr->reserved = idx;
|
||||
|
||||
/* Get the channel node from the remote device channels list. */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From 3146340e66f9dae5817c0a9592f8e375c2cf9e77 Mon Sep 17 00:00:00 2001
|
||||
From: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
Date: Wed, 31 Jul 2024 15:36:43 +0800
|
||||
Subject: [PATCH 12/14] rpmsg_virtio.c: fix get_tx_payload_buffer error
|
||||
|
||||
Always sleep when notify wait return not RPMSG_SUCCESS
|
||||
|
||||
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
|
||||
---
|
||||
lib/rpmsg/rpmsg_virtio.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
index e54155f..7aeec5b 100644
|
||||
--- a/lib/rpmsg/rpmsg_virtio.c
|
||||
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
@@ -378,11 +378,9 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
|
||||
* use metal_sleep_usec() method by default.
|
||||
*/
|
||||
status = rpmsg_virtio_notify_wait(rvdev, rvdev->rvq);
|
||||
- if (status == RPMSG_EOPNOTSUPP) {
|
||||
+ if (status != RPMSG_SUCCESS) {
|
||||
metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
|
||||
tick_count--;
|
||||
- } else if (status == RPMSG_SUCCESS) {
|
||||
- break;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
From 1091cadd99315959303ab3a8227e054884c28770 Mon Sep 17 00:00:00 2001
|
||||
From: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
Date: Mon, 12 Aug 2024 10:15:24 +0800
|
||||
Subject: [PATCH 14/14] virtio.h: add memory operation for virtio device
|
||||
|
||||
To make different virtio device/transport can use it's own memory
|
||||
region.
|
||||
|
||||
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
|
||||
---
|
||||
lib/include/openamp/virtio.h | 42 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 42 insertions(+)
|
||||
|
||||
diff --git a/lib/include/openamp/virtio.h open-amp/lib/include/openamp/virtio.h
|
||||
index dd285ac..1099a26 100644
|
||||
--- a/lib/include/openamp/virtio.h
|
||||
+++ open-amp/lib/include/openamp/virtio.h
|
||||
@@ -152,6 +152,7 @@ struct virtio_device_id {
|
||||
typedef void (*virtio_dev_reset_cb)(struct virtio_device *vdev);
|
||||
|
||||
struct virtio_dispatch;
|
||||
+struct virtio_memory_ops;
|
||||
|
||||
/** @brief Device features. */
|
||||
struct virtio_feature_desc {
|
||||
@@ -197,6 +198,9 @@ struct virtio_device {
|
||||
/** Virtio dispatch table */
|
||||
const struct virtio_dispatch *func;
|
||||
|
||||
+ /** Virtio device memory operations */
|
||||
+ const struct virtio_memory_ops *mmops;
|
||||
+
|
||||
/** Private data */
|
||||
void *priv;
|
||||
|
||||
@@ -204,6 +208,7 @@ struct virtio_device {
|
||||
unsigned int vrings_num;
|
||||
|
||||
/** Pointer to the virtio vring structure */
|
||||
+
|
||||
struct virtio_vring_info *vrings_info;
|
||||
};
|
||||
|
||||
@@ -282,6 +287,11 @@ struct virtio_dispatch {
|
||||
void (*notify)(struct virtqueue *vq);
|
||||
};
|
||||
|
||||
+struct virtio_memory_ops {
|
||||
+ void *(*alloc)(struct virtio_device *dev, size_t size, size_t align);
|
||||
+ void (*free)(struct virtio_device *dev, void *buf);
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* @brief Create the virtio device virtqueue.
|
||||
*
|
||||
@@ -499,6 +509,38 @@ static inline int virtio_reset_device(struct virtio_device *vdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * @brief Allocate buffer from the virtio device
|
||||
+ *
|
||||
+ * @param vdev Pointer to virtio device structure.
|
||||
+ * @param size Allocated buffer size.
|
||||
+ * @param align Allocated buffer alignment.
|
||||
+ *
|
||||
+ * @return The allocated buffer address.
|
||||
+ */
|
||||
+static inline void *virtio_alloc_buf(struct virtio_device *vdev,
|
||||
+ size_t size, size_t align)
|
||||
+{
|
||||
+ if (!vdev->mmops->alloc)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return vdev->mmops->alloc(vdev, size, align);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * @brief Free buffer to the virtio device
|
||||
+ *
|
||||
+ * @param vdev Pointer to virtio device structure.
|
||||
+ * @param buf Buffer need to be freed.
|
||||
+ */
|
||||
+static inline void virtio_free_buf(struct virtio_device *vdev, void *buf)
|
||||
+{
|
||||
+ if (!vdev->mmops->free)
|
||||
+ return;
|
||||
+
|
||||
+ vdev->mmops->free(vdev, buf);
|
||||
+}
|
||||
+
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
|
@ -21,8 +21,8 @@
|
|||
# ##############################################################################
|
||||
if(CONFIG_OPENAMP)
|
||||
|
||||
set(OPENAMP_COMMIT c468328487a1e0596307a5ef7172756819e15745)
|
||||
set(LIBMETAL_COMMIT a4bce3507502a7eb9e29bafe0eb174ed5c4316e9)
|
||||
set(OPENAMP_VERSION 2025.10.0)
|
||||
set(LIBMETAL_VERSION 2025.10.0)
|
||||
|
||||
include(libmetal.cmake)
|
||||
include(open-amp.cmake)
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
OPENAMP_COMMIT ?= c468328487a1e0596307a5ef7172756819e15745
|
||||
LIBMETAL_COMMIT ?= a4bce3507502a7eb9e29bafe0eb174ed5c4316e9
|
||||
OPENAMP_VERSION ?= 2025.10.0
|
||||
LIBMETAL_VERSION ?= 2025.10.0
|
||||
|
||||
include libmetal.defs
|
||||
include open-amp.defs
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libmetal)
|
|||
libmetal
|
||||
DOWNLOAD_NAME "libmetal-main.zip"
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
|
||||
URL "https://github.com/OpenAMP/libmetal/archive/${LIBMETAL_COMMIT}.zip"
|
||||
URL "https://github.com/OpenAMP/libmetal/archive/v${LIBMETAL_VERSION}.zip"
|
||||
SOURCE_DIR
|
||||
${CMAKE_CURRENT_LIST_DIR}/libmetal
|
||||
BINARY_DIR
|
||||
|
|
@ -37,19 +37,9 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libmetal)
|
|||
""
|
||||
PATCH_COMMAND
|
||||
patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0001-lib-errno.h-fix-compile-error.patch &&
|
||||
patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0001-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0003-atomic.h-fix-compiler-error.patch && patch
|
||||
-p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0007-libmetal-nuttx-Update-function-prototype-changes.patch
|
||||
DOWNLOAD_NO_PROGRESS true
|
||||
TIMEOUT 30)
|
||||
|
||||
|
|
|
|||
|
|
@ -79,16 +79,11 @@ LIBMETAL_HDRS_SEDEXP := \
|
|||
ifeq ($(wildcard libmetal/.git),)
|
||||
libmetal.zip:
|
||||
# Download and unpack tarball if no git repo found
|
||||
$(call DOWNLOAD,https://github.com/OpenAMP/libmetal/archive,$(LIBMETAL_COMMIT).zip,libmetal.zip)
|
||||
$(call DOWNLOAD,https://github.com/OpenAMP/libmetal/archive,v$(LIBMETAL_VERSION).zip,libmetal.zip)
|
||||
$(Q) unzip -o libmetal.zip
|
||||
mv libmetal-$(LIBMETAL_COMMIT) libmetal
|
||||
$(Q) patch -p0 < 0001-lib-errno.h-fix-compile-error.patch
|
||||
mv libmetal-$(LIBMETAL_VERSION) libmetal
|
||||
$(Q) patch -p0 < 0001-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
|
||||
$(Q) patch -p0 < 0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch
|
||||
$(Q) patch -p0 < 0003-atomic.h-fix-compiler-error.patch
|
||||
$(Q) patch -p0 < 0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch
|
||||
$(Q) patch -p0 < 0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch
|
||||
$(Q) patch -p0 < 0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch
|
||||
$(Q) patch -p0 < 0007-libmetal-nuttx-Update-function-prototype-changes.patch
|
||||
|
||||
.libmetal_headers: libmetal.zip
|
||||
else
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp)
|
|||
open-amp
|
||||
DOWNLOAD_NAME "libopen-amp-main.zip"
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
|
||||
URL "https://github.com/OpenAMP/open-amp/archive/${OPENAMP_COMMIT}.zip"
|
||||
URL "https://github.com/OpenAMP/open-amp/archive/v${OPENAMP_VERSION}.zip"
|
||||
SOURCE_DIR
|
||||
${CMAKE_CURRENT_LIST_DIR}/open-amp
|
||||
BINARY_DIR
|
||||
|
|
@ -45,27 +45,19 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp)
|
|||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch &&
|
||||
${CMAKE_CURRENT_LIST_DIR}/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch &&
|
||||
patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0013-openamp-add-assert-when-get-tx-buffer-failed.patch
|
||||
&& patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
|
||||
${CMAKE_CURRENT_LIST_DIR}/0014-virtio.h-add-memory-operation-for-virtio-device.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/0010-openamp-add-assert-when-get-tx-buffer-failed.patch
|
||||
DOWNLOAD_NO_PROGRESS true
|
||||
TIMEOUT 30)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
ifeq ($(CONFIG_OPENAMP),y)
|
||||
|
||||
ifeq ($(CONFIG_OPENAMP_CACHE),y)
|
||||
CFLAGS += -DVIRTIO_CACHED_BUFFERS -DVIRTIO_CACHED_VRINGS
|
||||
CFLAGS += -DVIRTIO_USE_DCACHE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_OPENAMP_DEBUG),y)
|
||||
|
|
@ -44,41 +44,46 @@ else
|
|||
CFLAGS += -DVIRTIO_DRIVER_SUPPORT=0
|
||||
endif
|
||||
|
||||
CFLAGS += -DVQ_RX_EMPTY_NOTIFY=1
|
||||
CFLAGS += -Iopen-amp/lib/include
|
||||
|
||||
# avoid multiple definitions in other file
|
||||
CFLAGS += -Dsafe_strcpy=openamp_safe_strcpy
|
||||
|
||||
CSRCS += open-amp/lib/remoteproc/elf_loader.c
|
||||
CSRCS += open-amp/lib/remoteproc/remoteproc.c
|
||||
CSRCS += open-amp/lib/remoteproc/remoteproc_virtio.c
|
||||
CSRCS += open-amp/lib/remoteproc/rsc_table_parser.c
|
||||
CSRCS += open-amp/lib/rpmsg/rpmsg.c
|
||||
CSRCS += open-amp/lib/rpmsg/rpmsg_virtio.c
|
||||
CSRCS += open-amp/lib/utils/utilities.c
|
||||
CSRCS += open-amp/lib/virtio/virtio.c
|
||||
CSRCS += open-amp/lib/virtio/virtqueue.c
|
||||
|
||||
# Download and unpack tarball if no git repo found
|
||||
ifeq ($(wildcard open-amp/.git),)
|
||||
open-amp.zip:
|
||||
$(call DOWNLOAD,https://github.com/OpenAMP/open-amp/archive,$(OPENAMP_COMMIT).zip,open-amp.zip)
|
||||
$(call DOWNLOAD,https://github.com/OpenAMP/open-amp/archive,v$(OPENAMP_VERSION).zip,open-amp.zip)
|
||||
$(Q) unzip -o open-amp.zip
|
||||
mv open-amp-$(OPENAMP_COMMIT) open-amp
|
||||
mv open-amp-$(OPENAMP_VERSION) open-amp
|
||||
$(Q) patch -p0 < 0001-ns-acknowledge-the-received-creation-message.patch
|
||||
$(Q) patch -p0 < 0002-Negotiate-individual-buffer-size-dynamically.patch
|
||||
$(Q) patch -p0 < 0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch
|
||||
$(Q) patch -p0 < 0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch
|
||||
$(Q) patch -p0 < 0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch
|
||||
$(Q) patch -p0 < 0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch
|
||||
$(Q) patch -p0 < 0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch
|
||||
$(Q) patch -p0 < 0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch
|
||||
$(Q) patch -p0 < 0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch
|
||||
$(Q) patch -p0 < 0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch
|
||||
$(Q) patch -p0 < 0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch
|
||||
$(Q) patch -p0 < 0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch
|
||||
$(Q) patch -p0 < 0013-openamp-add-assert-when-get-tx-buffer-failed.patch
|
||||
$(Q) patch -p0 < 0014-virtio.h-add-memory-operation-for-virtio-device.patch
|
||||
$(Q) patch -p0 < 0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch
|
||||
$(Q) patch -p0 < 0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch
|
||||
$(Q) patch -p0 < 0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch
|
||||
$(Q) patch -p0 < 0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch
|
||||
$(Q) patch -p0 < 0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch
|
||||
$(Q) patch -p0 < 0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch
|
||||
$(Q) patch -p0 < 0010-openamp-add-assert-when-get-tx-buffer-failed.patch
|
||||
|
||||
.openamp_headers: open-amp.zip
|
||||
else
|
||||
.openamp_headers:
|
||||
endif
|
||||
$(eval headers := $(wildcard open-amp/lib/include/openamp/*.h))
|
||||
$(eval headers += open-amp/lib/remoteproc/rsc_table_parser.h)
|
||||
$(eval headers += open-amp/lib/rpmsg/rpmsg_internal.h)
|
||||
$(shell mkdir -p $(TOPDIR)$(DELIM)include$(DELIM)openamp$(DELIM))
|
||||
$(foreach header,$(headers),$(shell cp -rf $(header) $(TOPDIR)$(DELIM)include$(DELIM)openamp$(DELIM)))
|
||||
touch $@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue