Compare commits

..

No commits in common. "0dfe540d001c193e46e73ee37e55ca4ef52ece7c" and "59cfe20287d54cf1f390f909d308836c144c36ab" have entirely different histories.

7 changed files with 4 additions and 183 deletions

View File

@ -1,53 +0,0 @@
From 124b01e83f31a404ccb4e796a840f9ff8c92e589 Mon Sep 17 00:00:00 2001
From: Yunfei Li <liyunfei33@huawei.com>
Date: Mon, 6 Mar 2023 15:28:33 +0800
Subject: [PATCH 1/2] apps:Fix atomic_flag error for clang compilation
Change atomic_int to atomic_flag to solve the error
reported when compiling with clang.
Signed-off-by: Yunfei Li <liyunfei33@huawei.com>
---
apps/examples/linux_rpc_demo/linux_rpc_demo.c | 5 +++--
apps/system/linux/machine/generic/platform_info.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/apps/examples/linux_rpc_demo/linux_rpc_demo.c b/apps/examples/linux_rpc_demo/linux_rpc_demo.c
index 16d39d4..35b4f28 100644
--- a/apps/examples/linux_rpc_demo/linux_rpc_demo.c
+++ b/apps/examples/linux_rpc_demo/linux_rpc_demo.c
@@ -37,7 +37,7 @@
static struct rpmsg_rpc_clt *rpmsg_default_rpc;
static int fd, bytes_written, bytes_read;
static struct polling poll;
-static atomic_int wait_resp;
+static atomic_flag wait_resp;
static void rpmsg_rpc_shutdown(struct rpmsg_rpc_clt *rpc)
{
@@ -465,7 +465,8 @@ int app(struct rpmsg_device *rdev, void *priv)
/* redirect I/Os */
LPRINTF("Initializating I/Os redirection...\r\n");
table_len = (int)sizeof(rpc_table) / sizeof(struct rpmsg_rpc_services);
- atomic_init(&wait_resp, 1);
+ wait_resp = (atomic_flag)ATOMIC_FLAG_INIT;
+ atomic_flag_test_and_set(&wait_resp);
ret = rpmsg_rpc_client_init(&rpc, rdev,
rpmsg_rpc_shutdown, rpc_table, table_len);
diff --git a/apps/system/linux/machine/generic/platform_info.c b/apps/system/linux/machine/generic/platform_info.c
index 9afd65e..f0980c8 100644
--- a/apps/system/linux/machine/generic/platform_info.c
+++ b/apps/system/linux/machine/generic/platform_info.c
@@ -51,7 +51,7 @@ struct vring_ipi_info {
/* Socket file path */
const char *path;
int fd;
- atomic_int sync;
+ atomic_flag sync;
};
struct remoteproc_priv {
--
2.28.0.windows.1

View File

@ -1,63 +0,0 @@
From 79b795e954e15d0d7c37d49fd32ac9cc0315bc3c Mon Sep 17 00:00:00 2001
From: Umair Khan <umair_khan@mentor.com>
Date: Wed, 7 Feb 2024 19:43:04 +0500
Subject: [PATCH] remoteproc: Fix management of non loadable program segments
The elf loader assumes that the last ELF program segment will always
be a LOAD type segment. I deduce this from the fact that the elf_load()
function, when loading the remote ELF sections during the
RPROC_LOADER_READY_TO_LOAD stage, compares the last load segment num
to the total ELF sections to determine if the loading is complete and
it can move to the next stage RPROC_LOADER_POST_DATA_LOAD. If the last
program segment in the ELF is not of type LOAD, the last loaded LOAD
segment never equals total ELF sections. This creates an error
condition and the firmware loading fails. This patch fixes this issue
by comparing the last loaded LOAD segment number with the max LOAD
segment number in the ELF.
Signed-off-by: Umair Khan <umair_khan@mentor.com>
diff --git a/lib/remoteproc/elf_loader.c b/lib/remoteproc/elf_loader.c
index 4d50183..c0eb116 100644
--- a/lib/remoteproc/elf_loader.c
+++ b/lib/remoteproc/elf_loader.c
@@ -571,20 +571,25 @@ int elf_load(struct remoteproc *rproc,
nsegment = *load_state & ELF_NEXT_SEGMENT_MASK;
phdr = elf_next_load_segment(*img_info, &nsegment, da,
noffset, &nsize, &nsegmsize);
- if (!phdr) {
- metal_log(METAL_LOG_DEBUG, "cannot find more segment\r\n");
- *load_state = (*load_state & (~ELF_NEXT_SEGMENT_MASK)) |
- (nsegment & ELF_NEXT_SEGMENT_MASK);
- return *load_state;
- }
- *nlen = nsize;
- *nmemsize = nsegmsize;
+
phnums = elf_phnum(*img_info);
- metal_log(METAL_LOG_DEBUG, "segment: %d, total segs %d\r\n",
- nsegment, phnums);
+ if (phdr) {
+ *nlen = nsize;
+ *nmemsize = nsegmsize;
+ metal_log(METAL_LOG_DEBUG, "segment: %d, total segs %d\r\n",
+ nsegment, phnums);
+ }
+
if (nsegment == phnums) {
- *load_state = (*load_state & (~RPROC_LOADER_MASK)) |
+ if (phdr) {
+ *load_state = (*load_state & (~RPROC_LOADER_MASK)) |
RPROC_LOADER_POST_DATA_LOAD;
+ } else {
+ metal_log(METAL_LOG_DEBUG, "no more segment to load\r\n");
+ *load_state = (*load_state & (~RPROC_LOADER_MASK)) |
+ RPROC_LOADER_LOAD_COMPLETE;
+ *da = RPROC_LOAD_ANYADDR;
+ }
}
*load_state = (*load_state & (~ELF_NEXT_SEGMENT_MASK)) |
(nsegment & ELF_NEXT_SEGMENT_MASK);
--
2.34.1

View File

@ -1,44 +0,0 @@
From e49995a8a0b354c890454333f7d5ca9712078b83 Mon Sep 17 00:00:00 2001
From: Yunfei Li <liyunfei33@huawei.com>
Date: Mon, 6 Mar 2023 15:36:57 +0800
Subject: [PATCH 2/2] lib:Fix atomic_flag error for clang compilation
Change atomic_int to atomic_flag to solve the error
reported when compiling with clang.
Signed-off-by: Yunfei Li <liyunfei33@huawei.com>
---
lib/include/openamp/rpmsg_retarget.h | 2 +-
lib/proxy/rpmsg_retarget.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/include/openamp/rpmsg_retarget.h b/lib/include/openamp/rpmsg_retarget.h
index b5fe8c6..791874b 100644
--- a/lib/include/openamp/rpmsg_retarget.h
+++ b/lib/include/openamp/rpmsg_retarget.h
@@ -46,7 +46,7 @@ struct rpmsg_rpc_syscall {
struct rpmsg_rpc_data {
struct rpmsg_endpoint ept;
int ept_destroyed;
- atomic_int nacked;
+ atomic_flag nacked;
void *respbuf;
size_t respbuf_len;
rpmsg_rpc_poll poll;
diff --git a/lib/proxy/rpmsg_retarget.c b/lib/proxy/rpmsg_retarget.c
index 7a1cb7e..2b93427 100644
--- a/lib/proxy/rpmsg_retarget.c
+++ b/lib/proxy/rpmsg_retarget.c
@@ -85,7 +85,8 @@ int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc,
rpc->ept_destroyed = 0;
rpc->respbuf = NULL;
rpc->respbuf_len = 0;
- atomic_init(&rpc->nacked, 1);
+ rpc->nacked = (atomic_flag)ATOMIC_FLAG_INIT;
+ atomic_flag_test_and_set(&rpc->nacked);
ret = rpmsg_create_ept(&rpc->ept, rdev,
ept_name, ept_addr, ept_raddr,
rpmsg_rpc_ept_cb, rpmsg_service_unbind);
--
2.28.0.windows.1

View File

@ -1,15 +1,11 @@
Name: openamp Name: openamp
Version: 2022.10.1 Version: 2022.04.0
Release: 6 Release: 2
Summary: Open asymmetric multiprocessing framework Summary: Open asymmetric multiprocessing framework
License: BSD-3-Clause License: BSD-3-Clause
URL: http://github.com/OpenAMP URL: http://github.com/OpenAMP
Source0: https://github.com/OpenAMP/open-amp/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/OpenAMP/open-amp/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0001:0001-apps-Fix-atomic_flag-error-for-clang-compilation.patch
Patch0002:0002-lib-Fix-atomic_flag-error-for-clang-compilation.patch
Patch0003:0001-remoteproc-Fix-management-of-non-loadable-program-se.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
@ -71,21 +67,6 @@ cd build
%{_bindir}/*-shared %{_bindir}/*-shared
%changelog %changelog
* Sat Mar 16 2024 hanzongcheng <hanzongcheng@huawei.com> - 2022.10.1-6
- Add patch to fix elf loader bug
* Mon Jun 05 2023 hanzongcheng <hanzongcheng@huawei.com> - 2022.10.1-5
- Keep changlog and release consistent
* Fri March 24 2023 liyunfei <liyunfei33@huawei.com> - 2022.10.1-5
- add patch for clang compile
* Wed March 15 2023 hanzongcheng <hanzongcheng@huawei.com> - 2022.10.1-4
- rename to openamp
* Mon Feb 27 2023 hanzongcheng <hanzongcheng@huawei.com> - 2022.10.1-3
- update to 2022.10.1
* Tue Aug 9 2022 zhangziyang <zhangziyang1@huawei.com> - 2022.04.0-2 * Tue Aug 9 2022 zhangziyang <zhangziyang1@huawei.com> - 2022.04.0-2
- synchronous embedded compilation and packaging options - synchronous embedded compilation and packaging options

View File

@ -1,4 +1,4 @@
version_control: github version_control: github
src_repo: https://github.com/OpenAMP/open-amp src_repo: https://github.com/OpenAMP/meta-openamp
tag_prefix: "^v" tag_prefix: "^v"
separator: "." separator: "."

BIN
openamp-2022.04.0.tar.gz Normal file

Binary file not shown.

Binary file not shown.