summaryrefslogtreecommitdiff
path: root/include/linux/remoteproc.h
AgeCommit message (Collapse)Author
2021-10-15remoteproc: Remove vdev_to_rvdev and vdev_to_rproc from remoteproc APIArnaud Pouliquen
These both functions are only used by the remoteproc_virtio. There is no reason to expose them in the API. Move the functions in remoteproc_virtio.c Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211001101234.4247-4-arnaud.pouliquen@foss.st.com
2021-07-28remoteproc: fix kernel doc for struct rproc_opsDong Aisheng
The load_rsc_table was removed since the commit c1d35c1ab424 ("remoteproc: Rename "load_rsc_table" to "parse_fw"") but got added back again by mistake in the below commit: commit b1a17513a2d6 ("remoteproc: add vendor resources handling"). The patch fixed a small code indent issue which not worth a separate patch. Fixes: b1a17513a2d6 ("remoteproc: add vendor resources handling") Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Link: https://lore.kernel.org/r/20210706142156.952794-2-aisheng.dong@nxp.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-05-27remoteproc: Fix various kernel-doc warningsSuman Anna
Fix all the kernel-doc warnings in various remoteproc core files. Some of them just needed a formatting cleanup change, while others needed the Return statement to be added, or documenting the missed structure elements. Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Suman Anna <s-anna@ti.com> Link: https://lore.kernel.org/r/20210519180304.23563-3-s-anna@ti.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Properly deal with the resource table when detachingMathieu Poirier
If it is possible to detach the remote processor, keep an untouched copy of the resource table. That way we can start from the same resource table without having to worry about original values or what elements the startup code has changed when re-attaching to the remote processor. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-12-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Introduce function rproc_detach()Mathieu Poirier
Introduce function rproc_detach() to enable the remoteproc core to release the resources associated with a remote processor without stopping its operation. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-11-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Add new detach() remoteproc operationMathieu Poirier
Add an new detach() operation in order to support scenarios where the remoteproc core is going away but the remote processor is kept operating. This could be the case when the system is rebooted or when the platform driver is removed. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-9-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Add new get_loaded_rsc_table() to rproc_opsMathieu Poirier
Add a new get_loaded_rsc_table() operation in order to support scenarios where the remoteproc core has booted a remote processor and detaches from it. When re-attaching to the remote processor, the core needs to know where the resource table has been placed in memory. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-6-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Properly represent the attached stateMathieu Poirier
There is a need to know when a remote processor has been attached to rather than booted by the remoteproc core. In order to avoid manipulating two variables, i.e rproc::autonomous and rproc::state, get rid of the former and simply use the newly introduced RPROC_ATTACHED state. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-5-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-18remoteproc: Add new RPROC_ATTACHED stateMathieu Poirier
Add a new RPROC_ATTACHED state to take into account scenarios where the remoteproc core needs to attach to a remote processor that is booted by another entity. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-4-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-11remoteproc: add is_iomem to da_to_vaPeng Fan
Introduce an extra parameter is_iomem to da_to_va, then the caller could take the memory as normal memory or io mapped memory. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/1615029865-23312-5-git-send-email-peng.fan@oss.nxp.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-03-11remoteproc: introduce is_iomem to rproc_mem_entryPeng Fan
Introduce is_iomem to indicate this piece memory is iomem or not. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/1615029865-23312-4-git-send-email-peng.fan@oss.nxp.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-12-10remoteproc: coredump: Add minidump functionalitySiddharth Gupta
This change adds a new kind of core dump mechanism which instead of dumping entire program segments of the firmware, dumps sections of the remoteproc memory which are sufficient to allow debugging the firmware. This function thus uses section headers instead of program headers during creation of the core dump elf. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Co-developed-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Link: https://lore.kernel.org/r/1605819935-10726-3-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-12-10remoteproc: core: Add ops to enable custom coredump functionalitySiddharth Gupta
Each remoteproc might have different requirements for coredumps and might want to choose the type of dumps it wants to collect. This change allows remoteproc drivers to specify their own custom dump function to be executed in place of rproc_coredump. If the coredump op is not specified by the remoteproc driver it will be set to rproc_coredump by default. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Link: https://lore.kernel.org/r/1605819935-10726-2-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-11-25remoteproc: Add a rproc_set_firmware() APISuman Anna
A new API, rproc_set_firmware() is added to allow the remoteproc platform drivers and remoteproc client drivers to be able to configure a custom firmware name that is different from the default name used during remoteproc registration. This function is being introduced to provide a kernel-level equivalent of the current sysfs interface to remoteproc client drivers, and can only change firmwares when the remoteproc is offline. This allows some remoteproc drivers to choose different firmwares at runtime based on the functionality the remote processor is providing. The TI PRU Ethernet driver will be an example of such usage as it requires to use different firmwares for different supported protocols. Also, update the firmware_store() function used by the sysfs interface to reuse this function to avoid code duplication. Reviewed-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Signed-off-by: Suman Anna <s-anna@ti.com> Link: https://lore.kernel.org/r/20201121032042.6195-1-s-anna@ti.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-10-13remoteproc: Change default dump configuration to "disabled"Rishabh Bhatnagar
Currently "default" configuration option means coredumps are enabled. To avoid confusion rename the "default" configuration option to "enabled" and disable collection of dumps by default as doing so makes sense for production devices. Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Link: https://lore.kernel.org/r/1601662144-5964-2-git-send-email-rishabhb@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-08-04remoteproc: Add remoteproc character device interfaceSiddharth Gupta
Add the character device interface into remoteproc framework. This interface can be used in order to boot/shutdown remote subsystems and provides a basic ioctl based interface to implement supplementary functionality. An ioctl call is implemented to enable the shutdown on release feature which will allow remote processors to be shutdown when the controlling userspace application crashes or hangs. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Link: https://lore.kernel.org/r/1596044401-22083-2-git-send-email-sidgup@codeaurora.org [bjorn: s/int32_t/s32/ per checkpatch] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-21remoteproc: Add inline coredump functionalityRishabh Bhatnagar
The current coredump implementation uses vmalloc area to copy all the segments. But this might put strain on low memory targets as the firmware size sometimes is in tens of MBs. The situation becomes worse if there are multiple remote processors undergoing recovery at the same time. This patch adds inline coredump functionality that avoids extra memory usage. This requires recovery to be halted until data is read by userspace and free function is called. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Sibi Sankar <sibis@codeaurora.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Tested-by: Sibi Sankar <sibis@codeaurora.org> Link: https://lore.kernel.org/r/1594938035-7327-5-git-send-email-rishabhb@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-21remoteproc: Pass size and offset as arguments to segment dump functionRishabh Bhatnagar
Change the segment dump API signature to include size and offset arguments. Refactor the qcom_q6v5_mss driver to use these arguments while copying the segment. Doing this lays the ground work for "inline" coredump functionality being added in the next patch. Tested-by: Sibi Sankar <sibis@codeaurora.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Sibi Sankar <sibis@codeaurora.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org> Link: https://lore.kernel.org/r/1594938035-7327-4-git-send-email-rishabhb@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-17remoteproc: Make function rproc_resource_cleanup() publicMathieu Poirier
Make function rproc_resource_cleanup() public so that it can be used by platform drivers when allocating resources to be used by a detached remote processor. Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200714200445.1427257-8-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-16remoteproc: Properly handle firmware name when attachingMathieu Poirier
This patch prevents the firmware image name from being displayed when the remoteproc core is attaching to a remote processor. This is needed needed since there is no guarantee about the nature of the firmware image that is loaded by the external entity. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20200714195035.1426873-10-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-16remoteproc: Add new attach() remoteproc operationMathieu Poirier
Add an new attach() operation in order to properly deal with scenarios where the remoteproc core needs to attach to a remote processor that has been booted by another entity. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20200714195035.1426873-3-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-07-16remoteproc: Add new RPROC_DETACHED stateMathieu Poirier
Add a new RPROC_DETACHED state to take into account scenarios where the remoteproc core needs to attach to a remote processor that is booted by another entity. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Tested-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20200714195035.1426873-2-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-05-12remoteproc: Replace zero-length array with flexible-arrayGustavo A. R. Silva
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] sizeof(flexible-array-member) triggers a warning because flexible array members have incomplete type[1]. There are some instances of code in which the sizeof operator is being incorrectly/erroneously applied to zero-length arrays and the result is zero. Such instances may be hiding some bugs. So, this work (flexible-array member conversions) will also help to get completely rid of those sorts of issues. This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200507191943.GA16033@embeddedor Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-22remoteproc: Add prepare and unprepare opsLoic Pallardy
On some SoC architecture, it is needed to enable HW like clock, bus, regulator, memory region... before loading co-processor firmware. This patch introduces prepare and unprepare ops to execute platform specific function before firmware loading and after stop execution. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Suman Anna <s-anna@ti.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200417002036.24359-2-s-anna@ti.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-20remoteproc: Add device-managed variants of rproc_alloc/rproc_addPaul Cercueil
Add API functions devm_rproc_alloc() and devm_rproc_add(), which behave like rproc_alloc() and rproc_add() respectively, but register their respective cleanup function to be called on driver detach. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200417170040.174319-2-paul@crapouillou.net Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-20remoteproc: Use kstrdup_const() rather than kstrdup()Mathieu Poirier
For cases where @firmware is declared "const char *", use function kstrdup_const() to avoid needlessly creating another copy on the heap. Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20200420231601.16781-2-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-04-19remoteproc: add rproc_coredump_set_elf_infoClement Leger
This function allows drivers to correctly setup the coredump output elf information. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Clement Leger <cleger@kalray.eu> Link: https://lore.kernel.org/r/20200410102433.2672-2-cleger@kalray.eu Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25remoteproc: Introduce "panic" callback in opsBjorn Andersson
Introduce generic support for handling kernel panics in remoteproc drivers, in order to allow operations needed for aiding in post mortem system debugging, such as flushing caches etc. The function can return a number of milliseconds needed by the remote to "settle" and the core will wait the longest returned duration before returning from the panic handler. Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200324052904.738594-3-bjorn.andersson@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25remoteproc: Adapt coredump to generate correct elf typeClement Leger
Now that remoteproc can load an elf64, coredump elf class should be the same as the loaded elf class. In order to do that, add a elf_class field to rproc with default values. If an elf is loaded successfully, this field will be updated with the loaded elf class. Then, the coredump core code has been modified to use the generic elf macro in order to create an elf file with correct class. Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Clement Leger <cleger@kalray.eu> Link: https://lore.kernel.org/r/20200302093902.27849-9-cleger@kalray.eu Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25remoteproc: Use u64 type for boot_addrClement Leger
elf64 entry is defined as a u64. Since boot_addr is used to store the elf entry point, change boot_addr type to u64 to support both elf32 and elf64. In the same time, fix users that were using this variable. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Clement Leger <cleger@kalray.eu> Link: https://lore.kernel.org/r/20200302093902.27849-4-cleger@kalray.eu [bjorn: Fixes up return type of rproc_get_boot_addr()] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25remoteproc: Use size_t instead of int for rproc_mem_entry lenClement Leger
Now that rproc_da_to_va uses a size_t for length, use a size_t for len field of rproc_mem_entry. Function used to create such structures now takes a size_t instead of int to allow full size range to be handled. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Clement Leger <cleger@kalray.eu> Link: https://lore.kernel.org/r/20200302093902.27849-3-cleger@kalray.eu Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25remoteproc: Use size_t type for len in da_to_vaClement Leger
With upcoming changes in elf loader for elf64 support, section size will be a u64. When used with da_to_va, this will potentially lead to overflow if using the current "int" type for len argument. Change da_to_va prototype to use a size_t for len and fix all users of this function. Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Clement Leger <cleger@kalray.eu> Link: https://lore.kernel.org/r/20200302093902.27849-2-cleger@kalray.eu Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-06-29remoteproc: add vendor resources handlingClement Leger
In order to allow rproc backend to handle vendor resources such as in OpenAMP, add a handle_rsc hook. This hook allow the rproc backends to handle vendor resources as they like. The hook will be called only for vendor resources and should return RSC_HANDLED on successful resource handling, RSC_IGNORED if resource was ignored, or a negative value on error. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-02-20remoteproc: fix recovery procedureLoic Pallardy
Commit 7e83cab824a87e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()") replaces rproc_{shutdown,boot}() with rproc_{stop,start}(), which skips destroy the virtio device at stop but re-initializes it again at start. Issue is that struct virtio_dev is not correctly reinitialized like done at initial allocation thanks to kzalloc() and kobject is considered as already initialized by kernel. That is due to the fact struct virtio_dev is allocated and released at vdev resource handling level managed and virtio device is registered and unregistered at rproc subdevices level. Moreover kernel documentation mentions that device struct must be zero initialized before calling device_initialize(). This patch disentangles struct virtio_dev from struct rproc_vdev as the two struct don't have the same life-cycle. struct virtio_dev is now allocated on rproc_start() and released on rproc_stop(). This patch applies on top of patch remoteproc: create vdev subdevice with specific dma memory pool [1] [1]: https://patchwork.kernel.org/patch/10755781/ Fixes: 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()") Reported-by: Xiang Xiao <xiaoxiang781216@gmail.com> Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-02-20remoteproc: create vdev subdevice with specific dma memory poolLoic Pallardy
This patch creates a dedicated vdev subdevice for each vdev declared in firmware resource table and associates carveout named "vdev%dbuffer" (with %d vdev index in resource table) if any as dma coherent memory pool. Then vdev subdevice is used as parent for virtio device. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-01-06remoteproc: fix kernel-doc comment for parse_fwFabien Dessenne
Fix the kernel-doc comment for "parse_fw" and fix a typo. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-19remoteproc: Add mechanism for custom dump function assignmentSibi Sankar
This patch adds a mechanism for assigning each rproc dump segment with a custom dump function and private data. The dump function is to be called for each rproc segment during coredump if assigned. Signed-off-by: Sibi Sankar <sibis@codeaurora.org> [bjorn: reordred arguments to rproc_coredump_add_custom_segment()] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-19remoteproc: Introduce custom dump function for each remoteproc segmentSibi Sankar
Introduce custom dump function and private data per remoteproc dump segment. The dump function is responsible for filling the device memory segment associated with coredump Signed-off-by: Sibi Sankar <sibis@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-14remoteproc: modify vring allocation to rely on centralized carveout allocatorLoic Pallardy
Current version of rproc_alloc_vring function supports only dynamic vring allocation. This patch allows to allocate vrings based on memory region declatation. Vrings are now manage like memory carveouts, to communize memory management code in rproc_alloc_registered_carveouts(). Allocated buffer is retrieved in rp_find_vq() thanks to rproc_find_carveout_by_name() functions for. This patch sets vrings names to vdev"x"vring"y" with x vdev index in resource table and y vring index in vdev. This will be updated when name will be associated to vdev in firmware resource table. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: add helper function to allocate rproc_mem_entry from reserved memoryLoic Pallardy
This patch introduces rproc_res_mem_entry_init() helper function to allocate a rproc_mem_entry structure from a reserved memory region. In that case, rproc_mem_entry structure has no alloc and release ops. It will be used to assigned the specified reserved memory to any rproc sub device. Relation between rproc_mem_entry and rproc sub device will be done by name. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: add alloc ops in rproc_mem_entry structLoic Pallardy
Memory entry could be allocated in different ways (ioremap, dma_alloc_coherent, internal RAM allocator...). This patch introduces an alloc ops in rproc_mem_entry structure to associate dedicated allocation mechanism to each memory entry descriptor in order to do remote core agnostic from memory allocators. The introduction of this ops allows to perform allocation of all registered carveout at the same time, just before calling rproc_start(). It simplifies and makes uniform carveout management whatever origin. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: introduce rproc_add_carveout functionLoic Pallardy
This patch introduces a new API to allow platform driver to register platform specific carveout regions. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: add helper function to allocate and init rproc_mem_entry structLoic Pallardy
This patch introduces rproc_mem_entry_init helper function to simplify rproc_mem_entry structure allocation and filling by client. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: add name in rproc_mem_entry structLoic Pallardy
Add name field in struct rproc_mem_entry. This new field will be used to match memory area requested in resource table with pre-registered carveout. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-09remoteproc: add release ops in rproc_mem_entry structLoic Pallardy
Memory entry could be allocated in different ways (ioremap, dma_alloc_coherent, internal RAM allocator...). This patch introduces a release ops in rproc_mem_entry structure to associate dedicated release mechanism to each memory entry descriptor in order to keep remoteproc core generic. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-10-05remoteproc: Add missing kernel-doc comment for auto-bootSuman Anna
The commit ddf711872c9d ("remoteproc: Introduce auto-boot flag") introduced the auto-boot flag but missed adding the corresponding kernel-doc comment. Add the same. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-26remoteproc: Introduce prepare and unprepare for subdevicesBjorn Andersson
On rare occasions a subdevice might need to prepare some hardware resources before a remote processor is booted, and clean up some state after it has been shut down. One such example is the IP Accelerator found in various Qualcomm platforms, which is accessed directly from both the modem remoteproc and the application subsystem and requires an intricate lockstep process when bringing the modem up and down. Tested-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> [elder@linaro.org: minor description and comment edits] Signed-off-by Alex Elder <elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-26remoteproc: Make client initialize ops in rproc_subdevBjorn Andersson
In preparation of adding the additional prepare and unprepare operations make the client responsible for filling out the function pointers of the rproc_subdev. This makes the arguments to rproc_add_subdev() more manageable, in particular when some of the functions are left out. Tested-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> [elder@linaro.org: added comment about assigning function pointers] Signed-off-by Alex Elder <elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-26remoteproc: Rename subdev functions to start/stopBjorn Andersson
"start" and "stop" are more suitable names for how these two operations are used, and they fit better with the upcoming introduction of two additional operations in the struct. Tested-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> [elder@linaro.org: minor comment edits] Signed-off-by Alex Elder <elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-25remoteproc: fix crashed parameter logic on stop callArnaud Pouliquen
Fix rproc_add_subdev parameter name and inverse the crashed logic. Fixes: 880f5b388252 ("remoteproc: Pass type of shutdown to subdev remove") Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>