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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>