Commit Graph
441 Commits
Author SHA1 Message Date
Tammy Leino 6d9df8fbac Add missing macros for driver/device-only compilation
Added macros to omit code when compiling for device-only.
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-08-17 15:05:14 +02:00
Arnaud Pouliquen afed3bd117 Terminology: Replace potentially offensive terms in documentation
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>
2022-05-31 10:15:47 +02:00
Ed Mooring 0107a28539 lib: Remove warnings from -Wcast-align
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>
2022-05-24 09:53:51 +02:00
Guiding Li 9fdadd0a4a openamp: add ns_unbind_cb to rpmsg_device
it's useful to notify the port layer and
also symmetry with ns_bind_cb callback

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
2022-05-16 09:51:12 +02:00
Xiang Xiao 3ff669b993 rpmsg: remove rpmsg_init_ept
since it is deprecated for while

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-04 15:01:29 -07:00
Ed Mooring 71c85d6b66 Terminology: Replace potentially offensive terms in the code.
In line with the terminology changes proposed by the OpenAMP
Technical Steering committe. Change VIRTIO_SLAVE_ONLY to
VIRTIO_DEVICE_ONLY. On linux, the two ends of the virtio communication
path are referred to as the "driver" (Linux), and the "device", in this
case running on the remote processor.

Terminology: Replace VIRTIO_MASTER_ONLY with VIRTIO_DRIVER_ONLY.

Terminology: Replace VIRTIO_DEV_SLAVE with VIRTIO_DEV_DEVICE

Terminology: Replace VIRTIO_DEV_MASTER with VIRTIO_DEV_DRIVER.

Apps: Fix variable names

Per guidance from the Technical Steering Committee, replace "master" and
"slave" with more appropriate terms.

lib: Replace RPMSG_MASTER with RPMSG_HOST

cmake: Change option names from "master", "slave" to "driver", "device".

Apps: Cleanup terminology

README: Update variable names to match the code.

Terminology: Add deprecation warnings to configuration variables.

Warn the user if they use the older, possibly offensively
named configuration variables.

Terminology: Clean up deprecation warnings.

CMake: Default deprecated configuration variables to off.

Make the deprecated WITH_VIRTIO_MASTER and WITH_VIRTIO_SLAVE
configuration variables default to OFF. This means that only deliberate
use of those variables will trigger the deprecation warning.

Terminology: Replace compiler-specific warnings with #warning.

In warning about deprecated constant names, change from
compiler-specific compile time warnings to the standard #warning.

fixup! Terminology: Replace potentially offensive terms in the code.

Fix the compilation error in zephyr by declaring a deprecated function

