aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/coda_int.h
stat options
Period:
Authors:

Commits per author per week (path 'fs/coda/coda_int.h')

AuthorW36 2025W37 2025W38 2025W39 2025Total
Total00000
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
Remote Processor Messaging (rpmsg) Framework

Note: this document describes the rpmsg bus and how to write rpmsg drivers.
To learn how to add rpmsg support for new platforms, check out remoteproc.txt
(also a resident of Documentation/).

1. Introduction

Modern SoCs typically employ heterogeneous remote processor devices in
asymmetric multiprocessing (AMP) configurations, which may be running
different instances of operating system, whether it's Linux or any other
flavor of real-time OS.

OMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP.
Typically, the dual cortex-A9 is running Linux in a SMP configuration,
and each of the other three cores (two M3 cores and a DSP) is running
its own instance of RTOS in an AMP configuration.

Typically AMP remote processors employ dedicated DSP codecs and multimedia
hardware accelerators, and therefore are often used to offload CPU-intensive
multimedia tasks from the main application processor.

These remote processors could also be used to control latency-sensitive
sensors, drive random hardware blocks, or just perform background tasks
while the main CPU is idling.

Users of those remote processors can either be userland apps (e.g. multimedia
frameworks talking with remote OMX components) or kernel drivers (controlling
hardware accessible only by the remote processor, reserving kernel-controlled
resources on behalf of the remote processor, etc..).

Rpmsg is a virtio-based messaging bus that allows kernel drivers to communicate
with remote processors available on the system. In turn, drivers could then
expose appropriate user space interfaces, if needed.

When writing a driver that exposes rpmsg communication to userland, please
keep in mind that remote processors might have direct access to the
system's physical memory and other sensitive hardware resources (e.g. on
OMAP4, remote cores and hardware accelerators may have direct access to the
physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox
devices, hwspinlocks, etc..). Moreover, those remote processors might be
running RTOS where every task can access the entire memory/devices exposed
to the processor. To minimize the risks of rogue (or buggy) userland code
exploiting remote bugs, and by that taking over the system, it is often
desired to limit userland to specific rpmsg channels (see definition below)
it can send messages on, and if possible, minimize how much control
it has over the content of the messages.

Every rpmsg device is a communication channel with a remote processor (thus
rpmsg devices are called channels). Channels are identified by a textual name
and have a local ("source") rpmsg address, and remote ("destination") rpmsg
address.

When a driver starts listening on a channel, its rx callback is bound with
a unique rpmsg local address (a 32-bit integer). This way when inbound messages
arrive, the rpmsg core dispatches them to the appropriate driver according
to their destination address (this is done by invoking the driver's rx handler
with the payload of the inbound message).


2. User API

  int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len);
   - sends a message across to the remote processor on a given channel.
     The caller should specify the channel, the data it wants to send,
     and its length (in bytes). The message will be sent on the specified
     channel, i.e. its source and destination address fields will be
     set to the channel's src and dst addresses.

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst);
   - sends a message across to the remote processor on a given channel,
     to a destination address provided by the caller.
     The caller should specify the channel, the data it wants to send,
     its length (in bytes), and an explicit destination address.
     The message will then be sent to the remote processor to which the
     channel belongs, using the channel's src address, and the user-provided
     dst address (thus the channel's dst address will be ignored).

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
							void *data, int len);
   - sends a message across to the remote processor, using the src and dst
     addresses provided by the user.
     The caller should specify the channel, the data it wants to send,
     its length (in bytes), and explicit source and destination addresses.
     The message will then be sent to the remote processor to which the
     channel belongs, but the channel's src and dst addresses will be
     ignored (and the user-provided addresses will be used instead).

     In case there are no TX buffers available, the function will block until
     one becomes available (i.e. until the remote processor consumes
     a tx buffer and puts it back on virtio's used descriptor ring),
     or a timeout of 15 seconds elapses. When the latter happens,
     -ERESTARTSYS is returned.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len);
   - sends a message across to the remote processor on a given channel.
     The caller should specify the channel, the data it wants to send,
     and its length (in bytes). The message will be sent on the specified
     channel, i.e. its source and destination address fields will be
     set to the channel's src and dst addresses.

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
   - sends a message across to the remote processor on a given channel,
     to a destination address provided by the user.
     The user should specify the channel, the data it wants to send,
     its length (in bytes), and an explicit destination address.
     The message will then be sent to the remote processor to which the
     channel belongs, using the channel's src address, and the user-provided
     dst address (thus the channel's dst address will be ignored).

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
							void *data, int len);
   - sends a message across to the remote processor, using source and
     destination addresses provided by the user.
     The user should specify the channel, the data it wants to send,
     its length (in bytes), and explicit source and destination addresses.
     The message will then be sent to the remote processor to which the
     channel belongs, but the channel's src and dst addresses will be
     ignored (and the user-provided addresses will be used instead).

     In case there are no TX buffers available, the function will immediately
     return -ENOMEM without waiting until one becomes available.
     The function can only be called from a process context (for now).
     Returns 0 on success and an appropriate error value on failure.

  struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev,