Commit Graph
1044 Commits
Author SHA1 Message Date
Umair Khan 79b795e954 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>
2024-02-29 08:42:07 +01:00
Bowen Wang 0c7e4202d0 remoteproc_virtio: optimize the remoteproc virtio transport layer
1. Implement the rproc_virtio_create_virtqueues() and
   rproc_virtio_delete_virtqueues().
2. Because 1, also modified the rpmsg init.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-23 09:51:00 +01:00
Umair Khan f94dde55e0 load_fw: The firmware loading loop terminates prematurely
The remoteproc_load_noblock() is a non-blocking API designed to load
the remote firmware in streaming mode. The application has to continue
supplying the firmware data blocks until the complete firmware is
loaded. The load_fw example does this and checks the `nlen` variable
(returned by the remoteproc_load_noblock() API) for zero to determine
if the firmware loading is complete. However, `nlen` (contains the
filesize of the next program header) alone can't be taken as the
sufficient condition to mark the completion of firmware loading as
0 is a valid value for filesize for sections that don't require
loading to the target memory such as the .bss section. This patch
proposes checking filesize as well as memsize as a better metric to
mark completion of the firmware loading loop.

Signed-off-by: Umair Khan <umair_khan@mentor.com>
2024-02-22 13:47:56 +01:00
Umair Khan b48965acdf Fixes #550: ELF loader loads ELF sections to their load addresses
Unlike the Linux rproc elf loader, the OpenAMP elf loader loads
the remote elf program segments to their load addresses instead
of their link addresses. This results in memory corruption when
the remote firmware attempts to relocate segments from their link
addresses to load addresses at runtime such as the data section.

Signed-off-by: Umair Khan <umair.khan.uet59@gmail.com>
2024-02-16 10:23:43 +01:00
Arnaud Pouliquen 7bf3cff391 remoteproc_virtio: fix vrings_info structure init
Only the first index of the vring_info is set to 0.
Apply the memset to the whole memory allocated.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-02-15 10:13:17 +01:00
Guiding Li b32187e4fb openamp: change rx/tx buffer hold flag to count
Before this commit, if rpmsg_hold_rx_buffer() is called in the endpoint
callback to hold current rx buffer and call rpmsg_release_rx_buffer()
to release this buffer immediately, this rx buffer will be returned to
the virtqueue twice:
1. the first time is in rpmsg_virtio_release_rx_buffer()
2. and the second time is in rpmsg_virtio_return_buffer() after ept->cb()
Follow shows this process:

rpmsg_virtio_rx_callback()
  - get rp_hdr
  - ept->cb(data = RPMSG_LOCATE_DATA(rp_hdr))
    - rpsmg_hold_rx_buffer(data)
    - rpmsg_release_rx_buffer(data) return buffer to virtqueue
  - rpmsg_virtio_return_buffer(data) return same buffer to virtqueue again

