Commit Graph
1044 Commits
Author SHA1 Message Date
Arnaud Pouliquen e9eef7ce57 release: open-amp 2024.05.0
Set library version to 1.6.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>
v2024.05.0
2024-05-31 09:00:27 +02:00
Arnaud Pouliquen 0538be5c94 lib: fix build error using legacy VIRTIO_DEVICE/DRIVER_ONLY
As part of the deprecation process for VIRTIO_DEVICE_ONLY and
VIRTIO_DRIVER_ONLY, we should still support builds without errors when
possible.
For legacy support, define VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT
default values based on VIRTIO_DEVICE_ONLY and VIRTIO_DRIVER_ONLY.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-22 16:58:10 +02:00
Andrew Davis fdef576779 rpmsg_virtio: Use VIRTIO_ROLE_IS_{DRIVER,DEVICE}() macros
Now that we match role to VIRTIO_DEV_{DRIVER,DEVICE} we can replace
all these double check if statements with the role checking macro
already used in all other files.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-20 09:40:16 +02:00
Andrew Davis 5d8e63f2ef rpmsg_virtio: Deprecate RPMSG_HOST and RPMSG_REMOTE definitions
For all cases when the role is checked in rpmsg_virtio, what is being
checked is the role of the underlying virtio layer. As such, we should
be matching against the role definitions for the virtio layer
(VIRTIO_DEV_DEVICE and VIRTIO_DEV_DRIVER). Fix this here.

While the underlying virtio layer may be asymmetric, the RPMSG layer
generally is symmetrical. There is no need to define a HOST or REMOTE
role specific to the RPMSG layer. And as there are now no more internal
users of these definitions, deprecate them here.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-20 09:40:16 +02:00
Andrew Davis 31fb9138bc rpmsg_virtio: Fix return value comment for rpmsg_virtio_get_role()
The `role` member of `struct virtio_device` stores either the value
VIRTIO_DEV_DRIVER or VIRTIO_DEV_DEVICE. This means the function
rpmsg_virtio_get_role() will also return one of these values.
The values RPMSG_HOST and RPMSG_REMOTE are defined to be the same,
but there is no need for this redefinition. Update the return
values in the comment docs.

While here, remove the same from rpmsg_virtio_set_wait_cb() which
does not return anything, this looks to be a copy/paste error.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-20 09:40:16 +02:00
Andrew Davis e03d09a3fb apps: Remove manual assignment of ops and priv to rproc struct
This is handled by default, remove instances from apps. In cases
where there is nothing left in the init() callback remove it as
it is now optional.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-16 09:38:47 +02:00
Andrew Davis babba1bca0 remoteproc: Assign ops and priv to rproc struct in init by default
These need to be set in the rproc specific init() callback currently,
instead set them before calling the callback to make doing that in the
callback optional.

They can still be overwritten if needed in the init() callback but
if this is not needed as in some simple cases, then the callback is
not needed. Like other functions here, make this optional if no
additional modifications to the rproc struct are needed.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-16 09:38:47 +02:00
Andrew Davis bf87228730 rpmsg_virtio: Move get RX buffer into receive loop
This allows us to only need to call rpmsg_virtio_get_rx_buffer() once
at the start of the loop and is easier to comprehend.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-16 09:31:55 +02:00
Andrew Davis 40820be223 rpmsg_virtio: Move returned buffer kick to common location
After returning a buffer we kick the other side. This is done after both
call sites of the function that returns the buffer. Move this kick call
into that function to reduce code duplication and prevent it from not
being done after returning the buffer.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-16 09:31:55 +02:00
Arnaud Pouliquen 7257deaab3 lib: fix doxygen warning: "Found unknown command"
The doxygen build report issue for function descriptions that provide
reference to some function parameters using @:

...
lib/include/openamp/rpmsg.h:160: warning: Found unknown command '\data'
lib/include/openamp/rpmsg.h:160: warning: Found unknown command '\len'
...

