diff --git a/openamp/0001-ns-acknowledge-the-received-creation-message.patch b/openamp/0001-ns-acknowledge-the-received-creation-message.patch index e62f3f20390..f3dabb77651 100644 --- a/openamp/0001-ns-acknowledge-the-received-creation-message.patch +++ b/openamp/0001-ns-acknowledge-the-received-creation-message.patch @@ -1,7 +1,7 @@ From a4f6ac1cb1545fdadf7f80cf34f1d31b15d543f7 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 7 Jan 2019 02:15:42 +0800 -Subject: [PATCH 01/10] ns: acknowledge the received creation message +Subject: [PATCH 01/12] 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. diff --git a/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch b/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch index dbf0b518bf6..0afcb7c1195 100644 --- a/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch +++ b/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch @@ -1,7 +1,7 @@ From 4f552ae6fa88eec2a42c3933ea201ab71555838c Mon Sep 17 00:00:00 2001 From: anchao Date: Mon, 10 Dec 2018 16:26:39 +0800 -Subject: [PATCH 02/10] Negotiate individual buffer size dynamically +Subject: [PATCH 02/12] 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. diff --git a/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch b/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch index e84f21216d0..ef97747a25a 100644 --- a/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch +++ b/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch @@ -1,7 +1,7 @@ From 0fd409ef494b47464f57667b24fce91a4f1a5753 Mon Sep 17 00:00:00 2001 From: ligd Date: Tue, 19 Oct 2021 19:45:14 +0800 -Subject: [PATCH 03/10] rpmsg: notify the user when the remote address is +Subject: [PATCH 03/12] rpmsg: notify the user when the remote address is received Signed-off-by: ligd diff --git a/openamp/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch b/openamp/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch index 0ed785ba35b..d182beaf1ec 100644 --- a/openamp/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch +++ b/openamp/0004-rpmsg-wait-ept-ready-in-rpmsg_send.patch @@ -1,7 +1,7 @@ From a2c5e7e101392eb8b72acd608b81b525c643cf4a Mon Sep 17 00:00:00 2001 From: ligd Date: Wed, 20 Feb 2019 11:36:57 +0800 -Subject: [PATCH 04/10] rpmsg: wait ept ready in rpmsg_send +Subject: [PATCH 04/12] rpmsg: wait ept ready in rpmsg_send since the destination address need time to return from peer diff --git a/openamp/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch b/openamp/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch index 9fe851cdcb3..c4c8437b3de 100644 --- a/openamp/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch +++ b/openamp/0005-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch @@ -1,7 +1,7 @@ From 7c6597d46da6d1c3c085dda33262c89b633707ae Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 23 Jun 2022 00:41:13 +0800 -Subject: [PATCH 05/10] openamp: add VIRTIO_RING_F_MUST_NOTIFY event +Subject: [PATCH 05/12] openamp: add VIRTIO_RING_F_MUST_NOTIFY event Signed-off-by: ligd --- diff --git a/openamp/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch b/openamp/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch index 3a060e763f4..de559bd0af9 100644 --- a/openamp/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch +++ b/openamp/0006-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch @@ -1,7 +1,7 @@ From 8dcd7daec66939841c10872a0ca310ac16f10be2 Mon Sep 17 00:00:00 2001 From: wangyongrong Date: Wed, 3 Jul 2024 10:28:31 +0800 -Subject: [PATCH 06/10] rpmsg_virtio: don't need check status when +Subject: [PATCH 06/12] rpmsg_virtio: don't need check status when get_tx_payload Signed-off-by: ligd diff --git a/openamp/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch b/openamp/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch index a665a4121bf..8e136da2f0e 100644 --- a/openamp/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch +++ b/openamp/0007-virtqueue-move-virtqueue_nused-and-virtqueue_navail-.patch @@ -1,7 +1,7 @@ From bbaf772058b44a383b4ef81676eccd7a1b503c09 Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Wed, 20 Nov 2024 10:43:16 +0800 -Subject: [PATCH 07/10] virtqueue: move virtqueue_nused and virtqueue_navail to +Subject: [PATCH 07/12] virtqueue: move virtqueue_nused and virtqueue_navail to public Use these two apis to judge whether there is buffers in the virtqueues diff --git a/openamp/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch b/openamp/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch index 408dc8f6efa..28d4809fb9f 100644 --- a/openamp/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch +++ b/openamp/0008-lib-rpmsg-rpmsg_virtio-add-last-buffer-check-to-fix-.patch @@ -1,7 +1,7 @@ From fc9d645243c585731832ba42aa960a4ebb6656ab Mon Sep 17 00:00:00 2001 From: Bowen Wang Date: Mon, 26 May 2025 21:38:28 +0800 -Subject: [PATCH 08/10] lib/rpmsg/rpmsg_virtio: add last buffer check to fix +Subject: [PATCH 08/12] 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 diff --git a/openamp/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch b/openamp/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch index cf027055783..5124f1cba2a 100644 --- a/openamp/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch +++ b/openamp/0009-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch @@ -1,7 +1,7 @@ From 33fca04b5d33b7b501775f2384a6374eef302729 Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Wed, 10 Jul 2024 18:47:33 +0800 -Subject: [PATCH 09/10] virtio: change feature to 64 bit in all virtio_dispatch +Subject: [PATCH 09/12] 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 diff --git a/openamp/0010-openamp-add-assert-when-get-tx-buffer-failed.patch b/openamp/0010-openamp-add-assert-when-get-tx-buffer-failed.patch index ffc3a424663..6d769c40dea 100644 --- a/openamp/0010-openamp-add-assert-when-get-tx-buffer-failed.patch +++ b/openamp/0010-openamp-add-assert-when-get-tx-buffer-failed.patch @@ -1,7 +1,7 @@ From e201b5ba1fd11bb486a844afb2362d699f915f7f Mon Sep 17 00:00:00 2001 From: dongjiuzhu1 Date: Mon, 27 May 2024 20:32:46 +0800 -Subject: [PATCH 10/10] openamp: add assert when get tx buffer failed +Subject: [PATCH 10/12] openamp: add assert when get tx buffer failed So we can found the error more eaily diff --git a/openamp/0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch b/openamp/0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch new file mode 100644 index 00000000000..e3933087ae8 --- /dev/null +++ b/openamp/0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch @@ -0,0 +1,107 @@ +From a540e0d0c8537e204a437da7ebc57316e663e15c Mon Sep 17 00:00:00 2001 +From: Bowen Wang +Date: Mon, 30 Oct 2023 18:43:19 +0800 +Subject: [PATCH 11/12] remoteproc_virtio: add shm_io for remoteproc virtio and + API to set it + +Shm_io is a metal io used to access the shared memory just like the +virtio mmio device. +Before this patch, only virtio rpmsg device worked with the virtio +remoteproc transport layer, and we needs pass the shared memory io +region to the rpmsg_init_vdev() function. +This patch want to all the virtio devices can work with the virtio +remoteproc transport layer, so add shm_io in struct remoteproc_virtio. + +And later I will remove the shm_io in struct rpmsg_virtio_device instead +use shm_io in struct remoteproc_virtio. + +Signed-off-by: Bowen Wang +--- + lib/include/openamp/remoteproc_virtio.h | 14 ++++++++++++++ + lib/remoteproc/remoteproc_virtio.c | 24 ++++++++++++++++++++++++ + 2 files changed, 38 insertions(+) + +diff --git a/lib/include/openamp/remoteproc_virtio.h open-amp/lib/include/openamp/remoteproc_virtio.h +index f56026a029..e310f0f9a5 100644 +--- a/lib/include/openamp/remoteproc_virtio.h ++++ open-amp/lib/include/openamp/remoteproc_virtio.h +@@ -47,6 +47,9 @@ struct remoteproc_virtio { + /** Metal I/O region of vdev_info, can be NULL */ + struct metal_io_region *vdev_rsc_io; + ++ /** Metal I/O region of virtio device's share memory */ ++ struct metal_io_region *shm_io; ++ + /** Notification function */ + rpvdev_notify_func notify; + +@@ -85,6 +88,17 @@ rproc_virtio_create_vdev(unsigned int role, unsigned int notifyid, + */ + void rproc_virtio_remove_vdev(struct virtio_device *vdev); + ++/** ++ * @brief Set share memory io for remoteproc virtio device ++ * ++ * @param vdev Pointer to the virtio device ++ * @param shm_io Metal I/O region to set ++ * ++ * @return 0 for success, negative value for failure. ++ */ ++int rproc_virtio_set_shm_io(struct virtio_device *vdev, ++ struct metal_io_region *shm_io); ++ + /** + * @brief Initialize rproc virtio vring + * +diff --git a/lib/remoteproc/remoteproc_virtio.c open-amp/lib/remoteproc/remoteproc_virtio.c +index b07c0b3e45..7dee1354e0 100644 +--- a/lib/remoteproc/remoteproc_virtio.c ++++ open-amp/lib/remoteproc/remoteproc_virtio.c +@@ -40,6 +40,7 @@ static int rproc_virtio_create_virtqueue(struct virtio_device *vdev, + { + struct virtio_vring_info *vring_info; + struct vring_alloc_info *vring_alloc; ++ struct remoteproc_virtio *rpvdev; + int ret; + (void)flags; + +@@ -68,6 +69,15 @@ static int rproc_virtio_create_virtqueue(struct virtio_device *vdev, + if (ret) + return ret; + ++ /* ++ * If vq->shm_io is uninitialized, init it here. Now only rpmsg device ++ * init the shm_io specially instead of by transport layer. ++ */ ++ if (!vring_info->vq->shm_io) { ++ rpvdev = metal_container_of(vdev, struct remoteproc_virtio, vdev); ++ virtqueue_set_shmem_io(vring_info->vq, rpvdev->shm_io); ++ } ++ + return 0; + } + +@@ -341,6 +351,20 @@ err: + return NULL; + } + ++int rproc_virtio_set_shm_io(struct virtio_device *vdev, ++ struct metal_io_region *shm_io) ++{ ++ struct remoteproc_virtio *rpvdev; ++ ++ if (!vdev || !shm_io) ++ return -RPROC_EINVAL; ++ ++ rpvdev = metal_container_of(vdev, struct remoteproc_virtio, vdev); ++ rpvdev->shm_io = shm_io; ++ ++ return 0; ++} ++ + void rproc_virtio_remove_vdev(struct virtio_device *vdev) + { + struct remoteproc_virtio *rpvdev; +-- +2.34.1 + diff --git a/openamp/0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch b/openamp/0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch new file mode 100644 index 00000000000..af20ec6996c --- /dev/null +++ b/openamp/0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch @@ -0,0 +1,76 @@ +From 29314d06426b678c60cfb4d109147b2a9cdcb7b6 Mon Sep 17 00:00:00 2001 +From: Bowen Wang +Date: Thu, 25 Jul 2024 20:30:19 +0800 +Subject: [PATCH 12/12] remoteproc: sync the virtio rpmsg config with linux + side + +Add feature bit VIRTIO_RPMSG_F_CPUNAME and then add the host_cpuname +and remote_cpuname to the resource table to make the rpmsg virtio +device know the local and peer cpuname. + +Signed-off-by: Bowen Wang +--- + lib/include/openamp/remoteproc.h | 21 ++++++++++++++++----- + lib/include/openamp/rpmsg_virtio.h | 1 + + 2 files changed, 17 insertions(+), 5 deletions(-) + +diff --git a/lib/include/openamp/remoteproc.h open-amp/lib/include/openamp/remoteproc.h +index aadc7a798f..ea2c39ecfe 100644 +--- a/lib/include/openamp/remoteproc.h ++++ open-amp/lib/include/openamp/remoteproc.h +@@ -24,6 +24,8 @@ extern "C" { + + #define RPROC_MAX_NAME_LEN 32 + ++#define VIRTIO_RPMSG_CPUNAME_SIZE 8 ++ + /** + * @brief Resource table header + * +@@ -361,17 +363,26 @@ struct fw_rsc_vendor { + uint32_t len; + } METAL_PACKED_END; + +-/** @brief Configuration space declaration ((if VIRTIO_RPMSG_F_BUFSZ)) */ ++/** @brief Configuration space declaration */ + METAL_PACKED_BEGIN + struct fw_rsc_config { +- /** The host to remote buffer size */ ++ /** The host to remote buffer size (if VIRTIO_RPMSG_F_BUFSZ) */ + uint32_t h2r_buf_size; + +- /** The remote to host buffer size */ ++ /** The remote to host buffer size (if VIRTIO_RPMSG_F_BUFSZ) */ + uint32_t r2h_buf_size; + +- /** Reserve for the future use */ +- uint32_t reserved[14]; ++ /* The host side cpu name (if VIRTIO_RPMSG_F_CPUNAME) */ ++ ++ uint8_t host_cpuname[VIRTIO_RPMSG_CPUNAME_SIZE]; ++ ++ /* The remote side cpu name (if VIRTIO_RPMSG_F_CPUNAME) */ ++ ++ uint8_t remote_cpuname[VIRTIO_RPMSG_CPUNAME_SIZE]; ++ ++ /* Reserve for the future use */ ++ ++ uint32_t reserved[10]; + + /** Put the customize config here */ + } METAL_PACKED_END; +diff --git a/lib/include/openamp/rpmsg_virtio.h open-amp/lib/include/openamp/rpmsg_virtio.h +index a069bb02b0..da6cb62709 100644 +--- a/lib/include/openamp/rpmsg_virtio.h ++++ open-amp/lib/include/openamp/rpmsg_virtio.h +@@ -31,6 +31,7 @@ extern "C" { + #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ + #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 */ ++#define VIRTIO_RPMSG_F_CPUNAME 3 /* RP supports get local and peer cpu name */ + + #if defined(VIRTIO_USE_DCACHE) + #define BUFFER_FLUSH(x, s) metal_cache_flush(x, s) +-- +2.34.1 + diff --git a/openamp/open-amp.cmake b/openamp/open-amp.cmake index 825c0128627..93726d46c9d 100644 --- a/openamp/open-amp.cmake +++ b/openamp/open-amp.cmake @@ -58,6 +58,10 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp) ${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}/0010-openamp-add-assert-when-get-tx-buffer-failed.patch + && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch + && patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) diff --git a/openamp/open-amp.defs b/openamp/open-amp.defs index 30f7fde7d11..ada1b9e6678 100644 --- a/openamp/open-amp.defs +++ b/openamp/open-amp.defs @@ -76,6 +76,8 @@ open-amp.zip: $(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 + $(Q) patch -p0 < 0011-remoteproc_virtio-add-shm_io-for-remoteproc-virtio-a.patch + $(Q) patch -p0 < 0012-remoteproc-sync-the-virtio-rpmsg-config-with-linux-s.patch .openamp_headers: open-amp.zip else