openamp: update openmap lib version to 2022.10.0

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-05 22:16:58 +08:00 committed by Alan Carvalho de Assis
parent 22ce6e8a9c
commit 7ad4b573fb
15 changed files with 143 additions and 309 deletions

View file

@ -1,7 +1,7 @@
From 73d9754ab14a2b5c3e25574ec860489031e32f00 Mon Sep 17 00:00:00 2001
From 1e43e60aa7ae118309cf256c50bd17f313540eba Mon Sep 17 00:00:00 2001
From: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Mon, 7 Jan 2019 02:15:42 +0800
Subject: [PATCH 02/12] ns: acknowledge the received creation message
Subject: [PATCH 1/9] ns: acknowledge the received creation message
the two phase handsake make the client could initiate the transfer
immediately without the server side send any dummy message first.
@ -12,14 +12,14 @@ Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
lib/include/openamp/rpmsg_virtio.h | 1 +
lib/rpmsg/rpmsg.c | 5 ++++-
lib/rpmsg/rpmsg_internal.h | 4 ++--
lib/rpmsg/rpmsg_virtio.c | 16 ++++++++++++----
5 files changed, 20 insertions(+), 7 deletions(-)
lib/rpmsg/rpmsg_virtio.c | 15 ++++++++++++---
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
index e6acce8..3560bb5 100644
index 64678cfc..ff3ff8fb 100644
--- a/lib/include/openamp/rpmsg.h
+++ open-amp/lib/include/openamp/rpmsg.h
@@ -121,6 +121,7 @@ struct rpmsg_device {
@@ -126,6 +126,7 @@ struct rpmsg_device {
rpmsg_ns_bind_cb ns_unbind_cb;
struct rpmsg_device_ops ops;
bool support_ns;
@ -28,7 +28,7 @@ index e6acce8..3560bb5 100644
/**
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
index ff1e171..255396c 100644
index 80ce9981..874c9723 100644
--- a/lib/include/openamp/rpmsg_virtio.h
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
@@ -28,6 +28,7 @@ extern "C" {
@ -40,10 +40,10 @@ index ff1e171..255396c 100644
/**
* struct rpmsg_virtio_shm_pool - shared memory pool used for rpmsg buffers
diff --git a/lib/rpmsg/rpmsg.c open-amp/lib/rpmsg/rpmsg.c
index 214b2a9..ba2b7a8 100644
index 0d3e1d03..e8757d80 100644
--- a/lib/rpmsg/rpmsg.c
+++ open-amp/lib/rpmsg/rpmsg.c
@@ -302,10 +302,13 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
@@ -317,10 +317,13 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
rpmsg_register_endpoint(rdev, ept, name, addr, dest, cb, unbind_cb);
metal_mutex_release(&rdev->lock);
@ -59,7 +59,7 @@ index 214b2a9..ba2b7a8 100644
if (status)
rpmsg_unregister_endpoint(ept);
diff --git a/lib/rpmsg/rpmsg_internal.h open-amp/lib/rpmsg/rpmsg_internal.h
index ab6e0f2..3e6ae37 100644
index ab6e0f29..3e6ae37f 100644
--- a/lib/rpmsg/rpmsg_internal.h
+++ open-amp/lib/rpmsg/rpmsg_internal.h
@@ -39,12 +39,12 @@ extern "C" {
@ -78,10 +78,10 @@ index ab6e0f2..3e6ae37 100644
/**
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index d5f168c..0868f71 100644
index cab72e68..5726c2ca 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -579,7 +579,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
@@ -638,7 +638,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
metal_mutex_acquire(&rdev->lock);
_ept = rpmsg_get_endpoint(rdev, name, RPMSG_ADDR_ANY, dest);
@ -90,17 +90,16 @@ index d5f168c..0868f71 100644
if (_ept)
_ept->dest_addr = RPMSG_ADDR_ANY;
metal_mutex_release(&rdev->lock);
@@ -587,8 +587,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
@@ -646,7 +646,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
_ept->ns_unbind_cb(_ept);
if (rdev->ns_unbind_cb)
rdev->ns_unbind_cb(rdev, name, dest);
-
- } else {
+ } else if (ns_msg->flags == RPMSG_NS_CREATE) {
if (!_ept) {
/*
* send callback to application, that can
@@ -602,7 +601,15 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
@@ -660,7 +660,15 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
} else {
_ept->dest_addr = dest;
metal_mutex_release(&rdev->lock);
@ -116,7 +115,7 @@ index d5f168c..0868f71 100644
}
return RPMSG_SUCCESS;
@@ -683,6 +690,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
@@ -745,6 +753,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
#endif /*!VIRTIO_DRIVER_ONLY*/
vdev->features = rpmsg_virtio_get_features(rvdev);
rdev->support_ns = !!(vdev->features & (1 << VIRTIO_RPMSG_F_NS));
@ -124,7 +123,7 @@ index d5f168c..0868f71 100644
#ifndef VIRTIO_DEVICE_ONLY
if (role == RPMSG_HOST) {
@@ -778,7 +786,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
@@ -841,7 +850,7 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
* Create name service announcement endpoint if device supports name
* service announcement feature.
*/

View file

@ -1,42 +0,0 @@
From 57afc457bc16cca04762391f77d22b9219cb0e5f Mon Sep 17 00:00:00 2001
From: Guiding Li <liguiding1@xiaomi.com>
Date: Tue, 20 Jul 2021 17:52:13 +0800
Subject: [PATCH 01/12] openamp: add ns_unbind_notify support
This is for notify rdev unbind event
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
---
lib/include/openamp/rpmsg.h | 1 +
lib/rpmsg/rpmsg_virtio.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
index 8b8ec2e..e6acce8 100644
--- a/lib/include/openamp/rpmsg.h
+++ open-amp/lib/include/openamp/rpmsg.h
@@ -118,6 +118,7 @@ struct rpmsg_device {
unsigned long bitmap[metal_bitmap_longs(RPMSG_ADDR_BMP_SIZE)];
metal_mutex_t lock;
rpmsg_ns_bind_cb ns_bind_cb;
+ rpmsg_ns_bind_cb ns_unbind_cb;
struct rpmsg_device_ops ops;
bool support_ns;
};
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index 57a2083..d5f168c 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -585,6 +585,9 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
metal_mutex_release(&rdev->lock);
if (_ept && _ept->ns_unbind_cb)
_ept->ns_unbind_cb(_ept);
+ if (rdev->ns_unbind_cb)
+ rdev->ns_unbind_cb(rdev, name, dest);
+
} else {
if (!_ept) {
/*
--
2.25.1

View file

@ -1,14 +1,13 @@
From c3949d3b4a8883ec54f5db9ae55acac5ada75b81 Mon Sep 17 00:00:00 2001
From 285e4d359458ef09d397a41de04ada9a6b8d48e7 Mon Sep 17 00:00:00 2001
From: Chao An <anchao@pinecone.net>
Date: Mon, 10 Dec 2018 16:26:39 +0800
Subject: [PATCH 03/12] Negotiate individual buffer size dynamically
Subject: [PATCH 2/9] Negotiate individual buffer size dynamically
If slave support VIRTIO_RPMSG_F_BUFSZ(0x04) feature, master
determine the buffer size from config space(first 8 bytes),
otherwise the default size(512 bytes) will be used.
Signed-off-by: Chao An <anchao@pinecone.net>
Signed-off-by: ligd <liguiding1@xiaomi.com>
---
lib/include/openamp/remoteproc.h | 17 +++++++++++++++++
lib/include/openamp/rpmsg_virtio.h | 4 +++-
@ -16,7 +15,7 @@ Signed-off-by: ligd <liguiding1@xiaomi.com>
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/lib/include/openamp/remoteproc.h open-amp/lib/include/openamp/remoteproc.h
index 41f5d57..e9111ff 100644
index 7c79a292..d1efab85 100644
--- a/lib/include/openamp/remoteproc.h
+++ open-amp/lib/include/openamp/remoteproc.h
@@ -303,6 +303,23 @@ struct fw_rsc_vdev {
@ -44,7 +43,7 @@ index 41f5d57..e9111ff 100644
* struct fw_rsc_vendor - remote processor vendor specific resource
* @len: length of the resource
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
index 255396c..aaba7e1 100644
index 874c9723..0b22e840 100644
--- a/lib/include/openamp/rpmsg_virtio.h
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
@@ -16,6 +16,7 @@
@ -63,7 +62,7 @@ index 255396c..aaba7e1 100644
/**
* struct rpmsg_virtio_shm_pool - shared memory pool used for rpmsg buffers
@@ -68,7 +70,7 @@ struct rpmsg_virtio_config {
@@ -72,7 +74,7 @@ struct rpmsg_virtio_config {
*/
struct rpmsg_virtio_device {
struct rpmsg_device rdev;
@ -73,10 +72,10 @@ index 255396c..aaba7e1 100644
struct virtqueue *rvq;
struct virtqueue *svq;
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index 0868f71..186f23f 100644
index 5726c2ca..69537399 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -674,7 +674,8 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
@@ -737,7 +737,8 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
if (config == NULL) {
return RPMSG_ERR_PARAM;
}
@ -86,7 +85,7 @@ index 0868f71..186f23f 100644
}
#else /*!VIRTIO_DEVICE_ONLY*/
/* Ignore passed config in the virtio-device-only configuration. */
@@ -692,6 +693,13 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
@@ -755,6 +756,13 @@ int rpmsg_init_vdev_with_config(struct rpmsg_virtio_device *rvdev,
rdev->support_ns = !!(vdev->features & (1 << VIRTIO_RPMSG_F_NS));
rdev->support_ack = !!(vdev->features & (1 << VIRTIO_RPMSG_F_ACK));

View file

@ -1,7 +1,7 @@
From 415f9cdcf5a93cd018fa920e53a9090d5ec94c37 Mon Sep 17 00:00:00 2001
From 931cd95ab99550befa75703cc36d5e6f6964b63e Mon Sep 17 00:00:00 2001
From: Guiding Li <liguiding@pinecone.net>
Date: Wed, 20 Feb 2019 11:36:57 +0800
Subject: [PATCH 04/12] rpmsg: wait endpoint ready in rpmsg_send and
Subject: [PATCH 3/9] rpmsg: wait endpoint ready in rpmsg_send and
rpmsg_send_nocopy
because the remote need time to return the destination address
@ -9,11 +9,11 @@ because the remote need time to return the destination address
Signed-off-by: Guiding Li <liguiding@pinecone.net>
---
lib/include/openamp/rpmsg.h | 59 ++++++++++++++++++++++++++-----------
lib/rpmsg/rpmsg_virtio.c | 8 -----
2 files changed, 42 insertions(+), 25 deletions(-)
lib/rpmsg/rpmsg_virtio.c | 7 -----
2 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
index 3560bb5..11c3ccb 100644
index ff3ff8fb..dbe42ea6 100644
--- a/lib/include/openamp/rpmsg.h
+++ open-amp/lib/include/openamp/rpmsg.h
@@ -15,6 +15,7 @@
@ -37,7 +37,7 @@ index 3560bb5..11c3ccb 100644
/* Error macros. */
#define RPMSG_SUCCESS 0
#define RPMSG_ERROR_BASE -2000
@@ -142,6 +149,19 @@ int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src,
@@ -147,6 +154,19 @@ int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src,
uint32_t dst, const void *data, int len,
int wait);
@ -57,14 +57,17 @@ index 3560bb5..11c3ccb 100644
/**
* rpmsg_send() - send a message across to the remote processor
* @ept: the rpmsg endpoint
@@ -160,8 +180,17 @@ int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src,
@@ -165,11 +185,20 @@ int rpmsg_send_offchannel_raw(struct rpmsg_endpoint *ept, uint32_t src,
static inline int rpmsg_send(struct rpmsg_endpoint *ept, const void *data,
int len)
{
- return rpmsg_send_offchannel_raw(ept, ept->addr, ept->dest_addr, data,
- len, true);
+ int tc = 0;
+
if (!ept)
return RPMSG_ERR_PARAM;
- return rpmsg_send_offchannel_raw(ept, ept->addr, ept->dest_addr, data,
- len, true);
+ for (; tc < RPMSG_TICK_COUNT; tc += RPMSG_TICKS_PER_INTERVAL) {
+ if (is_rpmsg_ept_ready(ept))
+ return rpmsg_send_offchannel_raw(ept, ept->addr,
@ -77,14 +80,17 @@ index 3560bb5..11c3ccb 100644
}
/**
@@ -434,8 +463,17 @@ static inline int rpmsg_sendto_nocopy(struct rpmsg_endpoint *ept,
@@ -476,11 +505,20 @@ static inline int rpmsg_sendto_nocopy(struct rpmsg_endpoint *ept,
static inline int rpmsg_send_nocopy(struct rpmsg_endpoint *ept,
const void *data, int len)
{
- return rpmsg_send_offchannel_nocopy(ept, ept->addr,
- ept->dest_addr, data, len);
+ int tc = 0;
+
if (!ept)
return RPMSG_ERR_PARAM;
- return rpmsg_send_offchannel_nocopy(ept, ept->addr,
- ept->dest_addr, data, len);
+ for (; tc < RPMSG_TICK_COUNT; tc += RPMSG_TICKS_PER_INTERVAL) {
+ if (is_rpmsg_ept_ready(ept))
+ return rpmsg_send_offchannel_nocopy(ept, ept->addr,
@ -97,7 +103,7 @@ index 3560bb5..11c3ccb 100644
}
/**
@@ -508,19 +546,6 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
@@ -524,19 +562,6 @@ int rpmsg_create_ept(struct rpmsg_endpoint *ept, struct rpmsg_device *rdev,
*/
void rpmsg_destroy_ept(struct rpmsg_endpoint *ept);
@ -118,7 +124,7 @@ index 3560bb5..11c3ccb 100644
}
#endif
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index 186f23f..d19d3b1 100644
index 69537399..c56e0cea 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -10,7 +10,6 @@
@ -129,7 +135,7 @@ index 186f23f..d19d3b1 100644
#include <metal/utilities.h>
#include <openamp/rpmsg_virtio.h>
#include <openamp/virtqueue.h>
@@ -19,13 +18,6 @@
@@ -19,12 +18,6 @@
#define RPMSG_NUM_VRINGS 2
@ -139,10 +145,9 @@ index 186f23f..d19d3b1 100644
-/* Time to wait - In multiple of 1 msecs. */
-#define RPMSG_TICKS_PER_INTERVAL 1000
-
-
/* Default configuration */
#ifndef VIRTIO_DEVICE_ONLY
#define RPMSG_VIRTIO_DEFAULT_CONFIG \
/**
* struct vbuff_reclaimer_t - vring buffer recycler
*
--
2.25.1

View file

@ -1,11 +1,12 @@
From 00d0f99b49a5647107bc16249a141d1c727ec11e Mon Sep 17 00:00:00 2001
From: Guiding Li <liguiding1@xiaomi.com>
Date: Thu, 18 Nov 2021 20:54:45 +0800
Subject: [PATCH 2/9] openamp: add new ops notify_wait() support
From ddc209c9475a2822ffe5d18441bd01718acdbc11 Mon Sep 17 00:00:00 2001
From: ligd <liguiding1@xiaomi.com>
Date: Fri, 29 Jul 2022 22:57:23 +0800
Subject: [PATCH 4/9] openamp: add new ops notify_wait() support
This can avoid looping check tx buffer
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Change-Id: Ie340ed06c306ce978ff165aacaf5b830e3645af8
Signed-off-by: ligd <liguiding1@xiaomi.com>
---
lib/include/openamp/remoteproc.h | 12 ++++++++++++
lib/include/openamp/remoteproc_virtio.h | 2 ++
@ -14,11 +15,11 @@ Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
lib/include/openamp/virtio.h | 1 +
lib/remoteproc/remoteproc.c | 11 +++++++++++
lib/remoteproc/remoteproc_virtio.c | 14 ++++++++++++++
lib/rpmsg/rpmsg_virtio.c | 5 +++++
8 files changed, 55 insertions(+)
lib/rpmsg/rpmsg_virtio.c | 7 +++++++
8 files changed, 57 insertions(+)
diff --git a/lib/include/openamp/remoteproc.h open-amp/lib/include/openamp/remoteproc.h
index e9111ff..d276550 100644
index d1efab85..f6554404 100644
--- a/lib/include/openamp/remoteproc.h
+++ open-amp/lib/include/openamp/remoteproc.h
@@ -428,6 +428,18 @@ struct remoteproc_ops {
@ -41,10 +42,10 @@ index e9111ff..d276550 100644
* get_mem
*
diff --git a/lib/include/openamp/remoteproc_virtio.h open-amp/lib/include/openamp/remoteproc_virtio.h
index 70cff97..eaca76a 100644
index 6609a1fd..e65488d5 100644
--- a/lib/include/openamp/remoteproc_virtio.h
+++ open-amp/lib/include/openamp/remoteproc_virtio.h
@@ -22,6 +22,7 @@ extern "C" {
@@ -25,6 +25,7 @@ extern "C" {
/* define vdev notification function user should implement */
typedef int (*rpvdev_notify_func)(void *priv, uint32_t id);
@ -52,7 +53,7 @@ index 70cff97..eaca76a 100644
/**
* struct remoteproc_virtio
@@ -37,6 +38,7 @@ struct remoteproc_virtio {
@@ -40,6 +41,7 @@ struct remoteproc_virtio {
void *vdev_rsc;
struct metal_io_region *vdev_rsc_io;
rpvdev_notify_func notify;
@ -61,22 +62,22 @@ index 70cff97..eaca76a 100644
struct metal_list node;
};
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
index 11c3ccb..6f546e5 100644
index dbe42ea6..14440e20 100644
--- a/lib/include/openamp/rpmsg.h
+++ open-amp/lib/include/openamp/rpmsg.h
@@ -49,6 +49,7 @@ extern "C" {
#define RPMSG_ERR_BUFF_SIZE (RPMSG_ERROR_BASE - 5)
@@ -50,6 +50,7 @@ extern "C" {
#define RPMSG_ERR_INIT (RPMSG_ERROR_BASE - 6)
#define RPMSG_ERR_ADDR (RPMSG_ERROR_BASE - 7)
+#define RPMSG_ERR_NXIO (RPMSG_ERROR_BASE - 8)
#define RPMSG_ERR_PERM (RPMSG_ERROR_BASE - 8)
+#define RPMSG_ERR_NXIO (RPMSG_ERROR_BASE - 9)
struct rpmsg_endpoint;
struct rpmsg_device;
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
index aaba7e1..3ec0b0f 100644
index 0b22e840..11cb6df9 100644
--- a/lib/include/openamp/rpmsg_virtio.h
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
@@ -143,6 +143,15 @@ rpmsg_virtio_create_virtqueues(struct rpmsg_virtio_device *rvdev,
@@ -148,6 +148,15 @@ rpmsg_virtio_create_virtqueues(struct rpmsg_virtio_device *rvdev,
callbacks);
}
@ -93,7 +94,7 @@ index aaba7e1..3ec0b0f 100644
* rpmsg_virtio_get_buffer_size - get rpmsg virtio buffer size
*
diff --git a/lib/include/openamp/virtio.h open-amp/lib/include/openamp/virtio.h
index 916132b..0303a5b 100644
index 916132b4..0303a5b3 100644
--- a/lib/include/openamp/virtio.h
+++ open-amp/lib/include/openamp/virtio.h
@@ -162,6 +162,7 @@ struct virtio_dispatch {
@ -105,10 +106,10 @@ index 916132b..0303a5b 100644
int virtio_create_virtqueues(struct virtio_device *vdev, unsigned int flags,
diff --git a/lib/remoteproc/remoteproc.c open-amp/lib/remoteproc/remoteproc.c
index 9a0cf3e..4c101db 100644
index f7f9f2df..001b11bf 100644
--- a/lib/remoteproc/remoteproc.c
+++ open-amp/lib/remoteproc/remoteproc.c
@@ -880,6 +880,16 @@ static int remoteproc_virtio_notify(void *priv, uint32_t id)
@@ -899,6 +899,16 @@ static int remoteproc_virtio_notify(void *priv, uint32_t id)
return 0;
}
@ -125,7 +126,7 @@ index 9a0cf3e..4c101db 100644
struct virtio_device *
remoteproc_create_virtio(struct remoteproc *rproc,
int vdev_id, unsigned int role,
@@ -927,6 +937,7 @@ remoteproc_create_virtio(struct remoteproc *rproc,
@@ -957,6 +967,7 @@ remoteproc_create_virtio(struct remoteproc *rproc,
rproc_virtio_wait_remote_ready(vdev);
rpvdev = metal_container_of(vdev, struct remoteproc_virtio, vdev);
@ -134,7 +135,7 @@ index 9a0cf3e..4c101db 100644
num_vrings = vdev_rsc->num_of_vrings;
diff --git a/lib/remoteproc/remoteproc_virtio.c open-amp/lib/remoteproc/remoteproc_virtio.c
index cbfd966..ef5eef3 100644
index 169e5b5f..4375c4c3 100644
--- a/lib/remoteproc/remoteproc_virtio.c
+++ open-amp/lib/remoteproc/remoteproc_virtio.c
@@ -30,6 +30,19 @@ static void rproc_virtio_virtqueue_notify(struct virtqueue *vq)
@ -166,10 +167,10 @@ index cbfd966..ef5eef3 100644
/*
* We suppose here that the vdev is in a shared memory so that can
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index d19d3b1..80bfbf7 100644
index c56e0cea..4960aa8a 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -339,6 +339,11 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
@@ -373,6 +373,13 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
metal_mutex_release(&rdev->lock);
if (rp_hdr || !tick_count)
break;
@ -177,6 +178,8 @@ index d19d3b1..80bfbf7 100644
+ status = rpmsg_virtio_notify_wait(rvdev, rvdev->rvq);
+ if (status == RPMSG_SUCCESS)
+ continue;
+ else if (status != RPMSG_ERR_NXIO)
+ break;
+
metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
tick_count--;

View file

@ -1,21 +1,21 @@
From 13f72065d4085cebe10687f486edaa014b4adf6c Mon Sep 17 00:00:00 2001
From: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date: Mon, 18 Apr 2022 15:20:52 +0800
Subject: [PATCH 07/12] openamp: don't need check status when get_tx_payload
From 5a9d63c1ce2878aa792c49a1205ebb73dbe6258f Mon Sep 17 00:00:00 2001
From: ligd <liguiding1@xiaomi.com>
Date: Mon, 28 Feb 2022 16:31:54 +0800
Subject: [PATCH 5/9] rpmsg_virtio: don't need check status when get_tx_payload
Remove redundant check, because this status is already check in
rpmsg_init_vdev_with_config and rpmsg_virtio_wait_remote_ready.
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
VELAOS-21
Change-Id: Icb01034dfab146b3a02ea2c70dbdf197d8ed419f
Signed-off-by: ligd <liguiding1@xiaomi.com>
---
lib/rpmsg/rpmsg_virtio.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index adc3dbc..92f5883 100644
index 4960aa8a..1f6ce593 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -323,11 +323,6 @@ static void *rpmsg_virtio_get_tx_payload_buffer(struct rpmsg_device *rdev,
@@ -356,11 +356,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);

View file

@ -1,79 +0,0 @@
From bcaa279299ecd4194faffae71867c0371bf4f4a4 Mon Sep 17 00:00:00 2001
From: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date: Fri, 6 May 2022 10:41:57 +0800
Subject: [PATCH 06/12] openamp: divide shram to TX shram & RX shram by
config:txrx_shpool
In the multi core of lower power device, when one of core enters sleep,
it needs to put its corresponding share memory into retention mode to
save power consumption. Based on the limitations of the chip design,
when the CPU to which share memory belongs goes to sleep, the share
memory enters the retention mode, and other cores will not be able
to access it. When the share memory divides tx shm and rx shm
and the core of tx shm and rx shm are different, so that when one
CPU sleeps, the other CPU can still access its own tx shm.
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
---
lib/include/openamp/rpmsg_virtio.h | 10 ++++++++--
lib/rpmsg/rpmsg_virtio.c | 5 +++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h
index 3ec0b0f..c81b404 100644
--- a/lib/include/openamp/rpmsg_virtio.h
+++ open-amp/lib/include/openamp/rpmsg_virtio.h
@@ -56,6 +56,7 @@ struct rpmsg_virtio_shm_pool {
struct rpmsg_virtio_config {
uint32_t h2r_buf_size;
uint32_t r2h_buf_size;
+ bool split_shpool;
};
/**
@@ -208,8 +209,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
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index c555101..adc3dbc 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -24,6 +24,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
@@ -705,11 +706,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;
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";
--
2.25.1

View file

@ -1,21 +1,21 @@
From 442ccb015805eb5f7d700f80db9893d319ce5781 Mon Sep 17 00:00:00 2001
From a2c9d79f9b77f057d89ede1395559c0645169b7a Mon Sep 17 00:00:00 2001
From: ligd <liguiding1@xiaomi.com>
Date: Tue, 19 Oct 2021 19:45:14 +0800
Subject: [PATCH 10/12] rpmsg: notify the user when the remote address is
Subject: [PATCH 6/9] rpmsg: notify the user when the remote address is
received
Change-Id: I2f0601fb38944e0cfb8888aa397740161b159e40
Signed-off-by: ligd <liguiding1@xiaomi.com>
---
lib/include/openamp/rpmsg.h | 4 ++++
lib/rpmsg/rpmsg_virtio.c | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
lib/rpmsg/rpmsg_virtio.c | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h
index 6f546e5..10d4f5b 100644
index 14440e20..fbd7f619 100644
--- a/lib/include/openamp/rpmsg.h
+++ open-amp/lib/include/openamp/rpmsg.h
@@ -57,6 +57,7 @@ struct rpmsg_device;
@@ -58,6 +58,7 @@ struct rpmsg_device;
/* Returns positive value on success or negative error value on failure */
typedef int (*rpmsg_ept_cb)(struct rpmsg_endpoint *ept, void *data,
size_t len, uint32_t src, void *priv);
@ -23,7 +23,7 @@ index 6f546e5..10d4f5b 100644
typedef void (*rpmsg_ns_unbind_cb)(struct rpmsg_endpoint *ept);
typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
const char *name, uint32_t dest);
@@ -69,6 +70,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
@@ -70,6 +71,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
* @dest_addr: address of the default remote endpoint binded.
* @cb: user rx callback, return value of this callback is reserved
* for future use, for now, only allow RPMSG_SUCCESS as return value.
@ -32,7 +32,7 @@ index 6f546e5..10d4f5b 100644
* @ns_unbind_cb: end point service unbind callback, called when remote
* ept is destroyed.
* @node: end point node.
@@ -83,6 +86,7 @@ struct rpmsg_endpoint {
@@ -84,6 +87,7 @@ struct rpmsg_endpoint {
uint32_t addr;
uint32_t dest_addr;
rpmsg_ept_cb cb;
@ -41,16 +41,13 @@ index 6f546e5..10d4f5b 100644
struct metal_list node;
void *priv;
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index 4f26b01..e55e135 100644
index 1f6ce593..efbcd68d 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -598,14 +598,19 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
_ept->dest_addr = dest;
metal_mutex_release(&rdev->lock);
@@ -658,12 +658,18 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
if (_ept->name[0] && rdev->support_ack)
- rpmsg_send_ns_message(_ept,
- RPMSG_NS_CREATE_ACK);
+ rpmsg_send_ns_message(_ept, RPMSG_NS_CREATE_ACK);
rpmsg_send_ns_message(_ept,
RPMSG_NS_CREATE_ACK);
+ /* notify application that the endpoint has been bound */
+ if (_ept->ns_bound_cb)
+ _ept->ns_bound_cb(_ept);

View file

@ -1,7 +1,7 @@
From 8405b71cb738096a223c5f7ca02b9fa0de5ae0d6 Mon Sep 17 00:00:00 2001
From 0e77783658066c02903cc6693460f3bb577e3030 Mon Sep 17 00:00:00 2001
From: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date: Mon, 11 Apr 2022 13:31:35 +0800
Subject: [PATCH 11/12] openamp: avoid double calling ns_bound when each other
Subject: [PATCH 7/9] openamp: avoid double calling ns_bound when each other
calls create_ept
VELAPLATFO-1522
@ -13,10 +13,10 @@ Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index e55e135..cd3a13d 100644
index efbcd68d..49817799 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -594,7 +594,7 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
@@ -652,7 +652,7 @@ 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);
@ -25,7 +25,7 @@ index e55e135..cd3a13d 100644
_ept->dest_addr = dest;
metal_mutex_release(&rdev->lock);
if (_ept->name[0] && rdev->support_ack)
@@ -603,14 +603,19 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
@@ -662,14 +662,19 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
if (_ept->ns_bound_cb)
_ept->ns_bound_cb(_ept);
}

View file

@ -1,34 +0,0 @@
From 3ae038f84432e657dff78ed135204210b42a33a9 Mon Sep 17 00:00:00 2001
From: Guiding Li <liguiding1@xiaomi.com>
Date: Tue, 31 May 2022 23:04:01 +0800
Subject: [PATCH 08/12] openamp: add available_idx to dump
Just update debug logs
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
---
lib/virtio/virtqueue.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/virtio/virtqueue.c open-amp/lib/virtio/virtqueue.c
index d989533..2d243b8 100644
--- a/lib/virtio/virtqueue.c
+++ open-amp/lib/virtio/virtqueue.c
@@ -421,11 +421,11 @@ void virtqueue_dump(struct virtqueue *vq)
VRING_INVALIDATE(vq->vq_ring.used);
metal_log(METAL_LOG_DEBUG,
- "VQ: %s - size=%d; free=%d; queued=%d; "
- "desc_head_idx=%d; avail.idx=%d; used_cons_idx=%d; "
+ "VQ: %s - size=%d; free=%d; queued=%d; desc_head_idx=%d; "
+ "available_idx=%d; avail.idx=%d; used_cons_idx=%d; "
"used.idx=%d; avail.flags=0x%x; used.flags=0x%x\r\n",
vq->vq_name, vq->vq_nentries, vq->vq_free_cnt,
- vq->vq_queued_cnt, vq->vq_desc_head_idx,
+ vq->vq_queued_cnt, vq->vq_desc_head_idx, vq->vq_available_idx,
vq->vq_ring.avail->idx, vq->vq_used_cons_idx,
vq->vq_ring.used->idx, vq->vq_ring.avail->flags,
vq->vq_ring.used->flags);
--
2.25.1

View file

@ -1,7 +1,7 @@
From fb046d85d5e098f58af037322f0de2f663e8f460 Mon Sep 17 00:00:00 2001
From bcd10078fe4266cadbc437b130832dd90c00df33 Mon Sep 17 00:00:00 2001
From: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Fri, 15 Nov 2019 19:01:49 +0800
Subject: [PATCH 12/12] remoteproc: make all elf_* functions static except
Subject: [PATCH 8/9] remoteproc: make all elf_* functions static except
elf_identify
it's the best practice to reduce the name scope as small as possible
@ -13,7 +13,7 @@ Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2 files changed, 14 insertions(+), 107 deletions(-)
diff --git a/lib/include/openamp/elf_loader.h open-amp/lib/include/openamp/elf_loader.h
index e7dda74..916a23f 100644
index e7dda748..916a23f9 100644
--- a/lib/include/openamp/elf_loader.h
+++ open-amp/lib/include/openamp/elf_loader.h
@@ -323,99 +323,6 @@ extern const struct loader_ops elf_ops;
@ -117,7 +117,7 @@ index e7dda74..916a23f 100644
#if defined __cplusplus
}
diff --git a/lib/remoteproc/elf_loader.c open-amp/lib/remoteproc/elf_loader.c
index c90b8d4..ffb253f 100644
index c90b8d46..ffb253fb 100644
--- a/lib/remoteproc/elf_loader.c
+++ open-amp/lib/remoteproc/elf_loader.c
@@ -392,9 +392,9 @@ int elf_identify(const void *img_data, size_t len)

View file

@ -0,0 +1,27 @@
From 3af4aed5e9f7d0299ded056adcdd1259fc44f64c Mon Sep 17 00:00:00 2001
From: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Sun, 6 Nov 2022 00:51:35 +0800
Subject: [PATCH 9/9] Fix warn: declaration of 'vring_rsc' shadows a previous
local
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
lib/remoteproc/rsc_table_parser.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/remoteproc/rsc_table_parser.c open-amp/lib/remoteproc/rsc_table_parser.c
index 80879380..4cccf4f1 100644
--- a/lib/remoteproc/rsc_table_parser.c
+++ open-amp/lib/remoteproc/rsc_table_parser.c
@@ -144,8 +144,6 @@ int handle_vdev_rsc(struct remoteproc *rproc, void *rsc)
num_vrings = vdev_rsc->num_of_vrings;
for (i = 0; i < num_vrings; i++) {
- struct fw_rsc_vdev_vring *vring_rsc;
-
vring_rsc = &vdev_rsc->vring[i];
notifyid = vring_rsc->notifyid;
notifyid = remoteproc_allocate_id(rproc,
--
2.25.1

View file

@ -1,38 +0,0 @@
From 8aff77d4ceea809da273b68763aea737ed81da38 Mon Sep 17 00:00:00 2001
From: Guiding Li <liguiding1@xiaomi.com>
Date: Tue, 2 Aug 2022 11:12:19 +0800
Subject: [PATCH 09/12] openamp: firstly take all buffer from shram pool
1. the memory already alloced for shram
2. this can help dump the right free cnt
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
---
lib/rpmsg/rpmsg_virtio.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
index 92f5883..4f26b01 100644
--- a/lib/rpmsg/rpmsg_virtio.c
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
@@ -154,12 +154,13 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev,
#ifndef VIRTIO_DEVICE_ONLY
if (role == RPMSG_HOST) {
- data = virtqueue_get_buffer(rvdev->svq, len, idx);
- if (!data && rvdev->svq->vq_free_cnt) {
- data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool,
- rvdev->config.h2r_buf_size);
+ data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool,
+ rvdev->config.h2r_buf_size);
+ if (data) {
*len = rvdev->config.h2r_buf_size;
*idx = 0;
+ } else {
+ data = virtqueue_get_buffer(rvdev->svq, len, idx);
}
}
#endif /*!VIRTIO_DEVICE_ONLY*/
--
2.25.1

View file

@ -20,7 +20,7 @@
include $(TOPDIR)/Make.defs
VERSION ?= 2022.04.0
VERSION ?= 2022.10.0
include libmetal.defs
include open-amp.defs

View file

@ -35,18 +35,15 @@ ifeq ($(wildcard open-amp/.git),)
$(Q) curl -L https://github.com/OpenAMP/open-amp/archive/v$(VERSION).zip -o open-amp.zip
$(Q) unzip -o open-amp.zip
$(Q) mv open-amp-$(VERSION) open-amp
$(Q) patch -p0 < 0001-openamp-add-ns_unbind_notify-support.patch
$(Q) patch -p0 < 0002-ns-acknowledge-the-received-creation-message.patch
$(Q) patch -p0 < 0003-Negotiate-individual-buffer-size-dynamically.patch
$(Q) patch -p0 < 0004-rpmsg-wait-endpoint-ready-in-rpmsg_send-and-rpmsg_se.patch
$(Q) patch -p0 < 0005-openamp-add-new-ops-notify_wait-support.patch
$(Q) patch -p0 < 0006-openamp-divide-shram-to-TX-shram-RX-shram-by-config-.patch
$(Q) patch -p0 < 0007-openamp-don-t-need-check-status-when-get_tx_payload.patch
$(Q) patch -p0 < 0008-openamp-add-available_idx-to-dump.patch
$(Q) patch -p0 < 0009-openamp-firstly-take-all-buffer-from-shram-pool.patch
$(Q) patch -p0 < 0010-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch
$(Q) patch -p0 < 0011-openamp-avoid-double-calling-ns_bound-when-each-othe.patch
$(Q) patch -p0 < 0012-remoteproc-make-all-elf_-functions-static-except-elf.patch
$(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-wait-endpoint-ready-in-rpmsg_send-and-rpmsg_se.patch
$(Q) patch -p0 < 0004-openamp-add-new-ops-notify_wait-support.patch
$(Q) patch -p0 < 0005-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch
$(Q) patch -p0 < 0006-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch
$(Q) patch -p0 < 0007-openamp-avoid-double-calling-ns_bound-when-each-othe.patch
$(Q) patch -p0 < 0008-remoteproc-make-all-elf_-functions-static-except-elf.patch
$(Q) patch -p0 < 0009-Fix-warn-declaration-of-vring_rsc-shadows-a-previous.patch
endif
.openamp_headers: open-amp.zip