Fix the warning by replacing with back-ticks that will be interpreted as
code by Markdown(Markdown support is enabled in the Doxygen configuration).

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-16 09:05:29 +02:00
Arnaud Pouliquen 304c34606e lib: fix doxygen miscellaneous warnings
Remove warning reported by Doxygen on doc generation:
- rewrite enum documentation,
- replace @ by \ref for references,
- fix param names

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-16 09:05:29 +02:00
Andrew Davis 2e5026fd7d virtio: Remove never used virtio_feature_name()
The comments states this was kept for "future use", that was a decade
ago.. Remove this never used function and associated data.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-13 18:03:46 +02:00
Arnaud Pouliquen 94b2125d1e apps: fix typo
fix minor typos in platform_info_remoteproc_master.c

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-13 15:28:35 +02:00
Arnaud Pouliquen 4786356011 apps: remove remaining master terminology
Some potentially offensive terms are still present in the code.
Replace them.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-13 15:28:35 +02:00
Arnaud Pouliquen e5cc3a3863 CI: Update for Ubuntu 24.04
Update CI to work with 24.04.

* Lock to 24.04 so we control when to change
* Update locale and timezone to work for 24.04 or 22.04
  * 24.04 creates these files if not already there but 22.04 does not
  * Keep existing work around for 22.04 but make it work if already there
* use venv
  * Breate a virtual environment isolated from the packages in the base
    environment
  * Inspired from zephyr build environment
* Use pip3 everywhere removing global and --user installation
* Add section to README about desktop testing
* Also fix usage formatting in README

Co-developed-by: Bill Mills <bill.mills@linaro.org>
Signed-off-by: Bill Mills <bill.mills@linaro.org>
Co-developed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-07 09:20:30 +02:00
Arnaud Pouliquen e0dc7bd1f2 lib: rpmsg_rpc: fix compilation warning and bad API
Fix following warning by updating bad rpc_id parameter type in
the rpmsg_rpc_client_send() API.
Align the rpc_id type to the one used in rpmsg_rpc_server_send().

/github/workspace/lib/service/rpmsg/rpc/rpmsg_rpc_client.c:60:9:
error: ‘memcpy’ reading 8 bytes from a region of size 4
[-Werror=stringop-overread]
1286
   60 |  memcpy(tmpbuf, &rpc_id, MAX_FUNC_ID_LEN);
1287
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1288
/github/workspace/lib/service/rpmsg/rpc/rpmsg_rpc_client.c:51:40:
note: source object ‘rpc_id’ of size 4
1289
   51 |  unsigned int rpc_id, void *request_param,
1290
      |  ~~~~~~~~~~~~~^~~~~~

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-07 08:47:26 +02:00
Arnaud Pouliquen 07109214ee lib: remove deprecated MASTER/SLAVE configuration
The use of the master and slave terminologies in configs and API are now
deprecated since 2 years, we can remove the associated code.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-05-06 19:35:22 +02:00
Andrew Davis 46c5b6f074 virtio: Remove unneeded forward declaration of virtio_feature_name()
This function is always used after its definition,
remove the unneeded forward declaration.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-05-03 15:55:02 +02:00
Andrew Davis f939a86143 lib: Add and use VIRTIO_ROLE_IS_{DRIVER,DEVICE}() macros
There is a common pattern of checking the virtio role while also checking
that this role is supported in this build, which can help optimize away
unusable code. Add a couple macros for this. This has two main benefits,
first being shorter and easier to read if statements, and also makes it
easier to not forget to always do both checks.

Use these everywhere except rpmsg_virtio.c which needs one more refactor
before we can switch it over.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-23 09:29:18 +02:00
Andrew Davis 7a8c292754 lib: Add and use VIRTIO_ENABLED() macro
Checks if this symbol is defined and set to equal 1. Used to make it
more clear that a preprocessor level check is intended.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-23 09:29:18 +02:00
Andrew Davis ca56246b19 lib: Use VIRTIO_{DRIVER,DEVICE}_SUPPORT to improve readability
Currently compiler defines are defined when support for driver or device
is the only support being built. This is a negative define, it surrounds
the code to not be built and we use ifndef. This is confusing. It also
leaves ifndefs all throughout the code-base. Instead, define a macro that
is set to 1 if support is enabled. Use this inline in if statements where
possible. Any sane compiler will optimize away the code in the branch
when support is not enabled just the same as when using the preprocessor
so we keep the same binary size.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-23 09:29:18 +02:00
Andrew Davis fd6a6fdda7 apps: Move common function declaration to common header
Several platform_*() functions are common across the example machines.
They actually have to be as they are consumed by example apps that build
across these machines. Move these common declarations to common a header.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-23 09:12:34 +02:00
Arnaud Pouliquen 793851621d rpmsg_virtio: fix initialized notify_wait_cb
The rvdev->notify_wait_cb is not initialized to NULL if
not set by the user.
Initialize it to NULL and provide an API for the application to set it.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-04-19 11:20:54 +02:00
Andrew Davis 4db4a08135 virtqueue: Fix comment on shm_io and fix type
This should hold a pointer to a metal_io_region, make that the type.