So this commit changes the HELD flag in rp_hdr to count to avoid this
use case and also supports hold/release rx buffer recursively.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Yin Tao <yintao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-10 14:04:50 +01:00
Bowen Wang 62a003d7c4 remoteproc_virtio: initialize the virtio device id when create vdev
Should init the device ID when create the virtio device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-09 10:06:13 +01:00
Taras Zaporozhets 1957ed269c lib: Add include directory to open_amp-static target
Include a header directory in the open_amp-static target, enabling
building and linking static library using CMake subdirectory.

Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
2024-01-04 16:01:07 +01:00
Taras Zaporozhets 88ab928c44 Add missing include with EINVAL definition
Fixes open-amp compilation with Vitis 2023.2 due to undeclared EINVAL.

Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
2023-12-19 15:48:59 +01:00
Bowen Wang 34f9a7c7be rpmsg_virtio: add RPMSG_ASSERT to check the virtqueue add error
Add RPMSG_ASSERT() to rpmsg_virtio_return_buffer() to check the
possible virtqueue buffer add error.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-12-05 14:19:38 +01:00
Guiding Li 1cff9f92d1 remoteproc: clear bitmap in remoteproc_stop()
Fix parse res_table failed when repeat start the remoteproc.
If we don't clear the bitmap it will failed in
  handle_vdev_rsc() -> remoteproc_allocate_id()

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
2023-12-05 13:29:13 +01:00
Guiding Li 95802c1d03 openamp: add new ops wait_notified() to avoid looping in tx buffer get
Give users a chance to handle the no tx buffer situation when get tx
buffer, with this patch, user can call rproc_virtio_set_wait_notified()
to set the wait_notified() callback and this callback function will be
called to handle the wait when no tx buffer in tx virtqueue.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-12-05 13:24:32 +01:00
Bowen Wang b33183fea5 rpmsg: add release cb and refcnt in endpoint to fix ept used-after-free
if rpmsg service free the ept when has got the ept from the ept
list in rpmsg_virtio_rx_callback, there is a used after free about
the ept, so add refcnt to end point and call the rpmsg service
release callback when ept callback fininshed.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-11-29 18:11:39 +01:00
Guiding Li 79b1a2cbe4 rpmsg: let rpmsg_virtio_get_tx_buffer() always return idx in host side
In rpmsg host side, the tx buffer index is not assigned when this buffer
is obtained from the reclaimer list, this commit let
rpmsg_virtio_get_tx_buffer() always get correct idx.

Note: the idx in rpmsg host side is not used, so this commit is just
an improvement and not fix any issue.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-11-22 11:28:33 +01:00
Dan Milea cce796dff4 service: rpmsg_rpc: fix build error
The if (&rpc->ept) comparison will always evaluate as 'true',
since rpc == &rpc->ept and rpc is previously checked to be valid.

This produces an error when building open-amp with gcc >= 13.

Signed-off-by: Dan Milea <dan.milea@windriver.com>
2023-11-21 09:24:43 +01:00
Arnaud Pouliquen 78043fa8b2 apps: Add use of rpmsg_virtio_get_tx/rx_buffer_size API
Print the max size of the RX and TX buffer payloads.
This allows to test the new API in the CI.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-11-20 11:37:39 +01:00
Guiding Li d51364594d openamp: add new API rpmsg_virtio_get_rx_buffer_size()
This API can be used by the endpoint callback to limit the rx
buffer usage range.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-11-06 16:00:37 +01:00
Guiding Li bbefedd495 rpmsg: set ept address to incease num when alloc from the bitmap
CPU0                                CPU1
create_ept1:addr1                   create_ept1
OK                       <======    msg1
OK                       <======    msg2
OK                       <======    msg3
                           msg4
                         <======    msg4 on the virtioqueue
close_ept1                          close_ept1

create_ept2:addr1                   create_ept1
(same addr with ept1)
                           msg4
ept2 recv ept1 msg ERROR <======

The msg4 which belong to ep1, error received by ept2.

For this issue, I give a resolve method:
Let the rpmsg_get_address() always return a new increased num.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
2023-10-31 18:52:41 +01:00
Arnaud Pouliquen 1904dee18d release: open-amp 2023.10.0
Set library version to 1.5.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
v2023.10.0
2023-10-31 09:44:37 +01:00
Arnaud Pouliquen 3e0228a613 README: add line wrap for line containing more than 100 characters.
To respect the coding rule and improve the readme read, wrap long lines

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-31 09:43:58 +01:00
Arnaud Pouliquen c2cb18c450 README: Point people to the official open-amp doc instead of the wiki
The doc reference is now the the Sphinx based OpenAMP-docs:
https://openamp.readthedocs.io/en/latest/.

The wiki documentation is deprecated, it should contains
only meeting notes.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-31 09:43:58 +01:00
Arnaud Pouliquen 4e13c09356 github action: Fix stales action to not close PR/issue after 7 days
By default the action closes the PR or issue 7 days after adding the
stale label.

The expected behavior is that the pull requests and issues will never be
closed automatically by the bot.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-25 14:49:46 +02:00
Arnaud Pouliquen de33a8d675 virtio: Fix delete_virtqueues function
The function should return void. the reason is that
vdev->func->delete_virtqueues() is optional and return void.

