Commit Graph

1058 Commits

Author SHA1 Message Date
Yongrong Wang
79d20e69b3 rpmsg: Allow to send virqueue_kick only when RX queue is empty
Add VQ_RX_EMPTY_NOTIFY config to define the behavior. If
VQ_RX_EMPTY_NOTIFY is disabled, notify the other side each
time a buffer is released. If VQ_RX_EMPTY_NOTIFY is enabled,
only send one notification when the RX queue is empty to
improve performance.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-17 15:59:10 +02:00
Rajiv Mohan
14a37c7bfe zynq: Remove support for Zynq-7000 SoC
Remove openamp support for Zynq-7000 SoC, following changes are done
1) remove folder apps/machine/zynq7
2) remove folder apps/system/generic/machine/zynq7
3) remove file cmake/platforms/zynq7_generic.cmake
4) remove file cmake/platforms/zynq7_linux.cmake
5) Modify README.md files

Reasons to remove:
1) Support for Zynq-7000 has ended
2) Removing redundant or unmaintained code
3) Reduce technical debt carried by OpenAMP team
4) very few customer using openamp on Zynq-7000 SoC

For using Zynq-7000 SoC support
last working and tested version is (v2023.10)
https://github.com/OpenAMP/open-amp/tree/v2023.10

Signed-off-by: Rajiv Mohan <rajiv.mohan@amd.com>
2024-10-14 11:52:40 +02:00
Yongrong Wang
81ac4d3934 openamp/virtio.h: make final_features optional
negotiate also can be call when final_features is NULL

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-09 10:37:42 +02:00
Yongrong Wang
4df7975ab1 openamp/virtio.h: update vdev->features
set vdev->features in virtio_negotiate_features

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-09 10:37:42 +02:00
Yongrong Wang
c31e4fd626 remoteproc_virtio.c: fix rproc_virtio_negotiate_features return value
Make rproc_virtio_negotiate_features() return the mask of features
successfully negotiated.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-09 10:37:42 +02:00
Xiang Xiao
e7e7593ca3 rpmsg: Replace rvdev->vdev with vdev in rpmsg_init_vdev_with_config
vdev is passed by argument, so we don't need accees it indirectly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-09 10:34:12 +02:00
Zongcheng Han
c468328487 remoteproc: Do not update the rproc state if rproc->ops fails
* When rproc->ops fails, the state of rproc should not be updated.

Signed-off-by: Zongcheng Han <hanzongcheng@huawei.com>
2024-07-08 17:39:25 +02:00
Arnaud Pouliquen
b5aaf51edc Documentation: fix license.md and readme.md formating
Fix Doxygen warnings on markdown files.
The reported warning is "warning: Unsupported xml/html tag <....>"

This also corrects the display of markdown file in GitHub.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-07-08 17:34:01 +02:00
Andrew Davis
fdb8bf3424 virtio_mmio: Statically allocate metal_io_regions
Make the metal_io_region for cfg_io and shm_io into full member structs
instead of just pointers. This means they will be allocated along with
the parent virtio_mmio_device struct and not need dynamically allocated
later.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-07-05 09:41:06 +02:00
Andrew Davis
6780dd2378 virtio_mmio: Remove unneeded use of libmetal device
A virtual metal_device is created, then the needed IO regions are created
and added to this device. Immediately we extract these same regions back
out and make use of them. There is no reason to do this, instead simply
use the created IO regions.

This also removes the need to have struct metal_device defined to have
more than one IO region (METAL_MAX_DEVICE_REGIONS), which is not the
default and can change per-platform. If the libmetal library was built
with the default value for METAL_MAX_DEVICE_REGIONS, then this would
have led to runtime failures.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-07-05 09:41:06 +02:00
Arnaud Pouliquen
856680eb99 release: open-amp 2024.05.1
Set library version to 1.6.1

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
v2024.05.1
2024-06-28 08:42:09 +02:00
Arnaud Pouliquen
f2f6645349 lib: rpmsg: Pass endpoint private data during registration
This patch fixes the rpmsg_create_ept function passing the endpoint's private
data that can be set by the application before the call of
rpmsg_create_ept.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-06-28 08:42:09 +02:00
Arnaud Pouliquen
b7cadeb7ce lib: virtio: Rework macros VIRTIO_ROLE_IS_DEVICE and VIRTIO_ROLE_IS_DRIVER
The virtio.h header can be included by applications. In such cases,
VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT, which are used to
optimize the library, may not be defined in the application.

Define default VIRTIO_ROLE_IS_DEVICE and VIRTIO_ROLE_IS_DRIVER macros
that do not check for VIRTIO_DEVICE_SUPPORT or VIRTIO_DRIVER_SUPPORT if
they are not defined.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-06-28 08:42:09 +02:00
Arnaud Pouliquen
04a4185d79 lib: virtio: fix zephyr build warning
Building the samples/subsys/ipc/openamp_rsc_table/ sample generates the
following warning:

[24/182] Building C object zephyr/CMakeFiles/zephyr.dir/lib/open-amp/resource_table.c.obj
In file included from /zephyrproject/zephyr/lib/open-amp/./resource_table.h:11,
                 from /zephyrproject/zephyr/lib/open-amp/resource_table.c:30:
/zephyrproject/modules/lib/open-amp/open-amp/lib/include/openamp/virtio.h:83:2:
 warning: #warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined" [-Wcpp]
   83 | #warning "VIRTIO_DRIVER_SUPPORT and/or VIRTIO_DEVICE_SUPPORT should be defined"
      |  ^~~~~~~

The issue occurs because the project includes the virtio API while
VIRTIO_DRIVER_SUPPORT and VIRTIO_DEVICE_SUPPORT is only defined for
the open-amp library build.

Fix the warning by testing deprecated usage of VIRTIO_DRIVER_ONLY and
VIRTIO_DEVICE_ONLY but not under
#if !defined(VIRTIO_DRIVER_SUPPORT) && !defined(VIRTIO_DEVICE_SUPPORT)
condition.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2024-06-28 08:42:09 +02:00
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