Deprecated message generated:
zephyr/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c: In function 'rpmsg_mng_task':
zephyr/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c:351:2: warning: 'deprecated_virtio_dev_slave' is deprecated [-Wdeprecated-declarations]
  351 |  rpdev = platform_create_rpmsg_vdev(0, VIRTIO_DEV_SLAVE, NULL,
      |  ^~~~~
In file included from modules/lib/open-amp/open-amp/lib/include/openamp/rpmsg_virtio.h:18,
                 from modules/lib/open-amp/open-amp/lib/include/openamp/open_amp.h:12,
                 from zephyr/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c:15:
modules/lib/open-amp/open-amp/lib/include/openamp/virtio.h:49:32: note: declared here
   49 | __deprecated static inline int deprecated_virtio_dev_slave(void)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~

fixup! Terminology: Replace potentially offensive terms in the code.

miscellaneous update

Signed-off-by: Ed Mooring <ed.mooring@gmail.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2022-04-29 10:12:09 +02:00
Tammy Leino dbb178198c rpmsg_virtio_get_buffer_size should return error on failure
Updated API to return RPMSG_ERR_NO_BUFF if no descriptor available
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-28 09:40:32 +02:00
Xiang Xiao 6f03c1e952 lib: add const for remoteproc_ops, image_store_ops and laoder_ops
to avoid load the constant data to ram in XIP mode

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-28 09:40:05 +02:00
Tammy Leino 0d75fa7d34 remoteproc_get_mem could wrongly match on name
Bound name comparison by RPROC_MAX_NAME_LEN instead of length of search string
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-20 09:08:36 +02:00
Tammy Leino e4307e142e Document buf argument in get_mem for remoteproc_ops structure
Added a description of the buf parameter to get_mem.
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-15 09:20:36 +02:00
Tammy Leino e89dbeb528 remoteproc_virtio_notify could use null notify operation
remoteproc_virtio_notify updated to check notify operation before invoking.
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-15 09:19:19 +02:00
Tammy Leino 2dcdc61587 virtqueue_add_buffer must check that there is room for multiple buffers
Ensure there is enough room for all the buffers being added to the vring.
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-14 09:16:40 +02:00
Arnaud Pouliquen 4728d56c85 Fix various typo with codespell
Found via `codespell -q 3 -S ./scripts/spelling.txt`

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2022-04-14 09:13:39 +02:00
Tammy Leino eecda52787 Removed unused code from rpmsg_get_endpoint
Case for src and dest address is unused since the first case matches src only.

Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
2022-04-06 10:24:57 +02:00
chao an 0307c3f0ed remoteproc: fix memory issue if load resource table failed
The old code pass the error code to metal_free_memory in failure
which is obviously wrong:

1. Generate the memory leak
2. May corrupt the heap manager

Signed-off-by: chao an <anchao@xiaomi.com>
2022-03-30 10:46:51 +02:00
Joshua Lin b139a1ff11 virtqueue: fix invalidate wrong cache region
The current code fetches the vring index before invalidating the cache.
This can lead to using an invalid index.
Fetch the index before invalidation to ensure a correct index.
Signed-off-by: Joshua Lin <jlin@petaio.com>
2022-02-24 16:59:41 +01:00
Joshua Lin 837f0784ee remoteproc: fix remoteproc get wrong memory
When memory region are continuous, it may get wrong memory region.
If pa is equal to the end address of the memory and size equal zero.
It will get wrong memory region.
So need to add check pa is smaller then end address.
Signed-off-by: Joshua Lin <jlin@petaio.com>
2022-02-24 16:59:41 +01:00
Xiang Xiao b8cd61b519 rpmsg: merge rpmsg_initialize_ept into rpmsg_register_endpoint
so the service with preserved address could call rpmsg_register_endpoint only

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-25 10:21:10 +01:00
Xiang Xiao 353122136d rpmsg_virtio: move RPMSG_VIRTIO_DEFAULT_CONFIG to private location
and define it to NULL when VIRTIO_SLAVE_ONLY is defined to save space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-24 09:37:31 +01:00
Hubert Miś a12d03ccc1 rpmsg_virtio: docs fixes for the rpmsg_init_vdev function
Replacing potentially objectionable terms from the function description.
Language fixes.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2022-01-04 10:20:47 +01:00
Hubert Miś 6cb75b8e58 rpmsg_virtio: configuration option to set buffer sizes per instance
Enable user of rpmsg_virtio to set sizes of TX and RX buffers per
created rpmsg_virtio instance. Each instance can use other buffer sizes.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2022-01-04 10:20:47 +01:00
Gaute Nilsson 9ef58af298 Remove vim modeline comments
This is currently inconsistent with the rest of the project.

Signed-off-by: Gaute Nilsson <gaute.nilsson@siemens-energy.com>
2021-12-16 18:08:24 +01:00
Junyan Lin 166055b78f remoteproc: fix notifyid assignment in handle_vdev_rsc
Fix the issue that it used vring_rsc->notifyid to allocate new IDs but
finally updated vdev_rsc->notifyid rather than vring_rsc->notifyid.

(See https://github.com/OpenAMP/open-amp/issues/314)

Signed-off-by: Junyan Lin <junyanlin@allwinnertech.com>
2021-12-13 08:42:11 +01:00
ViswaHarsha C 413ff36118 lib: added generic rpmsg services
defined generic services for rpmsg based calls between master and
slave

Signed-off-by: ViswaHarsha C <cviswa.harsha_ext@ltts.com>
2021-10-11 18:44:48 +02:00
Carlo Caione d9b8cefefa openamp: Introduce cache helpers
To manage shared vring memory behind caches.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-07 09:11:09 +02:00
Arnaud Pouliquen 7088ba5dd7 version: add generated define for version
For memory footprint reason it can be useful for applications
to use defines during the build pre-processing step.

Add a generated version_def.h file that will be accessible in the
the install directory ./build/bin/usr/local/include/openamp/.

Application will be able to use the version.h or the version_def.h
depending on its need.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2021-04-26 16:06:20 +02:00
Arnaud Pouliquen 2833ca2aaa lib: add new API to get the library version
Add similar API that the libmetal to allow application to get information
about the version of the openamp library.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2021-04-26 16:06:20 +02:00
Arnaud Pouliquen d8541f2f12 Rework the version management
PROJECT_VERSION* variables are recognized by cmake. Rename the
PROJECT_VER* variables used for the version.

Create a version file to make it easier to find and update the version.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2021-04-26 16:06:20 +02:00
Arnaud Pouliquen 7e6a6dacc5 rpmsg: fix variable overflow
The idx variable size is 16-bit. Add a cast to fix "expression may overflow"
code analysis complain.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
2021-04-26 16:05:43 +02:00
Guiding Li 5a5ac5edfd openamp: replace while(1) to metal_assert in RPMSG_ASSERT
replace while(1) to metal_assert

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
2021-04-19 17:00:42 +02:00
GFWisshit 278bcd2d10 Fix compilation error.Add missing semicolon. 2021-04-16 09:13:18 +02:00
Xiang Xiao e03656d53e remoteproc: add get_mem callback to remoteproc_ops
Since the mapping info is normally managed inside the porting
layer, the new callback could avoid the mapping duplication.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-16 09:13:18 +02:00
Guiding Li 60b77cbd4a openamp: fix ns_unbind_cb error when meet RPMSG_NS_DESTROY
Reason:
ns_unbind_cb should use user-named ept not NS ept

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
2020-12-10 16:23:53 +01:00
Chao An 47549566ea rpmsg: bring back zero copy transfer
Commit-id: b16ca55
Adding RPMsg Extension layer implementing zero-copy send and receive.

Signed-off-by: Chao An <anchao@pinecone.net>
2020-12-03 15:31:20 +01:00
Arnaud Pouliquen 39cbd87454 lib: add missing license information for rpmsg_retarget
Add BSD license and mentor copyright.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-12-01 10:14:00 +01:00
Xiang Xiao 38aed4aae4 rpmsg: virito: limit the buffer allocate from shared memory pool
rpmsg_virtio_get_tx_buffer shouldn't allocate the number of
buffer bigger than the virtio ring length of sending

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-09 15:27:21 +01:00
Xiang Xiao 8e6fb73843 rename size parameter to len for rpmsg_send_offchannel_raw
to align with other rpmsg_send_xxx function naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-05 13:05:24 -08:00
Arnaud Pouliquen 885a263451 rpmsg: set rpmsg_init_ept API as deprecated
The rpmsg_init_ept does not seem to be usable by application
but is used internally. This patch mark this API deprecated
and in at least two full release, to remove this API as the
standard API to use is rpmsg_create_ept.
In addition, move the rpmsg_init_ept to rpmsg_internal and rename it.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-10-12 14:16:12 +02:00
Simon Leiner 6a83524009 Cast allocated memory to target type
Although omitting the cast to the target type is idiomatic C, the
omission is actually forbidden in ISO C++. This patch enables the header
to be used in C++ code.

Signed-off-by: Simon Leiner <simon@leiner.me>
2020-07-27 11:29:06 +02:00
Xiang Xiao 54a15516aa rpmsg: send RPMSG_NS_DESTROY only when addr >= 1024
since the NS message shouldn't use for all well known services

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-23 11:10:02 +02:00
Xiang Xiao 94ca6c206a rpmsg: zero out rdev field in rpmsg_unregister_endpoint
so is_rpmsg_ept_ready can check the validity more easier

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-29 15:39:18 +02:00
Xiang Xiao be5b3b35d9 rpmsg: rpmsg_create_ept don't send RPMSG_NS_CREATE if name is empty
like what is done inside rpmsg_destroy_ept

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-29 15:39:18 +02:00
Xiang Xiao f6ab3dca65 rpmsg: rpmsg_unregister_endpoint management cleanup
to simplify the work in the furture

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-29 15:39:18 +02:00
Xiang Xiao a3a46ab518 rpmsg: reserve 0-1023 for predefined services in rpmsg_create_ept
and allocate the dynamic address from 1024 like Linux kernel

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-29 15:37:45 +02:00
Xiang Xiao 20292c5dca implement rproc_virtio_read_config/rproc_virtio_write_config
so the rpmsg could access the configuration space as needed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-13 11:03:59 +02:00
Xiang Xiao 7a8527e17b rpmsg: rpmsg_create_ept return RPMSG_ERR_ADDR if the address is in use
any error should return back to caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-13 09:52:55 +02:00
Xiang Xiao ff798a9103 rpmsg: remove the address check in rpmsg_send/rpmsg_trysend
since rpmsg_send_offchannel_raw already do the same validation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-13 09:52:55 +02:00
Arnaud Pouliquen 687bd9e924 lib: fix COMPARISON_TO_NULL reported by checkpatch
Align coding rule with checkpatch recommendation concerning
the comparison to null.
Some comparisons in macro have not be fixed for readability.
Examples of code not updated:
  VQ_PARAM_CHK(ring == NULL, status, ERROR_VQUEUE_INVLD_PARAM);
  VQASSERT(vq, cookie != NULL, "enqueuing with no cookie");

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-04-08 17:06:50 +02:00
Arnaud Pouliquen ef7cf424a8 virtio: fix virtqueue callback typedef
Fix declaration of the the function pointer type reported
by checkpatch tool.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-04-08 17:06:50 +02:00
Arnaud Pouliquen b8bc3b7122 lib: fix minor coding style.
Fix coding style reported by do_checkpatch.sh

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-04-08 17:06:50 +02:00