To be generic we should call virtio_delete_virtqueues in all cases.
Then depending on the dispatcher we do nothing or call delete_virtqueues()

Fixes: 7f90610 ("virtio: add create_virtqueues and delete_virtqueues in virtio_dispatch")

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-19 16:00:21 -07:00
Arnaud Pouliquen cd8823876f virtio: make unused function virtio_describe() deprecated
The virtio_describe() function does not seem usable.
Therefore, it should be marked as deprecated to initiate
the removal process.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-16 16:53:32 +02:00
Bill Mills 329fe101e4 Docs: style doxygen when built as part of OpenAMP docs
Detect when we are a submodule of OpenAMP-docs.
If so use the top level's Doxyfile overrides on top of our Doxyfile.
If not, no change.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
2023-10-13 19:01:06 +02:00
Arnaud Pouliquen 5fce292fd4 github action: add stales action
Add action to add stale label on issues and PR when no activity
during 45 days.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-13 10:31:32 +02:00
Arnaud Pouliquen 0360890c32 virtio: Add virtio_dev_name function description
Add function description in Doxygen format for documentation.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-13 10:29:36 +02:00
Arnaud Pouliquen adc68ec055 virtio: Complete virtio and virtqueue structures Doxygen description
Add descriptions for following structures:
- virtio_device_id
- virtio_feature_desc
- virtio_dispatch
- virtqueue_buf
- virtqueue
- vring_alloc_info

Move some comments related to the vring structure in its description.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-10-13 10:29:36 +02:00
Bill Mills 2dc51f1c73 Docs: enable readthedocs rendering (for PRs)
The Readthedocs pull-request integration is nice to have for PR review.
So run the whole OpenAMP-docs build but use the PR's commit

This also requires a ReadTheDocs project to install its integration for
this repo. The project should enable "Build pull request for this project".
It is currently in the Advanced Settings panel.

The project will also run for the main branch but that should be
ignored and only the main project URL should be shown outside of PRs.

To this end the sub-module project names will use "-prs" in the name.

Signed-off-by: Bill Mills <bill.mills@linaro.org>
2023-10-12 15:45:51 +02:00
Dan Milea bdf5f910c0 Refactor VRING macros for AMP VIRTIO
Renamed AMP VIRTIO macros to avoid conflicts.

Signed-off-by: Dan Milea <dan.milea@windriver.com>
2023-10-10 16:22:53 +02:00
Tammy Leino 937ba1d700 Doxygen updates for data structures
Improved doxygen formatting and consistency for data structures.
Signed-off-by: Tammy Leino <tammy.leino@siemens.com>
2023-10-06 16:44:53 +02:00
Iuliana Prodan f2162a69ac options: add option for all cache operations
Add WITH_DCACHE operation used for all cache operations:
vrings, buffers and resource table.
The other options will be deprecated - add warning
message for this.

Add info for WITH_DCACHE option in README.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-18 09:12:36 +02:00
Iuliana Prodan b4f10fbb69 virtqueue: define a common cache flush/invalidate
Since all cache operations, for vrings, buffer and
resource table are using metal_cache_flush and
metal_cache_invalidate, define a common function for all.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-18 09:12:36 +02:00
Iuliana Prodan 95a9038ca6 rpmsg: buffers flush/invalidate
Do buffers flush and invalidate the same as with vrings
and resource table:
- add defines in header file;
- call BUFFER_FLUSH/BUFFER_INVALIDATE where necessary.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-18 09:12:36 +02:00
Iuliana Prodan ca0747ebec virtqueue: move VRING_FLUSH and VRING_INVALIDATE to header
Move VRING_FLUSH and VRING_INVALIDATE defines to header file.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-18 09:12:36 +02:00
Iuliana Prodan 3882872bd5 options: fix typo
Fix typo for WITH_DCACHE_BUFFERS option.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-18 09:12:36 +02:00
Arnaud Pouliquen ca723b8418 CI: Fix Zephyr build by updating Zephyr SDK version to 0.16.1
Update zephyr SDK to 0.16.1 to fix CI build issue:
arm-zephyr-eabi-gcc: fatal error: cannot read spec file
'picolibc.specs': No such file or directory
compilation terminated.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-09-14 16:15:58 +02:00
Dan Milea e63d07d105 virtio: virtio-mmio framework
VIRTIO MMIO transport for OpenAMP.