Also fix the comment above this variable. This region holds the address
of the message buffers, not the vring descriptor table nor available/used
ring data. It is only used for virt-to-phys/phys-to-vert translation on
the buffers pointed to by these descriptors.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-17 16:02:55 +02:00
Andrew Davis 3eab0819e5 virtio-mmio: Use the vmdev IO region for vq_ring.desc
The metal_io_region in the virtqueue struct is for translating
the buffer address stored in the virtqueue descriptor table, not
the address of the descriptor table itself.

This may have worked previously if the vring descriptors where part
of the same IO space as the buffers they point to, but this is not
guaranteed to always be the case. Fix that here.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-17 16:02:55 +02:00
Andrew Davis 20ba140e72 apps: linux_rpc_demo: Remove endpoint check when not used
If we do not use the endpoint there is no need to check it for NULL,
remove this check.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-17 15:59:16 +02:00
Andrew Davis 976baf3b59 apps: linux_rpc_demo: Do not access members of rpmsg_endpoint
The contents of this struct are internal to the RPMsg layer. Access
should only happen using accessor functions.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-17 15:59:16 +02:00
Andrew Davis 1680aada79 remoteproc: Un-inline remoteproc_init_mem() and remoteproc_add_mem()
Having these functions as inline header functions forces the contents of
struct remoteproc_mem to remain externally exposed. It also does not save
space in most cases as every call-site gets the full contents of the
function instead of just a call instruction. Make these normal functions
like all others in remoteproc.h.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 11:53:17 +02:00
Andrew Davis a6b48bd05b virtio: Use virtqueue_get_buffer() helpers
There are functions that handle invalidating and reading from vq_ring
members. Use those here to reduce code duplication.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 11:46:24 +02:00
Andrew Davis 2807e6481f rpmsg_virtio: Use priv data in name service callback
The callback allows us to add private data. Use that to store our
rpmsg_device instance instead of extracting it from the endpoint
struct. The contents of that struct are internal to the RPMsg layer.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 11:40:37 +02:00
Andrew Davis 9905d67bd9 rpmsg: Allow private endpoint data to be set in rpmsg_register_endpoint
There is a private data member in the endpoint struct that is passed into
the callback, but there is no way to populate it. Add this to the
endpoint register function.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 11:40:22 +02:00
Andrew Davis a5d7f13538 rpmsg_virtio: Do not make assumptions on struct member order
In rpmsg_virtio_ns_callback() we directly case from rpmsg_device* to
rpmsg_virtio_device*. This only works if rdev is the first member.
Use metal_container_of() to remove this assumption on struct order.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 11:37:03 +02:00
Andrew Davis 89a8a3002f apps: Convert examples to rpmsg_get_{tx,rx}_buffer_size()
The contents of app() in these examples is given a rpmsg_device. We should
not have to know about the backing transport layer. We assume it is virtio
and call into the virtio layer to get the buffer size. This information is
now available from the rpmsg layer. Use those functions to make the app()
agnostic to the backing layer.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 09:20:43 +02:00
Andrew Davis 52c27fbd91 rpmsg_virtio: Connect rpmsg get buffer for the virtio transport layer
RPMsg provides functions to get a transport's backing buffer sizes.
Connect this up for the virtio transport here.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 09:20:43 +02:00
Andrew Davis f81114b21d rpmsg: Add API for retrieving message buffer sizes
Add an RPMsg API to get the buffer sizes supported by the backing
transport layer. Add hooks so that transport layers can register
functions to provide this data.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-09 09:20:43 +02:00
Andrew Davis 9ddd85c9aa apps: examples: load_fw: Do not re-init rproc mems list
The memory list is already initialized before this callback is called.
Remove this redundant initialization.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-05 19:08:42 +02:00
Andrew Davis f757dad6f3 apps: examples: load_fw: Use accessors for remoteproc_mem and rproc
The remoteproc_mem and rproc structs contents are internal to remoteproc.
These should be accessed using the provided accessors, not directly. This
is done in preparation of making these struct opaque to code outside of
the remoteproc drivers.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-05 19:08:42 +02:00
Andrew Davis 3758939d83 apps: linux: generic: Use accessor functions for struct remoteproc_mem
The remoteproc_mem struct contents are internal to remoteproc. The struct
should be accessed using the provided accessors, not directly. This is
done in preparation of making this struct opaque to code outside of
the remoteproc drivers.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-05 19:08:42 +02:00
Andrew Davis 6623fee761 apps: system: linux: Use metal_io_finish() for closing io
Do not directly call into io->close(), use the accessor function.
While here, do not free the io structure as we did not allocate
it and have no way to know how it was allocated.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-05 19:07:08 +02:00
Zongcheng Han 04effe4fc7 remoteproc: drop unnecessary error return value
The rsc_table is checked against NULL in remoteproc_load().
But remoteproc_get_rsc_table() returns ERR_PTR after an error.
The error return value is unnecessary, just return NULL for failure.

