Port commit 46d0418088 ("zynqmp_r5 resource table: Change notifyid
for the virtio device.") to zynq7 and microblaze.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
Add CMAKE_C_FLAGS warnings to highlight potential issue:
"-Wall -Wextra -Wshadow -Wunused-but-set-variable"
And force warning as error with "-Werror"
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
"Sysbuild is a higher-level build system that can be used to combine
multiple other build systems together"
Add the option by default for all platform as it is compatible with
a single image.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
regressed by commit 03c80a1341
Author: Tammy Leino <tammy_leino@mentor.com>
Date: Mon Sep 26 08:14:35 2022 -0700
handle_vdev_rsc must return error if notifyid cannot be assigned
Updated handle_vdev_rsc to return error if a unique id cannot be assigned
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
1. At firmware build time, the resource table for the Xilinx zynqmp_r5
is set up with notifyid==0 for the rpmsg virtio device. The vrings are
set up with notifyid==1 for vring0 and notifyid==2 for vring1.
2. When the firmware is loaded onto the R5 via the Linux remoteproc sysfs
interface, the kernel remoteproc implementation ignores the notifyid
values for the vrings, and reallocates them, changing the resource
table. On the Xilinx configuration I tested on, this results in vring0
being allocated notifyid 0, and vring1 being allocated notifyid 1.
3. When the remote processor is started, it parses the resource table. When
it gets to the virtio device, it calls handle_vdev_rsc(), which
in turn calls remoteproc_allocate_id() with the vdev's notifyid of
0. This successfully returns 0. Then handle_vdev_rsc() goes through the
vrings. On vring0, it calls remoteproc_allocate_id(), with notifyid set to
0, because Linux changed vring0.notifyid from 1 to 0 in (2) above. This
results in remoteproc_allocate_id() returning RSC_NOTIFY_ID_ANY. This
causes handle_vdev_rsc() to return -RPROC_ERR_RSC_TAB_NP after commit
03c80a1, which causes the firmware startup to fail.
This appeared to work in previous versions, because
remoteproc_allocate_id() returning RSC_NOTIFY_ID_ANY was effectively
ignored, leaving the notifyid unchanged and allowing execution to
continue.
Set the value of notifyid for the virtio device (rvdev) to 31 to
avoid possible conflicts with the Linux imposed values.
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
The arm-none-eabi-gcc complains when VIRTIO_DEVICE_ONLY is enable
remoteproc_virtio.c:222:29: warning: variable 'vring_rsc'
set but not used [-Wunused-but-set-variable]
222 | struct fw_rsc_vdev_vring *vring_rsc;
| ^~~~~~~~~
The vring_rsc variable should be declared and set only if
VIRTIO_DEVICE_ONLY is not enable.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
With the no-copy feature a tx buffer can be get, filled and then
sent to the remote side.
In Some error cases the application can need to release it instead
of sending it to the remote side.
As the virtqueue is updated when the buffer it get, it is not
possible to manage this use case at virtqueue level.
This patchset implements the release based on a buffer recycler.
The principle is to store the released buffer in a 'reclaimer' list.
On next get pmsg_virtio_get_tx_buffer call the buffer is reused.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
As it possible to get the buffer length we need also to retrieve
the address associated to the descriptor index.
This is need by rpmsg virtio to implement the buffer recycler.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Add short description of the no-copy user interface.
Add some sub-chapters to increase the readability.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Add an API to be able to release unused TX buffer that will not be
sent.
For instance this API can be called in case of error between the
buffer reservation and the send to the remote side.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
rpc_demo.c file creates firmware that runs on remote processor.
The current description implies that proxy service is implemented
on remote side which is not true. Fix description and explicitly
mention that proxy service is implemented on host side
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
The instructions to build open-amp for zephyr do not work.
Instead of trying to maintain a cross dependency between the zephyr
and the open-amp, just reference the zephyr project and documentation
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
After a toolchain upgrade, the OpenAMP rpc_demod application would
fail with a bus error on AArch64 Linux. This was because the call to
copy_from_shbuf() was now inlined by the optimizer and the compiler
generated code that used 8-byte copies ("ldp x10, x11 [x4, #16]" followed
by the corresponding store instruction). The bus error happened when
the address in x4 (the index) was 4-byte aligned, but not 8-byte aligned.
This would not be a problem with normal user-space memory, but the memory
used for the shared buffer between the remote processor and Linux is
mapped as device memory. On AArch64, device memory is strictly ordered
and the alignment and width of accesses must match.
Replace copy_from_shbuf() with a call to metal_io_block_read(), which
is intended to do this sort of thing, and also makes this a better
example of how to use OpenAMP.
Return error only on a negative return value from copy_from_shbuf in
rpmsg_endpoint_cb.
Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Add Apache and GPL licensing to cover CI test scripts in case they
are converted to SPDX:
Apache-2.0
scripts/ci/check_compliance.py
scripts/do_checkpatch.sh
scripts/gitlint/commit_rules.py
GPL-2.0
scripts/checkpatch.pl
scripts/spelling.txt
Note: Neither Apache nor GPL are used by the libmetal library itself.
Signed-off-by: Manikanta Sreeram <manikanta.sreeram@xilinx.com>
Fix the following error:
Remote>Opened file 'remote.file' with fd = 8
*** buffer overflow detected ***: rpc_demod-shared
1. Change RPC_BUFF_SIZE to accomodate the remote
2. Set size to the minimum of the request or the buffer size
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
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>
No symbols from rsc_table.h are used in linux_rpc_demo.c and
the demo fails to build for Zynq, ZynqMP, and Versal systems.
Remove include rsc_table.h.
Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
In line with the terminology changes proposed by the OpenAMP
Technical Steering committee. Suppress "master and "slave" terms
in comments and documentations.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Realign data structure description with the code.
The Description of the libmetal API is removed.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
There were several places in the library where a char* was used to point
to a wider type (uint32_t or a struct). Casting the char* to the wider
type resulted in a compiler warning.
This commit changes some simple casts to (void *) to silence compiler
warnings. In rsc_table_parser.c, replace casts and pointer arithmetic
with explicit uses of fw_rsc_hdr.
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Building OpenAMP for standalone ARM R5, the following warning occurs:
CMake Deprecation Warning at
/usr/share/cmake-3.16/Modules/CMakeForceCompiler.cmake:75 (message):
The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set
CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
cmake/platforms/cross_generic_gcc.cmake:5 (CMAKE_FORCE_C_COMPILER)
/home/mooring/build-oa/toolchain.r5-oa.sa:18 (include)
/usr/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:93 (include)
CMakeLists.txt:19 (project)
Follow the suggestions in the above error message, and add
CMAKE_TRY_COMPILE_TARGET_TYPE = STATIC LIBRARY, which makes try_compile()
not try to link the cross-compiled binary. This is necessary because the
arm-none-eabi toolchain libgcc doesn't have an implementation of _exit(),
leaving that to the BSP. This results in a CMake error because it can't
build the test executable.
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
While building the Xilinx R5 demo apps, the following error message
occurs:
CMake Error at apps/examples/echo/CMakeLists.txt:38 (add_executable):
Target "rpmsg-echo.out" links to item " -Wl,--defsym,_rsc_table=0x3ed20000
-T"/OpenAMP-Project/gh3/open-amp/apps/system/generic/machine/zynqmp_r5/
linker_remote.ld""
which has leading or trailing whitespace. This is now an error according
to policy CMP0004.
Remove the leading space.
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>