Signed-off-by: Dan Milea <dan.milea@windriver.com>
2023-08-17 09:14:38 +02:00
Iuliana Prodan 5891cb4b2e README: add new cache option for resource table
Add info for WITH_DCACHE_RSC_TABLE option.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-07-17 17:16:05 +02:00
Iuliana Prodan a2456e61ee remoteproc: do cache invalidation before reading rsc_table info
Do a cache invalidation before reading the resource table's info
since this ca be in a cacheable region.

Make this optional, based on VIRTIO_CACHED_RSC_TABLE.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-07-17 17:16:05 +02:00
Bowen Wang 7f906105a9 virtio: add create_virtqueues and delete_virtqueues in virtio_dispatch
This is the first step to decoupling the virtio device and transport
layer.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-07-12 10:56:55 +02:00
Arnaud Pouliquen dcc21e6657 CI: Fix checkpatch
The CI does not consider "check" reported by checkpatch.
This commit fixes it by:

- rebasing check_compliance.py compliance.yml to integrate Zephyr updates,
- add detection of the "check" in the report.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-07-10 13:33:09 +02:00
Bowen Wang b177618da4 virtio: follow virtio v1.2 spec, add more virtio status and device id
Follow the virtio v1.2 spec, add more virtio status and device id
definition in virtio.h

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-06-22 09:50:50 +02:00
Arnaud Pouliquen fe5ac7a305 CI: update checkout action to V3
Node.js 12 actions are deprecated. Use the checkout V3
action to use Node.js 16

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-06-05 19:18:33 +02:00
Ben Levinsky 1697a15f47 apps: zynqmp: Add Versal_net IPI values.
Enable Linux demos to run on Versal_net by updating the IPI values that
are specific to this hardware platform.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
2023-05-22 09:38:28 +02:00
Arnaud Pouliquen accac4d361 release: open-amp 2023.04.0
Set library version to 1.4.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
v2023.04.0
2023-04-26 15:42:13 +02:00
Tammy Leino 1c29b1525a Updates to Doxyfile
Set tabs to 8 spaces and enabled doc generation for static functions.
Signed-off-by: Tammy Leino <tammy.leino@siemens.com>
2023-04-26 10:29:49 +02:00
Tammy Leino 873039d24e Function header description consistency
Updated function header descriptions formatting to be consistent.
Signed-off-by: Tammy Leino <tammy.leino@siemens.com>
2023-04-26 10:29:49 +02:00
Sergei Korneichuk 14f3f8405b version: use generated version_def.h
Using command line to define the OPENAMP_VERSION string macro breaks
Cygwin build on some releases of Microsoft Windows and CMake. Remove all
OPENAMP_VERSION macros from cmake compiler flags and use the ones from
the generated version_def.h file.

Signed-off-by: Sergei Korneichuk <sergei.korneichuk@amd.com>
2023-04-24 09:50:56 +02:00
Dwaipayan Ray 7106b67654 checkpatch: fix TYPO_SPELLING check for words with apostrophe
checkpatch reports a false TYPO_SPELLING warning for some words containing
an apostrophe when run with --codespell option.

A false positive is "doesn't".  Occurrence of the word causes checkpatch
to emit the following warning:

"WARNING: 'doesn'' may be misspelled - perhaps 'doesn't'?"

Modify the regex pattern to be more in line with the codespell default
word matching regex.  This fixes the word capture and avoids the false
warning.

In addition, highlight the misspelled word location by adding a caret
below the word.

Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
Suggested-by: Joe Perches <joe@perches.com>
Reported-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2023-04-20 13:27:39 +02:00