Signed-off-by: Zongcheng Han <hanzongcheng@huawei.com>
2024-04-02 18:17:14 +02:00
Andrew Davis d13dd90c56 rpmsg_virtio: Return error code if waiting for remote fails
If we cannot finish waiting for the remote to be ready to start RPMsg
communication then return and propagate an error.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 18:05:03 +02:00
Andrew Davis 2427641697 rpmsg_virtio: Do not use rpmsg_virtio_{get,set} helpers
These functions are deprecated, use their replacements.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 18:05:03 +02:00
Andrew Davis d233fdc110 rpmsg_virtio: Deprecate functions that duplicate virtio functions
Do not expose new functions that reach into structs not belonging to
rpmsg_virtio, that breaks layering. Functions to access these members of
struct virtio are already provided by virtio, use those instead. Deprecate
the unneeded and layer breaking rpmsg_virtio functions for the same.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 18:05:03 +02:00
Andrew Davis 435a74175a rpmsg_virtio: Do not use rpmsg_virtio_{create,delete}_virtqueues helpers
These are only used internally by rpmsg_virtio. They also already exist
as part of the virtio API. Do not create an extra wrapper API out of
these functions. Use the virtio functions directly in rpmsg_virtio.c.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 18:05:03 +02:00
Andrew Davis 962b6ef071 rpmsg_virtio: Deprecate rpmsg_virtio_{create,delete}_virtqueues helpers
These are only used internally by rpmsg_virtio. They also already exist
as part of the virtio API. Do not create an extra wrapper API out of
these functions. Deprecate these functions.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 18:05:03 +02:00
Andrew Davis d50bb033a9 rsc_table_parser: Do not forward declare when not needed
Forward declaration of functions here is not needed, simply move
the function definition to top of the file. No functional change.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 15:54:23 +02:00
Andrew Davis a0b2b7c10f rsc_table_parser: Move header to make internal functions internal only
The files in include/openamp are deployed on install and can be used
by applications using the OpenAMP API. The functions in rsc_table_parser
are all internal use only. Move this header out of that location.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 15:54:23 +02:00
Andrew Davis d6b3604022 rsc_table_parser: Do not expose internal-only functions
These functions are only used within rsc_table_parser. These should be
only available there and made static. This prevents them from becoming
part of the API.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-04-02 15:54:23 +02:00
Yongrong Wang 15b4a8b621 openamp: add notify_wait_cb 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 set the notify_wait_cb in driver
and this callback function will be called to handle the wait when no
tx buffer in tx virtqueue.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-03-18 10:42:29 +01:00
Yongrong Wang 198e2e69a9 Revert "openamp: add new ops wait_notified() to avoid looping in tx buffer get"
This reverts commit 95802c1d03.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-03-18 10:42:29 +01:00