From 7efb14256dd306407cf8388a46a4a6c5c5c85774 Mon Sep 17 00:00:00 2001 From: Mark-PK Tsai Date: Tue, 2 Nov 2021 22:15:35 +0800 Subject: remoteproc: Use %pe format string to print return error code Use %pe format string to print return error code which make the error message easier to understand. Signed-off-by: Mark-PK Tsai Link: https://lore.kernel.org/r/20211102141535.28372-1-mark-pk.tsai@mediatek.com Reviewed-by: Bjorn Andersson [Fixed capital letter in subject line] Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 775df165eb45..69f51acf235e 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -577,8 +577,8 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr, dma_get_mask(rproc->dev.parent)); if (ret) { dev_warn(dev, - "Failed to set DMA mask %llx. Trying to continue... %x\n", - dma_get_mask(rproc->dev.parent), ret); + "Failed to set DMA mask %llx. Trying to continue... (%pe)\n", + dma_get_mask(rproc->dev.parent), ERR_PTR(ret)); } /* parse the vrings */ -- cgit From 4da96175014be67c846fd274eace08066e525d75 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 16 Oct 2021 08:44:28 +0200 Subject: remoteproc: imx_rproc: Fix a resource leak in the remove function 'priv->workqueue' is destroyed in the error handling path of the probe but not in the remove function. Add the missing call to release some resources. Cc: stable Fixes: 2df7062002d0 ("remoteproc: imx_proc: enable virtio/mailbox") Signed-off-by: Christophe JAILLET Reviewed-by: Peng Fan Tested-by: Peng Fan Link: https://lore.kernel.org/r/d28ca94a4031bd7297d47c2164e18885a5a6ec19.1634366546.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mathieu Poirier --- drivers/remoteproc/imx_rproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index ff8170dbbc3c..0a45bc0d3f73 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -804,6 +804,7 @@ static int imx_rproc_remove(struct platform_device *pdev) clk_disable_unprepare(priv->clk); rproc_del(rproc); imx_rproc_free_mbox(rproc); + destroy_workqueue(priv->workqueue); rproc_free(rproc); return 0; -- cgit From 876e0b26ccd211ca92607d83c87cc1f097784c6d Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 10 Nov 2021 11:21:01 +0800 Subject: remoteproc: coredump: Correct argument 2 type for memcpy_fromio Address the sparse check warning: >> drivers/remoteproc/remoteproc_coredump.c:169:53: sparse: warning: incorrect type in argument 2 (different address spaces) sparse: expected void const volatile [noderef] __iomem *src sparse: got void *[assigned] ptr Reported-by: kernel test robot Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/20211110032101.517487-1-peng.fan@oss.nxp.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_coredump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_coredump.c b/drivers/remoteproc/remoteproc_coredump.c index c892f433a323..4b093420d98a 100644 --- a/drivers/remoteproc/remoteproc_coredump.c +++ b/drivers/remoteproc/remoteproc_coredump.c @@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc, void *dest, memset(dest, 0xff, size); } else { if (is_iomem) - memcpy_fromio(dest, ptr, size); + memcpy_fromio(dest, (void const __iomem *)ptr, size); else memcpy(dest, ptr, size); } -- cgit From a9328d6de14e5b7c9256729d4d9f0924345d4eb9 Mon Sep 17 00:00:00 2001 From: Hari Nagalla Date: Mon, 22 Nov 2021 06:27:23 -0600 Subject: dt-bindings: remoteproc: k3-r5f: Update bindings for J721S2 SoCs The TI K3 J721S2 SoCs have three dual-core Arm R5F clusters/subsystems, with 2 R5F cores each, one in MCU voltage domain and the other two in MAIN voltage domain. These clusters are similar to J7200 R5F clusters. Compatible info is updated for intuitively matching to the new J721S2 SoCs. Signed-off-by: Hari Nagalla Acked-by: Rob Herring Link: https://lore.kernel.org/r/20211122122726.8532-2-hnagalla@ti.com Signed-off-by: Mathieu Poirier --- Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml index eeef255c4045..d9c7e8c2b268 100644 --- a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml @@ -38,6 +38,7 @@ properties: - ti,j721e-r5fss - ti,j7200-r5fss - ti,am64-r5fss + - ti,j721s2-r5fss power-domains: description: | @@ -64,9 +65,9 @@ properties: description: | Configuration Mode for the Dual R5F cores within the R5F cluster. Should be either a value of 1 (LockStep mode) or 0 (Split mode) on - most SoCs (AM65x, J721E, J7200), default is LockStep mode if omitted; - and should be either a value of 0 (Split mode) or 2 (Single-CPU mode) - on AM64x SoCs, default is Split mode if omitted. + most SoCs (AM65x, J721E, J7200, J721s2), default is LockStep mode if + omitted; and should be either a value of 0 (Split mode) or 2 + (Single-CPU mode) on AM64x SoCs, default is Split mode if omitted. # R5F Processor Child Nodes: # ========================== @@ -104,6 +105,7 @@ patternProperties: - ti,j721e-r5f - ti,j7200-r5f - ti,am64-r5f + - ti,j721s2-r5f reg: items: -- cgit From 83b57e60b86372d3274ac9baf04219bb497da2d2 Mon Sep 17 00:00:00 2001 From: Hari Nagalla Date: Mon, 22 Nov 2021 06:27:24 -0600 Subject: dt-bindings: remoteproc: k3-dsp: Update bindings for J721S2 SoCs The TI K3 J721S2 SoCs have two TMS320C71x DSP subsystems, and does not have any TMS320C66x DSP subsystems. The C71x DSP subsystem in J721S2 SoCs is a similar to the C71x DSP on J721e with some minor core IP updates. Compatible info is updated for intuitvely matching to the new J721S2 SoCs. Signed-off-by: Hari Nagalla Acked-by: Rob Herring Link: https://lore.kernel.org/r/20211122122726.8532-3-hnagalla@ti.com Signed-off-by: Mathieu Poirier --- Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml index 5ec6505ac408..7b56497eec4d 100644 --- a/Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/ti,k3-dsp-rproc.yaml @@ -33,9 +33,11 @@ properties: enum: - ti,j721e-c66-dsp - ti,j721e-c71-dsp + - ti,j721s2-c71-dsp description: Use "ti,j721e-c66-dsp" for C66x DSPs on K3 J721E SoCs Use "ti,j721e-c71-dsp" for C71x DSPs on K3 J721E SoCs + Use "ti,j721s2-c71-dsp" for C71x DSPs on K3 J721S2 SoCs resets: description: | @@ -106,6 +108,7 @@ else: compatible: enum: - ti,j721e-c71-dsp + - ti,j721s2-c71-dsp then: properties: reg: -- cgit From 3b918d8e9bd514d798a82568ef99b8d8ca90c8b8 Mon Sep 17 00:00:00 2001 From: Hari Nagalla Date: Mon, 22 Nov 2021 06:27:25 -0600 Subject: remoteproc: k3-dsp: Extend support for C71x DSPs on J721S2 SoCs The K3 J721S2 SoCs have two C71x DSP subsystems in MAIN voltage domain, and there are no C66x DSP subsystems on these SoCs. The C71x DSP subsystem is a slighly updated version of the C71x DSP subsystem on J721e. The C71x DSPs are 64 bit machine with fixed and floating point DSP operations. Extend support to the C71x DSPs with J721S2 compatible strings. Signed-off-by: Hari Nagalla Link: https://lore.kernel.org/r/20211122122726.8532-4-hnagalla@ti.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index c352fa277c8d..939c5d90b562 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -767,6 +767,7 @@ static const struct k3_dsp_dev_data c71_data = { static const struct of_device_id k3_dsp_of_match[] = { { .compatible = "ti,j721e-c66-dsp", .data = &c66_data, }, { .compatible = "ti,j721e-c71-dsp", .data = &c71_data, }, + { .compatible = "ti,j721s2-c71-dsp", .data = &c71_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, k3_dsp_of_match); -- cgit From b20dc021ba5a813fec6dd66bb78a658e58cfce8d Mon Sep 17 00:00:00 2001 From: Hari Nagalla Date: Mon, 22 Nov 2021 06:27:26 -0600 Subject: remoteproc: k3-r5: Extend support for R5F clusters on J721S2 SoCs The K3 J721S2 SoCs have three dual-core R5F subsystems, one in MCU voltage domain and the other two in MAIN voltage domain. These R5F clusters are similar to the R5F clusters in J7200 SoCs. Compatible Info is updated to support J721S2 SoCs. Signed-off-by: Hari Nagalla Link: https://lore.kernel.org/r/20211122122726.8532-5-hnagalla@ti.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index 6499302d00c3..969531c05b13 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1535,7 +1535,7 @@ static const struct k3_r5_soc_data am65_j721e_soc_data = { .single_cpu_mode = false, }; -static const struct k3_r5_soc_data j7200_soc_data = { +static const struct k3_r5_soc_data j7200_j721s2_soc_data = { .tcm_is_double = true, .tcm_ecc_autoinit = true, .single_cpu_mode = false, @@ -1550,8 +1550,9 @@ static const struct k3_r5_soc_data am64_soc_data = { static const struct of_device_id k3_r5_of_match[] = { { .compatible = "ti,am654-r5fss", .data = &am65_j721e_soc_data, }, { .compatible = "ti,j721e-r5fss", .data = &am65_j721e_soc_data, }, - { .compatible = "ti,j7200-r5fss", .data = &j7200_soc_data, }, + { .compatible = "ti,j7200-r5fss", .data = &j7200_j721s2_soc_data, }, { .compatible = "ti,am64-r5fss", .data = &am64_soc_data, }, + { .compatible = "ti,j721s2-r5fss", .data = &j7200_j721s2_soc_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, k3_r5_of_match); -- cgit From c768968f134b9e7ab8a584ad19030a8d2c7eca2f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 5 Dec 2021 12:13:49 +0100 Subject: remoteproc: ingenic: Request IRQ disabled The ingenic remoteproc driver requests its IRQ and then immediately disables it. The disable is necessary since irq_request() normally enables the IRQ. But there is a new flag IRQF_NO_AUTOEN that when specified keeps the IRQ disabled. Use this new flag rather than calling disable_irq(). This slightly reduce the boilerplate code and also avoids a theoretical race condition where the IRQ could fire between irq_request() and disable_irq(). Signed-off-by: Lars-Peter Clausen Acked-by: Paul Cercueil Link: https://lore.kernel.org/r/20211205111349.51213-1-lars@metafoo.de Signed-off-by: Mathieu Poirier --- drivers/remoteproc/ingenic_rproc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/ingenic_rproc.c b/drivers/remoteproc/ingenic_rproc.c index a356738160a4..9902cce28692 100644 --- a/drivers/remoteproc/ingenic_rproc.c +++ b/drivers/remoteproc/ingenic_rproc.c @@ -218,14 +218,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev) if (vpu->irq < 0) return vpu->irq; - ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, 0, "VPU", rproc); + ret = devm_request_irq(dev, vpu->irq, vpu_interrupt, IRQF_NO_AUTOEN, + "VPU", rproc); if (ret < 0) { dev_err(dev, "Failed to request IRQ\n"); return ret; } - disable_irq(vpu->irq); - ret = devm_rproc_add(dev, rproc); if (ret) { dev_err(dev, "Failed to register remote processor\n"); -- cgit From 62c46d55688894c517d26b88ddb37a8dfa8a155a Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Thu, 2 Dec 2021 10:11:25 -0700 Subject: MAINTAINERS: Removing Ohad from remoteproc/rpmsg maintenance Ohad has not reviewed patches in the remoteproc and rpmsg subsystems for several years now: $ git log --no-merges --format=email drivers/remoteproc/ drivers/rpmsg/ | \ grep -Pi "^Subject:|^Date:|^[\w\-]+-by:.*ohad*" | grep -B2 ohad Date: Wed, 16 Sep 2015 07:32:54 -0500 Subject: [PATCH] remoteproc/wkup_m3: Use MODULE_DEVICE_TABLE to export alias Signed-off-by: Ohad Ben-Cohen Date: Fri, 28 Aug 2015 18:08:19 -0700 Subject: [PATCH] remoteproc: report error if resource table doesn't exist Signed-off-by: Ohad Ben-Cohen -- Date: Wed, 16 Sep 2015 19:29:18 -0500 Subject: [PATCH] remoteproc: fix memory leak of remoteproc ida cache layers Signed-off-by: Ohad Ben-Cohen Date: Fri, 20 Nov 2015 18:26:07 +0100 Subject: [PATCH] remoteproc: avoid stack overflow in debugfs file Signed-off-by: Ohad Ben-Cohen Date: Thu, 18 Jun 2015 11:44:41 +0300 Subject: [PATCH] remoteproc: fix !CONFIG_OF build breakage Signed-off-by: Ohad Ben-Cohen Date: Fri, 22 May 2015 15:45:30 -0500 Subject: [PATCH] remoteproc/wkup_m3: add a remoteproc driver for TI Wakeup M3 Signed-off-by: Ohad Ben-Cohen As such move his names to the CREDITS file. Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20211202171125.903608-1-mathieu.poirier@linaro.org Acked-by: Ohad Ben Cohen --- CREDITS | 5 +++++ MAINTAINERS | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index d8f63e8329e8..b97256d5bc24 100644 --- a/CREDITS +++ b/CREDITS @@ -315,6 +315,11 @@ S: Via Delle Palme, 9 S: Terni 05100 S: Italy +N: Ohad Ben Cohen +E: ohad@wizery.com +D: Remote Processor (remoteproc) subsystem +D: Remote Processor Messaging (rpmsg) subsystem + N: Krzysztof Benedyczak E: golbi@mat.uni.torun.pl W: http://www.mat.uni.torun.pl/~golbi diff --git a/MAINTAINERS b/MAINTAINERS index 7a2345ce8521..ee82a598b3ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16171,7 +16171,6 @@ S: Supported F: fs/reiserfs/ REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM -M: Ohad Ben-Cohen M: Bjorn Andersson M: Mathieu Poirier L: linux-remoteproc@vger.kernel.org @@ -16185,7 +16184,6 @@ F: include/linux/remoteproc.h F: include/linux/remoteproc/ REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM -M: Ohad Ben-Cohen M: Bjorn Andersson M: Mathieu Poirier L: linux-remoteproc@vger.kernel.org -- cgit From 8f86e69536f32a645e45a00d3b2ea73af5e41180 Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Mon, 6 Dec 2021 20:18:58 +0100 Subject: remoteproc: Fix remaining wrong return formatting in documentation kernel documentation specification: "The return value, if any, should be described in a dedicated section named Return." Signed-off-by: Arnaud Pouliquen Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211206191858.10741-1-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/mtk_scp_ipi.c | 4 ++-- drivers/remoteproc/st_slim_rproc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/mtk_scp_ipi.c b/drivers/remoteproc/mtk_scp_ipi.c index 6dc955ecab80..00f041ebcde6 100644 --- a/drivers/remoteproc/mtk_scp_ipi.c +++ b/drivers/remoteproc/mtk_scp_ipi.c @@ -23,7 +23,7 @@ * * Register an ipi function to receive ipi interrupt from SCP. * - * Returns 0 if ipi registers successfully, -error on error. + * Return: 0 if ipi registers successfully, -error on error. */ int scp_ipi_register(struct mtk_scp *scp, u32 id, @@ -150,7 +150,7 @@ EXPORT_SYMBOL_GPL(scp_ipi_unlock); * When the processing completes, IPI handler registered * by scp_ipi_register will be called in interrupt context. * - * Returns 0 if sending data successfully, -error on error. + * Return: 0 if sending data successfully, -error on error. **/ int scp_ipi_send(struct mtk_scp *scp, u32 id, void *buf, unsigned int len, unsigned int wait) diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c index 22096adc1ad3..4ed9467897e5 100644 --- a/drivers/remoteproc/st_slim_rproc.c +++ b/drivers/remoteproc/st_slim_rproc.c @@ -216,7 +216,7 @@ static const struct rproc_ops slim_rproc_ops = { * obtains and enables any clocks required by the SLIM core and also * ioremaps the various IO. * - * Returns st_slim_rproc pointer or PTR_ERR() on error. + * Return: st_slim_rproc pointer or PTR_ERR() on error. */ struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev, -- cgit From d3c76a42ecc7c41ddcba1455f4f6631648812df0 Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Tue, 7 Dec 2021 17:58:28 +0100 Subject: dt-bindings: remoteproc: Add Renesas R-Car Renesas R-Car SoCs may contain a Realtime processor. This patch adds bindings for this remote processor. Signed-off-by: Julien Massot Reviewed-by: Rob Herring Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211207165829.195537-2-julien.massot@iot.bzh Signed-off-by: Mathieu Poirier --- .../bindings/remoteproc/renesas,rcar-rproc.yaml | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/renesas,rcar-rproc.yaml diff --git a/Documentation/devicetree/bindings/remoteproc/renesas,rcar-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/renesas,rcar-rproc.yaml new file mode 100644 index 000000000000..a7d25fa920e5 --- /dev/null +++ b/Documentation/devicetree/bindings/remoteproc/renesas,rcar-rproc.yaml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/remoteproc/renesas,rcar-rproc.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Renesas R-Car remote processor controller bindings + +maintainers: + - Julien Massot + +description: | + This document defines the bindings for the remoteproc component that loads and + boots firmwares on the Renesas R-Car family chipset. + R-Car gen3 family may have a realtime processor, this processor shares peripheral + and RAM with the host processor with the same address map. + +properties: + compatible: + const: renesas,rcar-cr7 + + resets: + maxItems: 1 + + power-domains: + maxItems: 1 + + memory-region: + description: + List of phandles to the reserved memory regions associated with the + remoteproc device. This is variable and describes the memories shared with + the remote processor (e.g. remoteproc firmware and carveouts, rpmsg + vrings, ...). + (see ../reserved-memory/reserved-memory.yaml) + +required: + - compatible + - resets + - memory-region + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + + cr7_ram: cr7_ram@40040000 { + no-map; + reg = <0x0 0x40040000 0x0 0x1fc0000>; + }; + }; + + cr7_rproc: cr7 { + compatible = "renesas,rcar-cr7"; + memory-region = <&cr7_ram>; + power-domains = <&sysc R8A7795_PD_CR7>; + resets = <&cpg 222>; + }; + +... -- cgit From 285892a74f1370a12249f765c6a4e3b16194852e Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Tue, 7 Dec 2021 17:58:29 +0100 Subject: remoteproc: Add Renesas rcar driver Renesas Gen3 platform includes a Cortex-r7 processor. Both: the application cores (A5x) and the realtime core (CR7) share access to the RAM and devices with the same address map, so device addresses are equal to the Linux physical addresses. In order to initialize this remote processor we need to: - power on the realtime core - put the firmware in a RAM area - set the boot address for this firmware (reset vector) - Deassert the reset This initial driver allows to start and stop the Cortex R7 processor. Signed-off-by: Julien Massot Link: https://lore.kernel.org/r/20211207165829.195537-3-julien.massot@iot.bzh Signed-off-by: Mathieu Poirier --- drivers/remoteproc/Kconfig | 11 ++ drivers/remoteproc/Makefile | 1 + drivers/remoteproc/rcar_rproc.c | 224 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 drivers/remoteproc/rcar_rproc.c diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index f2e961f998ca..3ddd426fc969 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -283,6 +283,17 @@ config QCOM_WCNSS_PIL verified and booted with the help of the Peripheral Authentication System (PAS) in TrustZone. +config RCAR_REMOTEPROC + tristate "Renesas R-Car Gen3 remoteproc support" + depends on ARCH_RENESAS || COMPILE_TEST + help + Say y here to support R-Car realtime processor via the + remote processor framework. An ELF firmware can be loaded + thanks to sysfs remoteproc entries. The remote processor + can be started and stopped. + This can be either built-in or a loadable module. + If compiled as module (M), the module name is rcar_rproc. + config ST_REMOTEPROC tristate "ST remoteproc support" depends on ARCH_STI diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile index 0ac256b6c977..5478c7cb9e07 100644 --- a/drivers/remoteproc/Makefile +++ b/drivers/remoteproc/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_QCOM_SYSMON) += qcom_sysmon.o obj-$(CONFIG_QCOM_WCNSS_PIL) += qcom_wcnss_pil.o qcom_wcnss_pil-y += qcom_wcnss.o qcom_wcnss_pil-y += qcom_wcnss_iris.o +obj-$(CONFIG_RCAR_REMOTEPROC) += rcar_rproc.o obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c new file mode 100644 index 000000000000..34fd867f9f8c --- /dev/null +++ b/drivers/remoteproc/rcar_rproc.c @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) IoT.bzh 2021 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "remoteproc_internal.h" + +struct rcar_rproc { + struct reset_control *rst; +}; + +static int rcar_rproc_mem_alloc(struct rproc *rproc, + struct rproc_mem_entry *mem) +{ + struct device *dev = &rproc->dev; + void *va; + + dev_dbg(dev, "map memory: %pa+%zx\n", &mem->dma, mem->len); + va = ioremap_wc(mem->dma, mem->len); + if (!va) { + dev_err(dev, "Unable to map memory region: %pa+%zx\n", + &mem->dma, mem->len); + return -ENOMEM; + } + + /* Update memory entry va */ + mem->va = va; + + return 0; +} + +static int rcar_rproc_mem_release(struct rproc *rproc, + struct rproc_mem_entry *mem) +{ + dev_dbg(&rproc->dev, "unmap memory: %pa\n", &mem->dma); + iounmap(mem->va); + + return 0; +} + +static int rcar_rproc_prepare(struct rproc *rproc) +{ + struct device *dev = rproc->dev.parent; + struct device_node *np = dev->of_node; + struct of_phandle_iterator it; + struct rproc_mem_entry *mem; + struct reserved_mem *rmem; + u32 da; + + /* Register associated reserved memory regions */ + of_phandle_iterator_init(&it, np, "memory-region", NULL, 0); + while (of_phandle_iterator_next(&it) == 0) { + + rmem = of_reserved_mem_lookup(it.node); + if (!rmem) { + dev_err(&rproc->dev, + "unable to acquire memory-region\n"); + return -EINVAL; + } + + if (rmem->base > U32_MAX) + return -EINVAL; + + /* No need to translate pa to da, R-Car use same map */ + da = rmem->base; + mem = rproc_mem_entry_init(dev, NULL, + rmem->base, + rmem->size, da, + rcar_rproc_mem_alloc, + rcar_rproc_mem_release, + it.node->name); + + if (!mem) + return -ENOMEM; + + rproc_add_carveout(rproc, mem); + } + + return 0; +} + +static int rcar_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) +{ + int ret; + + ret = rproc_elf_load_rsc_table(rproc, fw); + if (ret) + dev_info(&rproc->dev, "No resource table in elf\n"); + + return 0; +} + +static int rcar_rproc_start(struct rproc *rproc) +{ + struct rcar_rproc *priv = rproc->priv; + int err; + + if (!rproc->bootaddr) + return -EINVAL; + + err = rcar_rst_set_rproc_boot_addr(rproc->bootaddr); + if (err) { + dev_err(&rproc->dev, "failed to set rproc boot addr\n"); + return err; + } + + err = reset_control_deassert(priv->rst); + if (err) + dev_err(&rproc->dev, "failed to deassert reset\n"); + + return err; +} + +static int rcar_rproc_stop(struct rproc *rproc) +{ + struct rcar_rproc *priv = rproc->priv; + int err; + + err = reset_control_assert(priv->rst); + if (err) + dev_err(&rproc->dev, "failed to assert reset\n"); + + return err; +} + +static struct rproc_ops rcar_rproc_ops = { + .prepare = rcar_rproc_prepare, + .start = rcar_rproc_start, + .stop = rcar_rproc_stop, + .load = rproc_elf_load_segments, + .parse_fw = rcar_rproc_parse_fw, + .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, + .sanity_check = rproc_elf_sanity_check, + .get_boot_addr = rproc_elf_get_boot_addr, + +}; + +static int rcar_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct rcar_rproc *priv; + struct rproc *rproc; + int ret; + + rproc = devm_rproc_alloc(dev, np->name, &rcar_rproc_ops, + NULL, sizeof(*priv)); + if (!rproc) + return -ENOMEM; + + priv = rproc->priv; + + priv->rst = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(priv->rst)) { + ret = PTR_ERR(priv->rst); + dev_err_probe(dev, ret, "fail to acquire rproc reset\n"); + return ret;; + } + + pm_runtime_enable(dev); + ret = pm_runtime_get_sync(dev); + if (ret) { + dev_err(dev, "failed to power up\n"); + return ret; + } + + dev_set_drvdata(dev, rproc); + + /* Manually start the rproc */ + rproc->auto_boot = false; + + ret = devm_rproc_add(dev, rproc); + if (ret) { + dev_err(dev, "rproc_add failed\n"); + goto pm_disable; + } + + return 0; + +pm_disable: + pm_runtime_disable(dev); + + return ret; +} + +static int rcar_rproc_remove(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + + pm_runtime_disable(dev); + + return 0; +} + +static const struct of_device_id rcar_rproc_of_match[] = { + { .compatible = "renesas,rcar-cr7" }, + {}, +}; + +MODULE_DEVICE_TABLE(of, rcar_rproc_of_match); + +static struct platform_driver rcar_rproc_driver = { + .probe = rcar_rproc_probe, + .remove = rcar_rproc_remove, + .driver = { + .name = "rcar-rproc", + .of_match_table = rcar_rproc_of_match, + }, +}; + +module_platform_driver(rcar_rproc_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Renesas R-Car Gen3 remote processor control driver"); +MODULE_AUTHOR("Julien Massot "); -- cgit From fdc12231d885119cc2e2b4f3e0fbba3155f37a56 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Tue, 16 Nov 2021 22:54:54 -0800 Subject: remoteproc: qcom: pil_info: Don't memcpy_toio more than is provided If the string passed into qcom_pil_info_store() isn't as long as PIL_RELOC_NAME_LEN we'll try to copy the string assuming the length is PIL_RELOC_NAME_LEN to the io space and go beyond the bounds of the string. Let's only copy as many byes as the string is long, ignoring the NUL terminator. This fixes the following KASAN error: BUG: KASAN: global-out-of-bounds in __memcpy_toio+0x124/0x140 Read of size 1 at addr ffffffd35086e386 by task rmtfs/2392 CPU: 2 PID: 2392 Comm: rmtfs Tainted: G W 5.16.0-rc1-lockdep+ #10 Hardware name: Google Lazor (rev3+) with KB Backlight (DT) Call trace: dump_backtrace+0x0/0x410 show_stack+0x24/0x30 dump_stack_lvl+0x7c/0xa0 print_address_description+0x78/0x2bc kasan_report+0x160/0x1a0 __asan_report_load1_noabort+0x44/0x50 __memcpy_toio+0x124/0x140 qcom_pil_info_store+0x298/0x358 [qcom_pil_info] q6v5_start+0xdf0/0x12e0 [qcom_q6v5_mss] rproc_start+0x178/0x3a0 rproc_boot+0x5f0/0xb90 state_store+0x78/0x1bc dev_attr_store+0x70/0x90 sysfs_kf_write+0xf4/0x118 kernfs_fop_write_iter+0x208/0x300 vfs_write+0x55c/0x804 ksys_pwrite64+0xc8/0x134 __arm64_compat_sys_aarch32_pwrite64+0xc4/0xdc invoke_syscall+0x78/0x20c el0_svc_common+0x11c/0x1f0 do_el0_svc_compat+0x50/0x60 el0_svc_compat+0x5c/0xec el0t_32_sync_handler+0xc0/0xf0 el0t_32_sync+0x1a4/0x1a8 The buggy address belongs to the variable: .str.59+0x6/0xffffffffffffec80 [qcom_q6v5_mss] Memory state around the buggy address: ffffffd35086e280: 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 ffffffd35086e300: 00 02 f9 f9 f9 f9 f9 f9 00 00 00 06 f9 f9 f9 f9 >ffffffd35086e380: 06 f9 f9 f9 05 f9 f9 f9 00 00 00 00 00 06 f9 f9 ^ ffffffd35086e400: f9 f9 f9 f9 01 f9 f9 f9 04 f9 f9 f9 00 00 01 f9 ffffffd35086e480: f9 f9 f9 f9 00 00 00 00 00 00 00 01 f9 f9 f9 f9 Fixes: 549b67da660d ("remoteproc: qcom: Introduce helper to store pil info in IMEM") Signed-off-by: Stephen Boyd Reviewed-by: Bjorn Andersson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211117065454.4142936-1-swboyd@chromium.org --- drivers/remoteproc/qcom_pil_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c index 7c007dd7b200..aca21560e20b 100644 --- a/drivers/remoteproc/qcom_pil_info.c +++ b/drivers/remoteproc/qcom_pil_info.c @@ -104,7 +104,7 @@ int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size) return -ENOMEM; found_unused: - memcpy_toio(entry, image, PIL_RELOC_NAME_LEN); + memcpy_toio(entry, image, strnlen(image, PIL_RELOC_NAME_LEN)); found_existing: /* Use two writel() as base is only aligned to 4 bytes on odd entries */ writel(base, entry + PIL_RELOC_NAME_LEN); -- cgit From da87976921bba27199ee4df94081ac10fa0cf76f Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Wed, 2 Jun 2021 14:42:06 +0800 Subject: remoteproc: imx_rproc: correct firmware reload ENABLE_M4 should be set to 1 when loading code to TCM, otherwise you will not able to replace the firmware after you stop m4. Besides ENABLE_M4, we still need set SW_M4C_RST, because this bit will be automatically set with SW_M4C_NON_SCLR_RST set. Reviewed-by: Mathieu Poirier Signed-off-by: Peng Fan Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20210602064206.27004-1-peng.fan@oss.nxp.com --- drivers/remoteproc/imx_rproc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 0a45bc0d3f73..7a096f1891e6 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -34,7 +34,8 @@ #define IMX7D_M4_START (IMX7D_ENABLE_M4 | IMX7D_SW_M4P_RST \ | IMX7D_SW_M4C_RST) -#define IMX7D_M4_STOP IMX7D_SW_M4C_NON_SCLR_RST +#define IMX7D_M4_STOP (IMX7D_ENABLE_M4 | IMX7D_SW_M4C_RST | \ + IMX7D_SW_M4C_NON_SCLR_RST) /* Address: 0x020D8000 */ #define IMX6SX_SRC_SCR 0x00 @@ -45,7 +46,8 @@ #define IMX6SX_M4_START (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \ | IMX6SX_SW_M4C_RST) -#define IMX6SX_M4_STOP IMX6SX_SW_M4C_NON_SCLR_RST +#define IMX6SX_M4_STOP (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4C_RST | \ + IMX6SX_SW_M4C_NON_SCLR_RST) #define IMX6SX_M4_RST_MASK (IMX6SX_ENABLE_M4 | IMX6SX_SW_M4P_RST \ | IMX6SX_SW_M4C_NON_SCLR_RST \ | IMX6SX_SW_M4C_RST) @@ -684,7 +686,7 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv) return ret; } - if (!(val & dcfg->src_stop)) + if ((val & dcfg->src_mask) != dcfg->src_stop) priv->rproc->state = RPROC_DETACHED; return 0; -- cgit From dd585d9bfbf06fd08a6326c82978be1f06e7d1bd Mon Sep 17 00:00:00 2001 From: Sibi Sankar Date: Fri, 25 Jun 2021 00:03:25 +0530 Subject: remoteproc: qcom: pas: Add missing power-domain "mxc" for CDSP Add missing power-domain "mxc" required by CDSP PAS remoteproc on SM8350 SoC. Fixes: e8b4e9a21af7 ("remoteproc: qcom: pas: Add SM8350 PAS remoteprocs") Signed-off-by: Sibi Sankar Cc: stable@vger.kernel.org Tested-by: Bjorn Andersson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1624559605-29847-1-git-send-email-sibis@codeaurora.org --- drivers/remoteproc/qcom_q6v5_pas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 03857dc9cdc1..120c16b14223 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -652,6 +652,7 @@ static const struct adsp_data sm8350_cdsp_resource = { .auto_boot = true, .proxy_pd_names = (char*[]){ "cx", + "mxc", NULL }, .load_state = "cdsp", -- cgit From a15d36f04b9e118ef5c37782a91bd1f52877f65c Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Mon, 13 Dec 2021 09:22:01 +0100 Subject: dt-bindings: remoteproc: qcom: pas: Add SM6350 adsp, cdsp & mpss Add compatibles for the remoteprocs found in SM6350. Signed-off-by: Luca Weiss Acked-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211213082208.21492-2-luca.weiss@fairphone.com --- .../devicetree/bindings/remoteproc/qcom,adsp.yaml | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml index 63e06d93bca3..c635c181d2c2 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml @@ -33,6 +33,9 @@ properties: - qcom,sdm845-adsp-pas - qcom,sdm845-cdsp-pas - qcom,sdx55-mpss-pas + - qcom,sm6350-adsp-pas + - qcom,sm6350-cdsp-pas + - qcom,sm6350-mpss-pas - qcom,sm8150-adsp-pas - qcom,sm8150-cdsp-pas - qcom,sm8150-mpss-pas @@ -158,6 +161,9 @@ allOf: - qcom,sc8180x-mpss-pas - qcom,sdm845-adsp-pas - qcom,sdm845-cdsp-pas + - qcom,sm6350-adsp-pas + - qcom,sm6350-cdsp-pas + - qcom,sm6350-mpss-pas - qcom,sm8150-adsp-pas - qcom,sm8150-cdsp-pas - qcom,sm8150-mpss-pas @@ -266,6 +272,8 @@ allOf: - qcom,sc8180x-cdsp-pas - qcom,sdm845-adsp-pas - qcom,sdm845-cdsp-pas + - qcom,sm6350-adsp-pas + - qcom,sm6350-cdsp-pas - qcom,sm8150-adsp-pas - qcom,sm8150-cdsp-pas - qcom,sm8150-slpi-pas @@ -301,6 +309,7 @@ allOf: - qcom,sc7280-mpss-pas - qcom,sc8180x-mpss-pas - qcom,sdx55-mpss-pas + - qcom,sm6350-mpss-pas - qcom,sm8150-mpss-pas - qcom,sm8350-mpss-pas then: @@ -385,6 +394,23 @@ allOf: - const: mx - const: mss + - if: + properties: + compatible: + contains: + enum: + - qcom,sm6350-cdsp-pas + then: + properties: + power-domains: + items: + - description: CX power domain + - description: MX power domain + power-domain-names: + items: + - const: cx + - const: mx + - if: properties: compatible: @@ -405,6 +431,7 @@ allOf: enum: - qcom,sc7280-mpss-pas - qcom,sdx55-mpss-pas + - qcom,sm6350-mpss-pas - qcom,sm8150-mpss-pas - qcom,sm8350-mpss-pas then: @@ -425,6 +452,7 @@ allOf: enum: - qcom,sc8180x-adsp-pas - qcom,sc8180x-cdsp-pas + - qcom,sm6350-adsp-pas - qcom,sm8150-slpi-pas - qcom,sm8250-adsp-pas - qcom,sm8250-slpi-pas -- cgit From 42a3f554d81ede895e12fd9d22a112beaf3cbb2e Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Mon, 13 Dec 2021 09:22:02 +0100 Subject: remoteproc: qcom: pas: Add SM6350 MPSS support Add a config for the MPSS present on SM6350. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211213082208.21492-3-luca.weiss@fairphone.com --- drivers/remoteproc/qcom_q6v5_pas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 120c16b14223..3b1236502eb3 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -805,6 +805,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init}, { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, + { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init}, -- cgit From bfd75aefe32c63608c210227c662ba65541b8376 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Mon, 13 Dec 2021 09:22:04 +0100 Subject: remoteproc: qcom: pas: Add SM6350 ADSP support Add a config for the ADSP present on SM6350. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211213082208.21492-5-luca.weiss@fairphone.com --- drivers/remoteproc/qcom_q6v5_pas.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 3b1236502eb3..3be6b943c1fd 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -524,6 +524,23 @@ static const struct adsp_data sdm845_adsp_resource_init = { .ssctl_id = 0x14, }; +static const struct adsp_data sm6350_adsp_resource = { + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .has_aggre2_clk = false, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "lcx", + "lmx", + NULL + }, + .load_state = "adsp", + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, +}; + static const struct adsp_data sm8150_adsp_resource = { .crash_reason_smem = 423, .firmware_name = "adsp.mdt", @@ -805,6 +822,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sdm845-adsp-pas", .data = &sdm845_adsp_resource_init}, { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, + { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource}, { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, -- cgit From 3bc0d1f9ef54cc3500898796b150078e6918ee21 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Mon, 13 Dec 2021 09:22:06 +0100 Subject: remoteproc: qcom: pas: Add SM6350 CDSP support Add a config for the CDSP present on SM6350. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211213082208.21492-7-luca.weiss@fairphone.com --- drivers/remoteproc/qcom_q6v5_pas.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 3be6b943c1fd..184bb7cdf95a 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -629,6 +629,23 @@ static const struct adsp_data sdm845_cdsp_resource_init = { .ssctl_id = 0x17, }; +static const struct adsp_data sm6350_cdsp_resource = { + .crash_reason_smem = 601, + .firmware_name = "cdsp.mdt", + .pas_id = 18, + .has_aggre2_clk = false, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "cx", + "mx", + NULL + }, + .load_state = "cdsp", + .ssr_name = "cdsp", + .sysmon_name = "cdsp", + .ssctl_id = 0x17, +}; + static const struct adsp_data sm8150_cdsp_resource = { .crash_reason_smem = 601, .firmware_name = "cdsp.mdt", @@ -823,6 +840,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource}, + { .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource}, { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, -- cgit From b0229605b1436438f24d9a97d8ecf220e0ea5900 Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Thu, 16 Dec 2021 17:06:53 +0100 Subject: remoteproc: rcar_rproc: Fix pm_runtime_get_sync error check pm_runtime_get_sync can also return 1 on success, change to use pm_runtime_resume_and_get which return 0 only on success. This bug has been discovered by Dan Carpenter by using Smatch static checker. Fixes: 285892a74f13 ("remoteproc: Add Renesas rcar driver") Signed-off-by: Julien Massot Reviewed-by: Geert Uytterhoeven [Fixed blank line between tags] Link: https://lore.kernel.org/r/20211216160653.203768-1-julien.massot@iot.bzh Signed-off-by: Mathieu Poirier --- drivers/remoteproc/rcar_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c index 34fd867f9f8c..3408c6e51a7c 100644 --- a/drivers/remoteproc/rcar_rproc.c +++ b/drivers/remoteproc/rcar_rproc.c @@ -167,7 +167,7 @@ static int rcar_rproc_probe(struct platform_device *pdev) } pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret) { dev_err(dev, "failed to power up\n"); return ret; -- cgit From ba635863779871a4f873511199f3e0ae84d5e592 Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Thu, 16 Dec 2021 17:07:21 +0100 Subject: remoteproc: rcar_rproc: Remove trailing semicolon Remove trailing semicolon. Signed-off-by: Julien Massot Link: https://lore.kernel.org/r/20211216160721.203794-1-julien.massot@iot.bzh Reviewed-by: Geert Uytterhoeven Signed-off-by: Mathieu Poirier --- drivers/remoteproc/rcar_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/rcar_rproc.c b/drivers/remoteproc/rcar_rproc.c index 3408c6e51a7c..aa86154109c7 100644 --- a/drivers/remoteproc/rcar_rproc.c +++ b/drivers/remoteproc/rcar_rproc.c @@ -163,7 +163,7 @@ static int rcar_rproc_probe(struct platform_device *pdev) if (IS_ERR(priv->rst)) { ret = PTR_ERR(priv->rst); dev_err_probe(dev, ret, "fail to acquire rproc reset\n"); - return ret;; + return ret; } pm_runtime_enable(dev); -- cgit From cfcabbb24d5f4e52ce2e7797cbcfacd8fe932fb6 Mon Sep 17 00:00:00 2001 From: Arnaud Pouliquen Date: Tue, 21 Dec 2021 15:31:29 +0100 Subject: remoteproc: stm32: Improve crash recovery time When a stop is requested on a crash, it is useless to try to shutdown it gracefully, it is crashed. In this case don't send the STM32_MBX_SHUTDOWN mailbox message that will block the recovery during 500 ms, waiting an answer from the coprocessor. Signed-off-by: Arnaud Pouliquen Link: https://lore.kernel.org/r/20211221143129.18415-1-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier --- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index b643efcf995a..7d782ed9e589 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -494,7 +494,7 @@ static int stm32_rproc_stop(struct rproc *rproc) int err, idx; /* request shutdown of the remote processor */ - if (rproc->state != RPROC_OFFLINE) { + if (rproc->state != RPROC_OFFLINE && rproc->state != RPROC_CRASHED) { idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN); if (idx >= 0 && ddata->mb[idx].chan) { err = mbox_send_message(ddata->mb[idx].chan, "detach"); -- cgit