From: anish kumar <yesanishhere@gmail.com>
To: ohad@wizery.com, bjorn.andersson@linaro.org,
mathieu.poirier@linaro.org, corbet@lwn.net
Cc: linux-remoteproc@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
anish kumar <yesanishhere@gmail.com>
Subject: [PATCH V4 5/7] Remoteproc: Documentation: add userspace api
Date: Tue, 22 Oct 2024 22:33:55 -0700 [thread overview]
Message-ID: <20241023053357.5261-6-yesanishhere@gmail.com> (raw)
In-Reply-To: <20241023053357.5261-1-yesanishhere@gmail.com>
Add information about how userspace
can control the remoteproc framework
and different ways to do that.
Signed-off-by: anish kumar <yesanishhere@gmail.com>
---
Documentation/driver-api/remoteproc/index.rst | 1 +
.../driver-api/remoteproc/remoteproc-api.rst | 77 +++++++++++++++++++
2 files changed, 78 insertions(+)
create mode 100644 Documentation/driver-api/remoteproc/remoteproc-api.rst
diff --git a/Documentation/driver-api/remoteproc/index.rst b/Documentation/driver-api/remoteproc/index.rst
index 7fa1c5755be8..840b4672352b 100644
--- a/Documentation/driver-api/remoteproc/index.rst
+++ b/Documentation/driver-api/remoteproc/index.rst
@@ -20,6 +20,7 @@ Authors:
remoteproc
remoteproc-kernel-api
+ remoteproc-api
Mailing List
------------
diff --git a/Documentation/driver-api/remoteproc/remoteproc-api.rst b/Documentation/driver-api/remoteproc/remoteproc-api.rst
new file mode 100644
index 000000000000..0306b331a20e
--- /dev/null
+++ b/Documentation/driver-api/remoteproc/remoteproc-api.rst
@@ -0,0 +1,77 @@
+==================================
+The Linux Remoteproc userspace API
+==================================
+
+Introduction
+============
+
+A Remoteproc (rproc) is a subsystem for managing the lifecycle
+of a processor that is connected to Linux.
+
+At times, userspace may need to check the state of the remote processor to
+prevent other processes from using it. For instance, if the remote processor
+is a DSP used for playback, there may be situations where the DSP is
+undergoing recovery and cannot be used. In such cases, attempts to access the
+DSP for playback should be blocked. The rproc framework provides sysfs APIs
+to inform userspace of the processor's current status which should be utilised
+to achieve the same.
+
+Additionally, there are scenarios where userspace applications need to explicitly
+control the rproc. In these cases, rproc also offers the file descriptors.
+
+The simplest API
+================
+
+Below set of api's can be used to start and stop the rproc
+where 'X' refers to instance of associated remoteproc. There can be systems
+where there are more than one rprocs such as multiple DSP's
+connected to application processors running Linux.
+
+.. code-block:: c
+
+ echo start > /sys/class/remoteproc/remoteprocX/state
+ echo stop > /sys/class/remoteproc/remoteprocX/state
+
+To know the state of rproc:
+
+.. code-block:: c
+
+ cat /sys/class/remoteproc/remoteprocX/state
+
+
+To dynamically replace firmware, execute the following commands:
+
+.. code-block:: c
+
+ echo stop > /sys/class/remoteproc/remoteprocX/state
+ echo -n <firmware_name> >
+ /sys/class/remoteproc/remoteprocX/firmware
+ echo start > /sys/class/remoteproc/remoteprocX/state
+
+To simulate a remote crash, execute:
+
+.. code-block:: c
+
+ echo 1 > /sys/kernel/debug/remoteproc/remoteprocX/crash
+
+To get the trace logs, execute
+
+.. code-block:: c
+
+ cat /sys/kernel/debug/remoteproc/remoteprocX/crashX
+
+where X will be 0 or 1 if there are 2 resources. Also, this
+file will only exist if resources are defined in ELF firmware
+file.
+
+The coredump feature can be disabled with the following command:
+
+.. code-block:: c
+
+ echo disabled > /sys/kernel/debug/remoteproc/remoteprocX/coredump
+
+Userspace can also control start/stop of rproc by using a
+remoteproc Character Device, it can open the open a file descriptor
+and write `start` to initiate it, and `stop` to terminate it.
+
+[FIXME -- better explanations]
--
2.39.3 (Apple Git-146)
next prev parent reply other threads:[~2024-10-23 5:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 5:33 [PATCH 0/1] remoteproc documentation changes anish kumar
2024-10-23 5:33 ` [PATCH V4 1/7] Remoteproc: Documentation: add the main index anish kumar
2024-10-24 15:42 ` Mathieu Poirier
2024-10-24 17:51 ` anish kumar
2024-10-23 5:33 ` [PATCH V4 2/7] Documentation: remoteproc: move from staging anish kumar
2024-10-23 5:33 ` [PATCH V4 3/7] Documentation: remoteproc: add more information anish kumar
2024-10-24 15:53 ` Mathieu Poirier
2024-10-24 18:17 ` anish kumar
2024-10-25 14:57 ` Mathieu Poirier
2024-10-25 15:13 ` anish kumar
2024-10-25 15:18 ` Mathieu Poirier
2024-10-23 5:33 ` [PATCH V4 4/7] Remoteproc: Documentation: add driver api anish kumar
2024-10-23 5:33 ` anish kumar [this message]
2024-10-23 5:33 ` [PATCH V4 6/7] MAINTAINERS: remoteproc documentation path update anish kumar
2024-10-23 5:33 ` [PATCH V4 7/7] rpmsg: Documentation: update the path anish kumar
2024-10-23 13:53 ` [PATCH 0/1] remoteproc documentation changes Jonathan Corbet
2024-10-23 14:43 ` Jonathan Corbet
2024-10-23 15:35 ` Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241023053357.5261-6-yesanishhere@gmail.com \
--to=yesanishhere@gmail.com \
--cc=bjorn.andersson@linaro.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).