summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
Commit message (Collapse)AuthorAgeFilesLines
...
* remoteproc: core: Use device_match_of_node()ye xingchen2022-11-211-1/+1
| | | | | | | | Replace the open-code with device_match_of_node(). Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Link: https://lore.kernel.org/r/202211171541061366938@zte.com.cn Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Correct i.MX93 DRAM mappingPeng Fan2022-11-151-2/+2
| | | | | | | | | | | According to updated reference mannual, the M33 DRAM view of 0x[C,D]0000000 maps to A55 0xC0000000, so correct it. Fixes: 9222fabf0e39 ("remoteproc: imx_rproc: Support i.MX93") Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20221102111410.38737-1-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXPPeng Fan2022-10-241-1/+2
| | | | | | | | | | i.MX8QM/QXP M4 could recover without help from Linux, so to support it: - enable feature RPROC_FEAT_ATTACH_ON_RECOVERY - set recovery_disabled as false Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20221021041526.3696483-8-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Request mbox channel laterPeng Fan2022-10-241-2/+46
| | | | | | | | | | | | | | | | | | | | | | | It is possible that when remote processor crash, the communication channel will be broken with garbage value in mailbox, such as when Linux is issuing a message through mailbox, remote processor crashes, we need free & rebuild the mailbox channels to make sure no garbage value in mailbox channels. So move the request/free to start/stop for managing remote procesosr in Linux, move to attach/detach for remote processor is out of control of Linux. Previous, we just request mbox when attach for CM4 boot early before Linux, but if mbox defer probe, remoteproc core will do resource cleanup and corrupt resource table for later probe. So move request mbox ealier and still keep mbox request when attach for self recovery case, but keep a check when request/free mbox. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20221021041526.3696483-7-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Support i.MX8QMPeng Fan2022-10-241-3/+44
| | | | | | | | | | Most logic are same as i.MX8QXP, but i.MX8QM has two general purpose M4 cores, the two cores runs independently and they have different resource id, different start address from SCFW view. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20221021041526.3696483-6-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Support kicking Mcore from Linux for i.MX8QXPPeng Fan2022-10-241-3/+93
| | | | | | | | | | | | | When M4 is in the same hardware partition with Cortex-A, it could be start/stop by Linux. Added power domain to make sure M4 could run, it requires several power domains to work. Make clock always optional for i.MX8QXP, because SCFW handles it when power up M4 core. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20221021041526.3696483-5-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Support attaching to i.MX8QXP M4Peng Fan2022-10-241-1/+107
| | | | | | | | | | | | | When M4 is kicked by SCFW, M4 runs in its own hardware partition, Linux could only do IPC with M4, it could not start, stop, update image. We disable recovery reboot when M4 is managed by SCFW, because remoteproc core still not support M4 auto-recovery without loading image. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20221021041526.3696483-4-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_dsp_rproc: Add mutex protection for workqueueShengjiu Wang2022-10-241-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The workqueue may execute late even after remoteproc is stopped or stopping, some resources (rpmsg device and endpoint) have been released in rproc_stop_subdevices(), then rproc_vq_interrupt() accessing these resources will cause kennel dump. Call trace: virtqueue_add_split+0x1ac/0x560 virtqueue_add_inbuf+0x4c/0x60 rpmsg_recv_done+0x15c/0x294 vring_interrupt+0x6c/0xa4 rproc_vq_interrupt+0x30/0x50 imx_dsp_rproc_vq_work+0x24/0x40 [imx_dsp_rproc] process_one_work+0x1d0/0x354 worker_thread+0x13c/0x470 kthread+0x154/0x160 ret_from_fork+0x10/0x20 Add mutex protection in imx_dsp_rproc_vq_work(), if the state is not running, then just skip calling rproc_vq_interrupt(). Also the flush workqueue operation can't be added in rproc stop for the same reason. The call sequence is rproc_shutdown -> rproc_stop ->rproc_stop_subdevices ->rproc->ops->stop() ->imx_dsp_rproc_stop ->flush_work -> rproc_vq_interrupt The resource needed by rproc_vq_interrupt has been released in rproc_stop_subdevices, so flush_work is not safe to be called in imx_dsp_rproc_stop. Fixes: ec0e5549f358 ("remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/1664524216-19949-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: core: Auto select rproc-virtio device idShengjiu Wang2022-10-241-1/+7
| | | | | | | | | | | | | | | | | | | | With multiple remoteproc device, there will below error: sysfs: cannot create duplicate filename '/bus/platform/devices/rproc-virtio.0' The rvdev_data.index is duplicate, that cause issue, so need to use the PLATFORM_DEVID_AUTO instead. After fixing device name it becomes something like: /bus/platform/devices/rproc-virtio.2.auto Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com> Tested-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/1666100644-27010-1-git-send-email-shengjiu.wang@nxp.com [Fixed typographical error in comment block] Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: virtio: Fix warning on bindings by removing the of_match_tableArnaud Pouliquen2022-10-051-7/+1
| | | | | | | | | | | | | | | | The checkpatch tool complains that "virtio,rproc" is not documented. But it is not possible to probe the device "rproc-virtio" by declaring it in the device tree. So documenting it in the bindings does not make sense. This commit solves the checkpatch warning by suppressing the useless of_match_table. Suggested-by: Rob Herring <robh@kernel.org> Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio") Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20221005081317.3411684-1-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: Support attach recovery after rproc crashPeng Fan2022-09-281-19/+43
| | | | | | | | | | | | | | | | | | Current logic only support main processor to stop/start the remote processor after crash. However to SoC, such as i.MX8QM/QXP, the remote processor could do attach recovery after crash and trigger watchdog to reboot itself. It does not need main processor to load image, or stop/start remote processor. Introduce two functions: rproc_attach_recovery, rproc_boot_recovery for the two cases. Boot recovery is as before, let main processor to help recovery, while attach recovery is to recover itself without help. To attach recovery, we only do detach and attach. Acked-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20220928064756.4059662-3-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: Introduce rproc featuresPeng Fan2022-09-281-0/+15
| | | | | | | | | | | | | | | | remote processor may support: - boot recovery with help from main processor - self recovery without help from main processor - iommu - etc Introduce rproc features could simplify code to avoid adding more bool flags Acked-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20220928064756.4059662-2-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: virtio: Create platform device for the remoteproc_virtioArnaud Pouliquen2022-09-213-77/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define a platform driver to manage the remoteproc virtio device as a platform devices. The platform device allows to pass rproc_vdev_data platform data to specify properties that are stored in the rproc_vdev structure. Such approach will allow to preserve legacy remoteproc virtio device creation but also to probe the device using device tree mechanism. remoteproc_virtio.c update: - Add rproc_virtio_driver platform driver. The probe ops replaces the rproc_rvdev_add_device function. - All reference to the rvdev->dev has been updated to rvdev-pdev->dev. - rproc_rvdev_release is removed as associated to the rvdev device. - The use of rvdev->kref counter is replaced by get/put_device on the remoteproc virtio platform device. - The vdev device no longer increments rproc device counter. increment/decrement is done in rproc_virtio_probe/rproc_virtio_remove function in charge of the vrings allocation/free. remoteproc_core.c update: Migrate from the rvdev device to the rvdev platform device. From this patch, when a vdev resource is found in the resource table the remoteproc core register a platform device. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220921135044.917140-5-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: Move rproc_vdev management to remoteproc_virtio.cArnaud Pouliquen2022-09-213-160/+161
| | | | | | | | | | | | | | Move functions related to the management of the rproc_vdev structure in the remoteproc_virtio.c. The aim is to decorrelate as possible the virtio management from the core part. Due to the strong correlation between the vrings and the resource table the rproc_alloc/parse/free_vring functions are kept in the remoteproc core. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220921135044.917140-4-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: core: Introduce rproc_add_rvdev functionArnaud Pouliquen2022-09-211-2/+14
| | | | | | | | | | | The rproc structure contains a list of registered rproc_vdev structure. To be able to move the management of the rproc_vdev structure in remoteproc_virtio.c (i.e rproc_rvdev_add_device function), introduce the rproc_add_rvdev and rproc_remove_rvdev functions. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220921135044.917140-3-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: core: Introduce rproc_rvdev_add_device functionArnaud Pouliquen2022-09-212-64/+98
| | | | | | | | | | | | | | | | In preparation of the migration of the management of rvdev in remoteproc_virtio.c, this patch spins off a new function to manage the remoteproc virtio device creation. The rproc_rvdev_add_device will be moved to remoteproc_virtio.c. The rproc_vdev_data structure is introduced to provide information for the rvdev creation. This structure allows to manage the rvdev and vrings allocation in the rproc_rvdev_add_device function. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220921135044.917140-2-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: Harden rproc_handle_vdev() against integer overflowDan Carpenter2022-09-191-2/+3
| | | | | | | | | | | | | The struct_size() macro protects against integer overflows but adding "+ rsc->config_len" introduces the risk of integer overflows again. Use size_add() to be safe. Fixes: c87846571587 ("remoteproc: use struct_size() helper") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com> Link: https://lore.kernel.org/r/YyMyoPoGOJUcEpZT@kili Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc/keystone: Switch to using gpiod APIDmitry Torokhov2022-09-191-7/+9
| | | | | | | | | | | | | | | This patch switches the driver away from legacy gpio/of_gpio API to gpiod API, and removes use of of_get_named_gpio_flags() which I want to make private to gpiolib. Note that there is a behavior change in the driver: previously the driver did not actually request GPIO, it simply parsed GPIO number out of device tree and poked at it. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/Yxe20ehiOnitDGus@google.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* drivers/remoteproc: Fix repeated words in commentswangjianli2022-09-191-1/+1
| | | | | | | | | Delete the redundant word 'in'. Signed-off-by: wangjianli <wangjianli@cdjrlc.com> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com> Link: https://lore.kernel.org/r/20220908123237.16911-1-wangjianli@cdjrlc.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_dsp_rproc: fix argument 2 of rproc_mem_entry_initShengjiu Wang2022-08-231-2/+2
| | | | | | | | | | | | | | | | | There are sparse warning: drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *va @@ got void [noderef] __iomem *[assigned] cpu_addr @@ drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: expected void *va drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: got void [noderef] __iomem *[assigned] cpu_addr drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *va @@ got void [noderef] __iomem *[assigned] cpu_addr @@ drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: expected void *va drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: got void [noderef] __iomem *[assigned] cpu_addr Fixes: ec0e5549f358 ("remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1660567398-24495-1-git-send-email-shengjiu.wang@nxp.com Acked-by: Mukesh Ojha <quic_mojha@quicinc.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* remoteproc: imx_rproc: Simplify some error messageChristophe JAILLET2022-08-231-9/+5
| | | | | | | | | | | | | dev_err_probe() already prints the error code in a human readable way, so there is no need to duplicate it as a numerical value at the end of the message. While at it, remove 'ret' that is mostly useless. Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/6b9343c2688117a340661d8ee491c2962c54a09a.1659736936.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* virtio: Revert "virtio: find_vqs() add arg sizes"Michael S. Tsirkin2022-08-161-1/+0
| | | | | | | | | | | | | | | | | This reverts commit a10fba0377145fccefea4dc4dd5915b7ed87e546: the proposed API isn't supported on all transports but no effort was made to address this. It might not be hard to fix if we want to: maybe just rename size to size_hint and make sure legacy transports ignore the hint. But it's not sure what the benefit is in any case, so let's drop it. Fixes: a10fba037714 ("virtio: find_vqs() add arg sizes") Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20220816053602.173815-8-mst@redhat.com>
* Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds2022-08-122-7/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull virtio updates from Michael Tsirkin: - A huge patchset supporting vq resize using the new vq reset capability - Features, fixes, and cleanups all over the place * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (88 commits) vdpa/mlx5: Fix possible uninitialized return value vdpa_sim_blk: add support for discard and write-zeroes vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH vdpa_sim_blk: make vdpasim_blk_check_range usable by other requests vdpa_sim_blk: check if sector is 0 for commands other than read or write vdpa_sim: Implement suspend vdpa op vhost-vdpa: uAPI to suspend the device vhost-vdpa: introduce SUSPEND backend feature bit vdpa: Add suspend operation virtio-blk: Avoid use-after-free on suspend/resume virtio_vdpa: support the arg sizes of find_vqs() vhost-vdpa: Call ida_simple_remove() when failed vDPA: fix 'cast to restricted le16' warnings in vdpa.c vDPA: !FEATURES_OK should not block querying device config space vDPA/ifcvf: support userspace to query features and MQ of a management device vDPA/ifcvf: get_config_size should return a value no greater than dev implementation vhost scsi: Allow user to control num virtqueues vhost-scsi: Fix max number of virtqueues vdpa/mlx5: Support different address spaces for control and data vdpa/mlx5: Implement susupend virtqueue callback ...
| * virtio: find_vqs() add arg sizesXuan Zhuo2022-08-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_vqs() adds a new parameter sizes to specify the size of each vq vring. NULL as sizes means that all queues in find_vqs() use the maximum size. A value in the array is 0, which means that the corresponding queue uses the maximum size. In the split scenario, the meaning of size is the largest size, because it may be limited by memory, the virtio core will try a smaller size. And the size is power of 2. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20220801063902.129329-34-xuanzhuo@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * virtio: record the maximum queue num supported by the device.Xuan Zhuo2022-08-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | virtio-net can display the maximum (supported by hardware) ring size in ethtool -g eth0. When the subsequent patch implements vring reset, it can judge whether the ring size passed by the driver is legal based on this. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20220801063902.129329-2-xuanzhuo@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * remoteproc: rename len of rpoc_vring to numXuan Zhuo2022-08-112-7/+7
| | | | | | | | | | | | | | | | | | | | | | Rename the member len in the structure rpoc_vring to num. And remove 'in bytes' from the comment of it. This is misleading. Because this actually refers to the size of the virtio vring to be created. The unit is not bytes. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Message-Id: <20220624025621.128843-2-xuanzhuo@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | remoteproc: qcom_q6v5_pas: Do not fail if regulators are not foundManivannan Sadhasivam2022-08-081-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | devm_regulator_get_optional() API will return -ENODEV if the regulator was not found. For the optional supplies CX, PX we should not fail in that case but rather continue. So let's catch that error and continue silently if those regulators are not found. The commit 3f52d118f992 ("remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators") was supposed to do the same but it missed the fact that devm_regulator_get_optional() API returns -ENODEV when the regulator was not found. Cc: Abel Vesa <abel.vesa@linaro.org> Fixes: 3f52d118f992 ("remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators") Reported-by: Steev Klimaszewski <steev@kali.org> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Steev Klimaszewski <steev@kali.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220801053939.12556-1-manivannan.sadhasivam@linaro.org
* | drivers/remoteproc: fix repeated words in commentswangjianli2022-07-251-1/+1
| | | | | | | | | | | | | | | | Delete the redundant word 'in'. Signed-off-by: wangjianli <wangjianli@cdjrlc.com> Link: https://lore.kernel.org/r/20220724073418.15793-1-wangjianli@cdjrlc.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* | remoteproc: Directly use ida_alloc()/free()keliu2022-07-181-3/+3
| | | | | | | | | | | | | | | | | | Use ida_alloc()/ida_free() instead of deprecated ida_simple_get()/ida_simple_remove() . Signed-off-by: keliu <liuke94@huawei.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220527073832.2474641-1-liuke94@huawei.com
* | remoteproc: Use unbounded workqueue for recovery workMukesh Ojha2022-07-181-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There could be a scenario when there is too much load on a core (n number of tasks which is affined) or in a case when multiple rproc subsystem is going for recovery, they queue their recovery work to one core so even though subsystem are independent their recovery will be delayed if one of the subsystem recovery work is taking more time in completing. If we make this queue unbounded, the recovery work could be picked on any cpu. This patch is trying to address this. Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1650367554-15510-1-git-send-email-quic_mojha@quicinc.com
* | remoteproc: using pm_runtime_resume_and_get instead of pm_runtime_get_syncMinghao Chi2022-07-181-2/+1
| | | | | | | | | | | | | | | | | | | | Using pm_runtime_resume_and_get is more appropriate for simplifing code Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220411013656.2517150-1-chi.minghao@zte.com.cn
* | remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulatorsAbel Vesa2022-07-181-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use _get_optional as some platforms might not provide the px and cx regulators. This avoids printing the following for each unavailable regulator: [ 4.350229] qcom_q6v5_pas 5c00000.remoteproc: supply cx not found, using dummy regulator [ 4.374224] qcom_q6v5_pas 5c00000.remoteproc: supply px not found, using dummy regulator Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220713152835.3848875-1-abel.vesa@linaro.org
* | remoteproc: sysmon: Send sysmon state only for running rprocsSiddharth Gupta2022-07-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new remoteproc boots up, send the sysmon state notification of only running remoteprocs. Sending state of remoteprocs booting up in parallel can cause a race between SSR clients of the remoteproc that is booting up and the sysmon notification for the same remoteproc, resulting in an inconsistency between which state the remoteproc that is booting up in parallel. For example - if remoteproc A and B crash one after the other, after remoteproc A boots up, if the remoteproc A tries to get the state of remoteproc B before the sysmon subdevice for B is invoked but after the ssr subdevice of B has been invoked, clients on remoteproc A might get confused when the sysmon notification indicates a different state. Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-8-git-send-email-quic_sibis@quicinc.com
* | remoteproc: sysmon: Wait for SSCTL service to come upSibi Sankar2022-07-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SSCTL service comes up after a finite time when the remote Q6 comes out of reset. Any graceful shutdowns requested during this period will be a NOP and abrupt tearing down of the glink channel might lead to pending transactions on the remote Q6 side and will ultimately lead to a fatal error. Fix this by waiting for the SSCTL service when a graceful shutdown is requested. Fixes: 1fb82ee806d1 ("remoteproc: qcom: Introduce sysmon") Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-7-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: q6v5: Set q6 state to offline on receiving wdog irqSiddharth Gupta2022-07-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to firmware bugs on the Q6 the hardware watchdog irq can be triggered multiple times. As the remoteproc framework schedules work items for the recovery process, if the other threads do not get a chance to run before recovery is completed the proceeding threads will see the state of the remoteproc as running and kill the remoteproc while it is running. This can result in various SMMU and NOC errors. This change sets the state of the remoteproc to offline whenever a watchdog irq is received. Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-6-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: pas: Check if coredump is enabledSiddharth Gupta2022-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Client drivers need to check if coredump is enabled for the rproc before continuing with coredump generation. This change adds a check in the PAS driver. Fixes: 8ed8485c4f05 ("remoteproc: qcom: Add capability to collect minidumps") Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-5-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: pas: Mark devices as wakeup capableSiddharth Gupta2022-07-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | device_wakeup_enable() on its own is not capable of setting device as wakeup capable, it needs to be used in conjunction with device_set_wakeup_capable(). The device_init_wakeup() calls both these functions on the device passed. Fixes: a781e5aa5911 ("remoteproc: core: Prevent system suspend during remoteproc recovery") Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-4-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: pas: Mark va as io memorySiddharth Gupta2022-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | The pas driver remaps the entire carveout region using the dev_ioremap_wc() call, which is then used in the adsp_da_to_va() calls made by the rproc framework. This change marks the va returned by this call as an iomem va. Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-3-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: pas: Add decrypt shutdown support for modemSibi Sankar2022-07-181-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial shutdown request to modem on SM8450 SoCs would start the decryption process and will keep returning errors until the modem shutdown is complete. Fix this by retrying shutdowns in fixed intervals. Err Logs on modem shutdown: qcom_q6v5_pas 4080000.remoteproc: failed to shutdown: -22 remoteproc remoteproc3: can't stop rproc: -22 Fixes: 5cef9b48458d ("remoteproc: qcom: pas: Add SM8450 remoteproc support") Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1657022900-2049-2-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: q6v5-mss: add powerdomains to MSM8996 configDmitry Baryshkov2022-07-181-0/+5
| | | | | | | | | | | | | | | | | | | | MSM8996 follows the rest of MSS devices and requires a vote on MX and CX power domains. Add corresponding entry to the device data. Fixes: 4760a896be88 ("remoteproc: q6v5-mss: Vote for rpmh power domains") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220704162202.819051-1-dmitry.baryshkov@linaro.org
* | remoteproc: qcom_q6v5: Introduce panic handler for MSSSibi Sankar2022-07-181-0/+8
| | | | | | | | | | | | | | | | | | | | Make the MSS q6v5 remoteproc drivers implement the panic handler that will invoke a stop to prepare the remoteprocs for post mortem debugging. Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1653396335-6295-3-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom_q6v5_mss: Update MBA log infoSibi Sankar2022-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | Update MBA text logs location/size in IMEM to aid tools extract them after ramdump collection. The size of the MBA text logs is pre-determined and limited to 4K. Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1653396335-6295-2-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: correct kerneldocKrzysztof Kozlowski2022-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Correct kerneldoc warnings like: drivers/remoteproc/qcom_common.c:68: warning: expecting prototype for struct minidump_subsystem_toc. Prototype was for struct minidump_subsystem instead Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220519073349.7270-1-krzysztof.kozlowski@linaro.org
* | remoteproc: qcom_q6v5_mss: map/unmap metadata region before/after useSibi Sankar2022-07-181-6/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The application processor accessing the dynamically assigned metadata region after assigning it to the remote Q6 would lead to an XPU violation. Fix this by un-mapping the metadata region post firmware header copy. The metadata region is freed only after the modem Q6 is done with fw header authentication. Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1652248625-990-1-git-send-email-quic_sibis@quicinc.com
* | remoteproc: qcom: using pm_runtime_resume_and_get to simplify the coderan jianping2022-07-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and pm_runtime_put_noidle. This change is just to simplify the code, no actual functional changes. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: ran jianping <ran.jianping@zte.com.cn> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220428064545.3850057-1-ran.jianping@zte.com.cn
* | remoteproc: mediatek: Support MT8188 SCPTinghan Shen2022-07-181-0/+13
| | | | | | | | | | | | | | | | | | | | | | MT8188 SCP has two RISC-V cores and similar to MT8195 with some differences. The MT8188 SCP doesn't have the l1tcm and fix the DSP EMI issue on MT8195. Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220715051821.30707-3-tinghan.shen@mediatek.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* | remoteproc: qcom: wcnss: Fix handling of IRQsSireesh Kodali2022-07-061-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | The wcnss_get_irq function is expected to return a value > 0 in the event that an IRQ is succssfully obtained, but it instead returns 0. This causes the stop and ready IRQs to never actually be used despite being defined in the device-tree. This patch fixes that. Fixes: aed361adca9f ("remoteproc: qcom: Introduce WCNSS peripheral image loader") Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220526141740.15834-2-sireeshkodali1@gmail.com
* | remoteproc: pru: Add support for various PRU cores on K3 AM62x SoCsKishon Vijay Abraham I2022-07-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The K3 AM62x family of SoC has one PRUSS-M instance and it has two Programmable Real-Time Units (PRU0 and PRU1). This does not support Industrial Communications Subsystem features like Ethernet. Enhance the existing PRU remoteproc driver to support the PRU cores by using specific compatibles. The initial names for the firmware images for each PRU core are retrieved from DT nodes, and can be adjusted through sysfs if required. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Link: https://lore.kernel.org/r/20220602101920.12504-4-kishon@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* | remoteproc: mediatek: Enable cache for mt8186 SCPAllen-KH Cheng2022-07-041-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is for enabling cache in SCP. There is not enough space on the SRAM of SCP. We need to run programs in DRAM. The DRAM power and latency is much larger than SRAM, so cache is used to mitigate the negative effects for performance. We set SCP registers for cache size before loading SCP FW. (8KB+8KB) and also adjust ipi_buf_offset in SRAM from 0x7bdb0 to 0x3bdb0 for enabling cache. Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com> Tested-by: TingHan Shen <tinghan.shen@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220701121229.22756-2-allen-kh.cheng@mediatek.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
* | remoteproc: Fix dma_mem leak after rproc_shutdownMark-PK Tsai2022-06-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Release dma coherent memory before rvdev is free in rproc_rvdev_release(). Below is the kmemleak report: unreferenced object 0xffffff8051c1a980 (size 128): comm "sh", pid 4895, jiffies 4295026604 (age 15481.896s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000003a0f3ec0>] dma_declare_coherent_memory+0x44/0x11c [<00000000ad243164>] rproc_add_virtio_dev+0xb8/0x20c [<00000000d219c8e9>] rproc_vdev_do_start+0x18/0x24 [<00000000e694b468>] rproc_start+0x22c/0x3e0 [<000000000b938941>] rproc_boot+0x4a4/0x860 [<000000003c4dc532>] state_store.52856+0x10c/0x1b8 [<00000000df2297ac>] dev_attr_store+0x34/0x84 [<0000000083a53bdb>] sysfs_kf_write+0x60/0xbc [<000000008ed830df>] kernfs_fop_write+0x198/0x458 [<0000000072b9ad06>] __vfs_write+0x50/0x210 [<00000000377d7469>] vfs_write+0xe4/0x1a8 [<00000000c3fc594e>] ksys_write+0x78/0x144 [<000000009aef6f4b>] __arm64_sys_write+0x1c/0x28 [<0000000003496a98>] el0_svc_common+0xc8/0x22c [<00000000ea3fe7a3>] el0_svc_compat_handler+0x1c/0x28 [<00000000d1a85a4e>] el0_svc_compat+0x8/0x24 Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com> Acked-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220422062436.14384-3-mark-pk.tsai@mediatek.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>