summaryrefslogtreecommitdiff
path: root/drivers/remoteproc
AgeCommit message (Collapse)Author
2025-06-02Merge tag 'rproc-v6.16' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux Pull remoteproc updates from Bjorn Andersson: - Fix resource cleanup in the remoteproc attach error handling code paths - Refactor the various TI K3 drivers to extract and reuse common code between them - Add support in the i.MX remoteproc driver for determining from the firmware if Linux should wait on a "firmware ready" signal at startup - Improve the Xilinx R5F power down mechanism to handle use cases where this is shared with other entities in the system * tag 'rproc-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: (46 commits) remoteproc: k3: Refactor release_tsp() functions into common driver remoteproc: k3: Refactor reserved_mem_init() functions into common driver remoteproc: k3: Refactor mem_release() functions into common driver remoteproc: k3: Refactor of_get_memories() functions into common driver remoteproc: k3: Refactor .da_to_va rproc ops into common driver remoteproc: k3: Refactor .get_loaded_rsc_table ops into common driver remoteproc: k3: Refactor .detach rproc ops into common driver remoteproc: k3: Refactor .attach rproc ops into common driver remoteproc: k3: Refactor .stop rproc ops into common driver remoteproc: k3: Refactor .start rproc ops into common driver remoteproc: k3: Refactor .unprepare rproc ops into common driver remoteproc: k3: Refactor .prepare rproc ops into common driver remoteproc: k3-dsp: Assert local reset during .prepare callback remoteproc: k3-dsp: Don't override rproc ops in IPC-only mode remoteproc: k3: Refactor rproc_request_mbox() implementations into common driver remoteproc: k3-m4: Ping the mbox while acquiring the channel remoteproc: k3: Refactor rproc_release() implementation into common driver remoteproc: k3-m4: Introduce central function to release rproc from reset remoteproc: k3-dsp: Correct Reset deassert logic for devices w/o lresets remoteproc: k3: Refactor rproc_reset() implementation into common driver ...
2025-05-20remoteproc: k3: Refactor release_tsp() functions into common driverBeleswar Padhi
The release_tsp() implementations in the TI K3 R5, DSP and M4 remoteproc drivers release the TI-SCI processor control of a remote processor, which is auto triggered upon device removal. Refactor these functions into ti_k3_common.c driver as k3_release_tsp() and use this common function throughout in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-37-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor reserved_mem_init() functions into common driverBeleswar Padhi
The reserved_mem_init() implementations in the R5, DSP and M4 remoteproc drivers initialize the reserved memory regions associated with the remote processor. Refactor these functions into the ti_k3_common.c driver as k3_reserved_mem_init() and use this common function throughout in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-36-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor mem_release() functions into common driverBeleswar Padhi
The mem_release() implementations in the TI K3 R5, DSP and M4 remoteproc drivers release the reserved memory of the device, which get auto triggered upon device removal. Refactor these functions into ti_k3_common.c driver as k3_mem_release() and use this common function in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-35-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor of_get_memories() functions into common driverBeleswar Padhi
The of_get_memories() implementations in the TI K3 R5, DSP and M4 remoteproc drivers initialize and assign memory regions used by the remote processor in the same way. Refactor these implementations into ti_k3_common.c driver as k3_rproc_of_get_memories() use this common function for mem initialization in R5, DSP and M4 drivers. Note: The TCM addresses for R5 core are configurable based on the 'loczrama' setting. Therefore, override the bus_addr assignment done by the common function for TCMs of R5 remote processors by reading the 'loczrama' DT property in k3_r5_core_of_get_internal_memories(). Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-34-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .da_to_va rproc ops into common driverBeleswar Padhi
The .da_to_va rproc ops implementations in TI K3 R5, DSP and M4 remoteproc drivers return the Kernel virtual address for a corresponding rproc device address. Refactor the implementations into the ti_k3_common.c driver as k3_rproc_da_to_va and use this common function for address translation of DDR and internal memory regions in R5, DSP and M4 drivers. Note: The R5 SRAM memory translations are still handled in the .da_to_va ops of the R5 remoteproc driver. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-33-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .get_loaded_rsc_table ops into common driverBeleswar Padhi
The .get_loaded_rsc_table rproc ops implementations in TI K3 R5, DSP and M4 remoteproc drivers return a pointer to the resource table that was pre-loaded at the base address of the DDR region reserved for firmware usage. Refactor the implementations into ti_k3_common.c driver as k3_get_loaded_rsc_table() and register this common function as .get_loaded_rsc_table ops in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-32-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .detach rproc ops into common driverBeleswar Padhi
The .detach rproc ops implementations in TI K3 R5, DSP and M4 remoteproc drivers are NOPs. Refactor the implementations into ti_k3_common.c driver as k3_rproc_detach() and register this common function as .detach ops in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-31-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .attach rproc ops into common driverBeleswar Padhi
The .attach rproc ops implementations in TI K3 R5, DSP and M4 drivers are NOPs. Refactor the implementations into ti_k3_common.c driver as k3_rproc_attach() and register this common function as .attach ops in R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-30-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .stop rproc ops into common driverBeleswar Padhi
The .stop rproc ops implementations in TI K3 DSP and M4 remoteproc drivers put the remote processor into reset. Refactor the implementations into ti_k3_common.c driver as k3_rproc_stop() and register this common function as .stop ops in DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-29-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .start rproc ops into common driverBeleswar Padhi
The k3_dsp_rproc_start() function sets the boot vector and releases the reset on the remote processor. Whereas, the k3_m4_rproc_start() function only needs to release the reset. Refactor the k3_m4_rproc_start() into ti_k3_common.c as k3_rproc_start() and align the DSP and M4 drivers to invoke this common function when releasing the reset on the remote processor. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-28-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .unprepare rproc ops into common driverBeleswar Padhi
The .unprepare rproc ops implementations in TI K3 DSP and M4 remoteproc drivers assert the module reset on the remote processor. Refactor the implementations into ti_k3_common.c driver as k3_rproc_unprepare() and register this common function as .unprepare ops in DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-27-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .prepare rproc ops into common driverBeleswar Padhi
The .prepare rproc ops implementations in TI K3 DSP and M4 remoteproc drivers deasserts the local and module reset of the processor to allow firmware loading into internal memory. Refactor the implementations into the ti_k3_common.c driver as k3_rproc_prepare() and register this common function as .prepare ops in the DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-26-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-dsp: Assert local reset during .prepare callbackBeleswar Padhi
The ti_k3_dsp_remoteproc.c driver asserts the local reset in probe and releases the module reset in .prepare callback. This is done to ensure the core does not execute bogus code when module reset is deasserted. Put both of these operations together in .prepare callback, which is more suitable as it ensures local reset is asserted for subsequent core start operations from sysfs. This is done to align the .prepare callback of DSP with the M4 driver which can be factored out at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-25-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-dsp: Don't override rproc ops in IPC-only modeBeleswar Padhi
Currently, the driver overrides the rproc ops when booting in IPC-only mode. Remove these overrides and register the ops unconditionally. This requires to have IPC-only mode checks in the .prepare and .unprepare ops and returning early. The other rproc ops are invoked when booting either in IPC-only mode or in remoteproc mode but not both. This is done to align the rproc ops implementations of DSP driver with M4 driver and can be factored out at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-24-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor rproc_request_mbox() implementations into common driverBeleswar Padhi
The rproc_request_mbox() implementations in TI K3 R5, DSP and M4 remoteproc drivers acquire the mailbox channel and send the same message through the acquired channel. Refactor the above function into the ti_k3_common.c driver as k3_rproc_request_mbox() and use it throughout R5, DSP and M4 drivers. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-23-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Ping the mbox while acquiring the channelBeleswar Padhi
The TI K3 M4 remoteproc driver acquires the mailbox channel in probe but sends a message through the acquired channel later in .attach()/.start() callbacks. Put both the things together in the form of 'k3_m4_rproc_request_mbox()' function and invoke that in the probe routine. This is done to align the rproc_request_mbox() implementation with R5 and DSP drivers which can be factored out at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-22-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor rproc_release() implementation into common driverBeleswar Padhi
The rproc_release() implementations in TI K3 DSP and M4 remoteproc drivers deassert reset in the same way. Refactor the above function into the ti_k3_common.c driver as k3_rproc_release() and use it throughout DSP and M4 drivers for releasing the reset from the remote processor. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-21-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Introduce central function to release rproc from resetBeleswar Padhi
Currently, the TI K3 M4 remoteproc driver assumes all of the M4 devices have local resets. Even though its true for all existing M4 devices, keep room for future devices which possibly may not have local resets and only have a module reset. Therefore introduce a central function, k3_m4_rproc_release() which handles both type of devices (with and without local resets), and use it throughout the driver to release the remote processor from reset. Also, for devices with local reset, Assert the module reset back in case the local reset deassert operation failed. This is done to align the reset release implementation with DSP remoteproc driver and can be factored out later. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-20-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-dsp: Correct Reset deassert logic for devices w/o lresetsBeleswar Padhi
The k3_dsp_rproc_release() function erroneously deasserts the local reset even for devices which do not support it. Even though it results in a no-operation, Update the logic to explicitly deassert only the global reset for devices that do not have a local reset. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-19-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor rproc_reset() implementation into common driverBeleswar Padhi
The rproc_reset() implementations in TI K3 DSP and M4 remoteproc drivers assert reset in the same way. Refactor the above function into the ti_k3_common.c driver as k3_rproc_reset() and use it throughout DSP and M4 drivers for resetting the remote processor. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-18-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Introduce central function to put rproc into resetBeleswar Padhi
Currently, the TI K3 M4 remoteproc driver assumes all of the M4 devices have local resets. Even though its true for all existing M4 devices, keep room for future devices which possibly may not have local resets and only have a module reset. Therefore introduce a central function, k3_m4_rproc_reset() which handles both type of devices (with and without local resets), and use it throughout the driver to put the remote processor into reset. This is done to align the reset implementation with DSP remoteproc driver and can be factored out later. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-17-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-dsp: Correct Reset logic for devices without lresetsBeleswar Padhi
The k3_dsp_rproc_reset() function erroneously asserts the local reset even for devices which do not support it. Even though it results in a no-operation, Update the logic to explicitly assert the local reset for devices that support it and only the global reset for those that do not. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-16-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor .kick rproc ops into common driverBeleswar Padhi
The .kick rproc ops implementations in TI K3 R5, DSP and M4 remoteproc drivers sends a mailbox message to the remote processor in the same way. Refactor the implementations into a common function 'k3_rproc_kick()' in the ti_k3_common.c driver. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Acked-by: Andrew Davis <afd@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-15-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor mailbox rx_callback functions into common driverBeleswar Padhi
The mailbox .rx_callback implementations in TI K3 R5, DSP and M4 remoteproc drivers handle inbound mailbox messages in the same way. Introduce a common driver 'ti_k3_common.c' and refactor the implementations into a common function 'k3_rproc_mbox_callback'() in it. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-14-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3: Refactor shared data structuresBeleswar Padhi
The TI K3 R5, DSP and M4 remoteproc drivers share the same data structure definitions. Refactor the shared data structures into a new common header file, 'ti_k3_common.h', and update the drivers to use the unified data structures. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-13-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Use k3_rproc_mem_data structure for memory infoBeleswar Padhi
The ti_k3_m4_remoteproc.c driver previously hardcoded device memory region addresses and names. Change this to use the k3_rproc_mem_data structure to store memory information. This aligns with DSP and R5 drivers, and can be refactored out later. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-12-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Add pointer to rproc struct within k3_m4_rprocBeleswar Padhi
Add a pointer to the rproc struct within k3_m4_rproc internal struct. This is done to align the M4 internal rproc data structure with R5 driver which can be factored out at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-11-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-{m4/dsp}: Add a void ptr member in rproc internal structBeleswar Padhi
Introduce a void pointer in the k3_{m4/dsp}_rproc internal data structure which can be used to point to any private data needed by the driver. Currently, the M4/DSP drivers do not have any private data, so the pointer can be left pointing to NULL. This is done to align the data structures with R5 driver which can be factored out at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-10-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Use k3_r5_rproc_mem_data structure for memory infoBeleswar Padhi
The ti_k3_r5_remoteproc.c driver previously hardcoded device memory region addresses and names. Change this to use the k3_r5_rproc_mem_data structure to store memory information. This aligns with K3 DSP and M4 drivers, and can be refactored out later. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Tested-by: Judith Mendez <jm@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-9-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Refactor Data Structures to Align with DSP and M4Beleswar Padhi
Currently, struct members such as mem, num_mems, reset, tsp, ti_sci and ti_sci_id are part of the k3_r5_core structure. To align the rproc->priv data structure of the R5 remote processor with that of the DSP and M4, move the above members from k3_r5_core to k3_r5_rproc struct. Additionally, introduce a void *priv pointer in k3_r5_rproc that can be typecasted to point to the k3_r5_core structure. This abstraction is done to ensure common functionalities across R5, DSP and M4 drivers can be refactored at a later stage. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-8-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Re-order k3_r5_release_tsp() functionBeleswar Padhi
The TI-SCI processor control handle, 'tsp', will be refactored from k3_r5_core struct into k3_r5_rproc struct in a future commit. So, the 'tsp' pointer will be initialized inside k3_r5_cluster_rproc_init() now. Move the k3_r5_release_tsp() function, which releases the tsp handle, above k3_r5_cluster_rproc_init(), so that the later can register the former as a devm action. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-7-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Re-order internal memory initialization functionsBeleswar Padhi
The internal memory struct pointer, 'mem', will be refactored from k3_r5_core struct into k3_r5_rproc struct in a future commit. Therefore, move the internal memory initialization function, k3_r5_core_of_get_internal_memories() above k3_r5_cluster_rproc_init() so that the former can be invoked by the later. While at it, also re-order the k3_r5_core_of_get_sram_memories() to keep all the internal memory initialization functions at one place. Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-6-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-m4: Don't assert reset in detach routineBeleswar Padhi
The rproc_detach() function invokes __rproc_detach() before rproc_unprepare_device(). The __rproc_detach() function sets the rproc->state to "RPROC_DETACHED". However, the TI K3 M4 driver erroneously looks for "RPROC_ATTACHED" state in its .unprepare ops to identify IPC-only mode; which leads to resetting the rproc in detach routine. Therefore, correct the IPC-only mode detection logic to look for "RPROC_DETACHED" in k3_m4_rproc_unprepare() function. Fixes: ebcf9008a895 ("remoteproc: k3-m4: Add a remoteproc driver for M4F subsystem") Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Reviewed-by: Hari Nagalla <hnagalla@ti.com> Reviewed-by: Martyn Welch <martyn.welch@collabora.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250513054510.3439842-5-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Refactor sequential core power up/down operationsBeleswar Padhi
The existing implementation of the waiting mechanism in "k3_r5_cluster_rproc_init()" waits for the "released_from_reset" flag to be set as part of the firmware boot process in "k3_r5_rproc_start()". The "k3_r5_cluster_rproc_init()" function is invoked in the probe routine which causes unexpected failures in cases where the firmware is unavailable at boot time, resulting in probe failure and removal of the remoteproc handles in the sysfs paths. To address this, the waiting mechanism is refactored out of the probe routine into the appropriate "k3_r5_rproc_{prepare/unprepare}()" functions. This allows the probe routine to complete without depending on firmware booting, while still maintaining the required power-synchronization between cores. Further, this wait mechanism is dropped from "k3_r5_rproc_{start/stop}()" functions as they deal with Core Run/Halt operations, and as such, there is no constraint in Running or Halting the cores of a cluster in order. Fixes: 61f6f68447ab ("remoteproc: k3-r5: Wait for core0 power-up before powering up core1") Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-4-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-dsp: Drop check performed in k3_dsp_rproc_{mbox_callback/kick}Siddharth Vadapalli
Commit ea1d6fb5b571 ("remoteproc: k3-dsp: Acquire mailbox handle during probe routine") introduced a check in the "k3_dsp_rproc_mbox_callback()" and "k3_dsp_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()". The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_dsp_rproc_kick()" and "k3_dsp_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks. Fixes: ea1d6fb5b571 ("remoteproc: k3-dsp: Acquire mailbox handle during probe routine") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-3-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-20remoteproc: k3-r5: Drop check performed in k3_r5_rproc_{mbox_callback/kick}Siddharth Vadapalli
Commit f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()". The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks. Fixes: f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Signed-off-by: Beleswar Padhi <b-padhi@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-2-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-15Revert "remoteproc: core: Clear table_sz when rproc_shutdown"Bjorn Andersson
Clearing the table_sz on cleanup seemed reasonable, but further discussions concluded that this merely working around the issue and that the fix is incomplete. As such, revert commit efdde3d73ab2 ("remoteproc: core: Clear table_sz when rproc_shutdown") to avoid carrying a partial fix. Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20250513-revert-rproc-table-sz-v1-1-a8c6b5d6f8a7@kernel.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-13remoteproc: qcom_wcnss: Fix on platforms without fallback regulatorsMatti Lehtimäki
Recent change to handle platforms with only single power domain broke pronto-v3 which requires power domains and doesn't have fallback voltage regulators in case power domains are missing. Add a check to verify the number of fallback voltage regulators before using the code which handles single power domain situation. Fixes: 65991ea8a6d1 ("remoteproc: qcom_wcnss: Handle platforms with only single power domain") Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sdm632-fairphone-fp3 Link: https://lore.kernel.org/r/20250511234026.94735-1-matti.lehtimaki@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-05-13remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probeDan Carpenter
The device_del() call matches with the device_add() but we also need to call put_device() to trigger the qcom_iris_release(). Fixes: 1fcef985c8bd ("remoteproc: qcom: wcnss: Fix race with iris probe") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/4604f7e0-3217-4095-b28a-3ff8b5afad3a@stanley.mountain Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-05-12remoteproc: xlnx: Avoid RPU force power downTanmay Shah
Powering off RPU using force_pwrdwn call results in system failure if there are multiple users of that RPU node. Better mechanism is to use request_node and release_node EEMI calls. With use of these EEMI calls, platform management controller will take-care of powering off RPU when there is no user. Signed-off-by: Tanmay Shah <tanmay.shah@amd.com> Link: https://lore.kernel.org/r/20250506165944.1109534-1-tanmay.shah@amd.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-06remoteproc: core: Release rproc->clean_table after rproc_attach() failsXiaolei Wang
When rproc->state = RPROC_DETACHED is attached to remote processor through rproc_attach(), if rproc_handle_resources() returns failure, then the clean table should be released, otherwise the following memory leak will occur. unreferenced object 0xffff000086a99800 (size 1024): comm "kworker/u12:3", pid 59, jiffies 4294893670 (age 121.140s) hex dump (first 32 bytes): 00 00 00 00 00 80 00 00 00 00 00 00 00 00 10 00 ............ 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 ............ backtrace: [<000000008bbe4ca8>] slab_post_alloc_hook+0x98/0x3fc [<000000003b8a272b>] __kmem_cache_alloc_node+0x13c/0x230 [<000000007a507c51>] __kmalloc_node_track_caller+0x5c/0x260 [<0000000037818dae>] kmemdup+0x34/0x60 [<00000000610f7f57>] rproc_boot+0x35c/0x56c [<0000000065f8871a>] rproc_add+0x124/0x17c [<00000000497416ee>] imx_rproc_probe+0x4ec/0x5d4 [<000000003bcaa37d>] platform_probe+0x68/0xd8 [<00000000771577f9>] really_probe+0x110/0x27c [<00000000531fea59>] __driver_probe_device+0x78/0x12c [<0000000080036a04>] driver_probe_device+0x3c/0x118 [<000000007e0bddcb>] __device_attach_driver+0xb8/0xf8 [<000000000cf1fa33>] bus_for_each_drv+0x84/0xe4 [<000000001a53b53e>] __device_attach+0xfc/0x18c [<00000000d1a2a32c>] device_initial_probe+0x14/0x20 [<00000000d8f8b7ae>] bus_probe_device+0xb0/0xb4 unreferenced object 0xffff0000864c9690 (size 16): Fixes: 9dc9507f1880 ("remoteproc: Properly deal with the resource table when detaching") Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250430092043.1819308-3-xiaolei.wang@windriver.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-05-06remoteproc: core: Cleanup acquired resources when rproc_handle_resources() ↵Xiaolei Wang
fails in rproc_attach() When rproc->state = RPROC_DETACHED and rproc_attach() is used to attach to the remote processor, if rproc_handle_resources() returns a failure, the resources allocated by imx_rproc_prepare() should be released, otherwise the following memory leak will occur. Since almost the same thing is done in imx_rproc_prepare() and rproc_resource_cleanup(), Function rproc_resource_cleanup() is able to deal with empty lists so it is better to fix the "goto" statements in rproc_attach(). replace the "unprepare_device" goto statement with "clean_up_resources" and get rid of the "unprepare_device" label. unreferenced object 0xffff0000861c5d00 (size 128): comm "kworker/u12:3", pid 59, jiffies 4294893509 (age 149.220s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 02 88 00 00 00 00 00 00 10 00 00 00 00 00 ............ backtrace: [<00000000f949fe18>] slab_post_alloc_hook+0x98/0x37c [<00000000adbfb3e7>] __kmem_cache_alloc_node+0x138/0x2e0 [<00000000521c0345>] kmalloc_trace+0x40/0x158 [<000000004e330a49>] rproc_mem_entry_init+0x60/0xf8 [<000000002815755e>] imx_rproc_prepare+0xe0/0x180 [<0000000003f61b4e>] rproc_boot+0x2ec/0x528 [<00000000e7e994ac>] rproc_add+0x124/0x17c [<0000000048594076>] imx_rproc_probe+0x4ec/0x5d4 [<00000000efc298a1>] platform_probe+0x68/0xd8 [<00000000110be6fe>] really_probe+0x110/0x27c [<00000000e245c0ae>] __driver_probe_device+0x78/0x12c [<00000000f61f6f5e>] driver_probe_device+0x3c/0x118 [<00000000a7874938>] __device_attach_driver+0xb8/0xf8 [<0000000065319e69>] bus_for_each_drv+0x84/0xe4 [<00000000db3eb243>] __device_attach+0xfc/0x18c [<0000000072e4e1a4>] device_initial_probe+0x14/0x20 Fixes: 10a3d4079eae ("remoteproc: imx_rproc: move memory parsing to rproc_ops") Suggested-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250430092043.1819308-2-xiaolei.wang@windriver.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-04-22remoteproc: imx_dsp_rproc: Add support for DSP-specific featuresIuliana Prodan
Some DSP firmware requires a FW_READY signal before proceeding, while others do not. Therefore, add support to handle i.MX DSP-specific features. Implement handle_rsc callback to handle resource table parsing and to process DSP-specific resource, to determine if waiting is needed. Update imx_dsp_rproc_start() to handle this condition accordingly. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Link: https://lore.kernel.org/r/20250416075613.2116792-1-iuliana.prodan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-04-07remoteproc: stm32_rproc: Allow to specify firmware default nameArnaud Pouliquen
Enhance the stm32_rproc driver to allow enabling the configuration of the firmware name based on the 'firmware-name' property in the device tree, offering flexibility compared to using the remote proc device node name. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20250327082721.641278-3-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2025-03-22remoteproc: qcom_q6v5_pas: Make single-PD handling more robustLuca Weiss
Only go into the if condition for single-PD handling when there's actually just one power domain specified there. Otherwise it'll be an issue in the dts and we should fail in the regular code path. This also mirrors the latest changes in the qcom_q6v5_mss driver. Suggested-by: Stephan Gerhold <stephan.gerhold@linaro.org> Fixes: 17ee2fb4e856 ("remoteproc: qcom: pas: Vote for active/proxy power domains") Signed-off-by: Luca Weiss <luca@lucaweiss.eu> Reviewed-by: Stephan Gerhold <stephan.gerhold@linaro.org> Link: https://lore.kernel.org/r/20250128-pas-singlepd-v1-2-85d9ae4b0093@lucaweiss.eu Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-03-22remoteproc: qcom_q6v5_pas: Use resource with CX PD for MSM8226Luca Weiss
MSM8226 requires the CX power domain, so use the msm8996_adsp_resource which has cx under proxy_pd_names and is otherwise equivalent. Suggested-by: Stephan Gerhold <stephan.gerhold@linaro.org> Fixes: fb4f07cc9399 ("remoteproc: qcom: pas: Add MSM8226 ADSP support") Signed-off-by: Luca Weiss <luca@lucaweiss.eu> Reviewed-by: Stephan Gerhold <stephan.gerhold@linaro.org> Link: https://lore.kernel.org/r/20250128-pas-singlepd-v1-1-85d9ae4b0093@lucaweiss.eu Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-03-22remoteproc: core: Clear table_sz when rproc_shutdownPeng Fan
There is case as below could trigger kernel dump: Use U-Boot to start remote processor(rproc) with resource table published to a fixed address by rproc. After Kernel boots up, stop the rproc, load a new firmware which doesn't have resource table ,and start rproc. When starting rproc with a firmware not have resource table, `memcpy(loaded_table, rproc->cached_table, rproc->table_sz)` will trigger dump, because rproc->cache_table is set to NULL during the last stop operation, but rproc->table_sz is still valid. This issue is found on i.MX8MP and i.MX9. Dump as below: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=000000010af63000 [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: CPU: 2 UID: 0 PID: 1060 Comm: sh Not tainted 6.14.0-rc7-next-20250317-dirty #38 Hardware name: NXP i.MX8MPlus EVK board (DT) pstate: a0000005 (NzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __pi_memcpy_generic+0x110/0x22c lr : rproc_start+0x88/0x1e0 Call trace: __pi_memcpy_generic+0x110/0x22c (P) rproc_boot+0x198/0x57c state_store+0x40/0x104 dev_attr_store+0x18/0x2c sysfs_kf_write+0x7c/0x94 kernfs_fop_write_iter+0x120/0x1cc vfs_write+0x240/0x378 ksys_write+0x70/0x108 __arm64_sys_write+0x1c/0x28 invoke_syscall+0x48/0x10c el0_svc_common.constprop.0+0xc0/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x30/0xcc el0t_64_sync_handler+0x10c/0x138 el0t_64_sync+0x198/0x19c Clear rproc->table_sz to address the issue. Fixes: 9dc9507f1880 ("remoteproc: Properly deal with the resource table when detaching") Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20250319100106.3622619-1-peng.fan@oss.nxp.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-03-22remoteproc: sysmon: Update qcom_add_sysmon_subdev() commentDan Carpenter
The comment says the qcom_add_sysmon_subdev() returns NULL on error but it actually returns error pointers. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/77a6b65b-5f3f-4a21-a837-7a4a7e09b099@stanley.mountain Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2025-03-21irqdomain: remoteproc: Switch to of_fwnode_handle()Jiri Slaby (SUSE)
of_node_to_fwnode() is irqdomain's reimplementation of the "officially" defined of_fwnode_handle(). The former is in the process of being removed, so use the latter instead. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Bjorn Andersson <andersson@kernel.org> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: linux-remoteproc@vger.kernel.org Link: https://lore.kernel.org/r/20250319092951.37667-10-jirislaby@kernel.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>