Skip to content

Commit 2bfc50c

Browse files
committed
Merge tag 'rproc-v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux
Pull remoteproc updates from Bjorn Andersson: - Fix a memory remapping issue and make a few life-cycle improvements in the i.MX HiFi remoteproc driver - Add support the System Manager CPU and LMM APIs and use this to support i.MX95 - Rework the handling of the Mediatek SCP clock to avoid a potential circular deadlock in the clock providers - Refactor the Qualcomm secure-world helpers and add support in the Qualcomm PAS remoteproc driver for reading a resource-table from secure world. Use this to configure the IOMMU on newer targets where Linux runs in EL2 * tag 'rproc-v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: remoteproc: imx_rproc: Fix invalid loaded resource table detection remoteproc: mediatek: Break lock dependency to `prepare_lock` remoteproc: imx_rproc: Add support for i.MX95 remoteproc: imx_rproc: Add support for System Manager CPU API remoteproc: imx_rproc: Add support for System Manager LMM API remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg remoteproc: imx_rproc: Add runtime ops copy to support dynamic behavior dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 dt-bindings: remoteproc: Add HSM M4F core on TI K3 SoCs remoteproc: xlnx_r5: Simplify with scoped for each OF child loop remoteproc: mtk_scp: Simplify with scoped for each OF child loop remoteproc: imx_dsp_rproc: Only reset carveout memory at RPROC_OFFLINE state dt-bindings: remoteproc: qcom,sm8550-pas: Drop SM8750 ADSP from if-branch dt-bindings: remoteproc: qcom,adsp: Allow cx-supply on qcom,sdm845-slpi-pas remoteproc: imx_dsp_rproc: Fix multiple start/stop operations remoteproc: imx_rproc: Use strstarts for "rsc-table" check remoteproc: imx_dsp_rproc: Wait for suspend ACK only if WAIT_FW_CONFIRMATION is set remoteproc: imx_dsp_rproc: Rename macro to reflect multiple contexts remoteproc: imx_dsp_rproc: Skip RP_MBOX_SUSPEND_SYSTEM when mailbox TX channel is uninitialized dt-bindings: remoteproc: Fix dead link to Keystone DSP GPIO binding
2 parents f0a475a + 26aa529 commit 2bfc50c

12 files changed

Lines changed: 423 additions & 73 deletions

File tree

Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ properties:
2828
- fsl,imx8qxp-cm4
2929
- fsl,imx8ulp-cm33
3030
- fsl,imx93-cm33
31+
- fsl,imx95-cm7
3132

3233
clocks:
3334
maxItems: 1

Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ properties:
3232
reg:
3333
maxItems: 1
3434

35+
cx-supply: true
36+
3537
px-supply:
3638
description: Phandle to the PX regulator
3739

@@ -159,6 +161,9 @@ allOf:
159161
items:
160162
- const: lcx
161163
- const: lmx
164+
else:
165+
properties:
166+
cx-supply: false
162167

163168
- if:
164169
properties:

Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ allOf:
187187
enum:
188188
- qcom,sm8550-adsp-pas
189189
- qcom,sm8650-adsp-pas
190-
- qcom,sm8750-adsp-pas
191190
- qcom,x1e80100-adsp-pas
192191
then:
193192
properties:
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/remoteproc/ti,hsm-m4fss.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: TI K3 HSM M4F processor subsystems
8+
9+
maintainers:
10+
- Beleswar Padhi <b-padhi@ti.com>
11+
12+
description: |
13+
Some K3 family SoCs have a HSM (High Security Module) M4F core in the
14+
Wakeup Voltage Domain which could be used to run secure services like
15+
Authentication. Some of those are J721S2, J784S4, J722S, AM62X.
16+
17+
$ref: /schemas/arm/keystone/ti,k3-sci-common.yaml#
18+
19+
properties:
20+
compatible:
21+
enum:
22+
- ti,hsm-m4fss
23+
24+
reg:
25+
items:
26+
- description: SRAM0_0 internal memory region
27+
- description: SRAM0_1 internal memory region
28+
- description: SRAM1 internal memory region
29+
30+
reg-names:
31+
items:
32+
- const: sram0_0
33+
- const: sram0_1
34+
- const: sram1
35+
36+
resets:
37+
maxItems: 1
38+
39+
firmware-name:
40+
maxItems: 1
41+
42+
required:
43+
- compatible
44+
- reg
45+
- reg-names
46+
- resets
47+
- firmware-name
48+
- ti,sci
49+
- ti,sci-dev-id
50+
- ti,sci-proc-ids
51+
52+
unevaluatedProperties: false
53+
54+
examples:
55+
- |
56+
soc {
57+
#address-cells = <2>;
58+
#size-cells = <2>;
59+
60+
remoteproc@43c00000 {
61+
compatible = "ti,hsm-m4fss";
62+
reg = <0x00 0x43c00000 0x00 0x20000>,
63+
<0x00 0x43c20000 0x00 0x10000>,
64+
<0x00 0x43c30000 0x00 0x10000>;
65+
reg-names = "sram0_0", "sram0_1", "sram1";
66+
resets = <&k3_reset 225 1>;
67+
firmware-name = "hsm.bin";
68+
ti,sci = <&sms>;
69+
ti,sci-dev-id = <225>;
70+
ti,sci-proc-ids = <0x80 0xff>;
71+
};
72+
};

Documentation/devicetree/bindings/remoteproc/ti,keystone-rproc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The following are the mandatory properties:
6666
- kick-gpios: Should specify the gpio device needed for the virtio IPC
6767
stack. This will be used to interrupt the remote processor.
6868
The gpio device to be used is as per the bindings in,
69-
Documentation/devicetree/bindings/gpio/gpio-dsp-keystone.txt
69+
Documentation/devicetree/bindings/gpio/ti,keystone-dsp-gpio.yaml
7070

7171
SoC-specific Required properties:
7272
---------------------------------

drivers/remoteproc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ config IMX_REMOTEPROC
2727
tristate "i.MX remoteproc support"
2828
depends on ARCH_MXC
2929
depends on HAVE_ARM_SMCCC
30+
depends on IMX_SCMI_CPU_DRV || !IMX_SCMI_CPU_DRV
31+
depends on IMX_SCMI_LMM_DRV || !IMX_SCMI_LMM_DRV
3032
select MAILBOX
3133
help
3234
Say y here to support iMX's remote processors via the remote

drivers/remoteproc/imx_dsp_rproc.c

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ MODULE_PARM_DESC(no_mailboxes,
3838

3939
/* Flag indicating that the remote is up and running */
4040
#define REMOTE_IS_READY BIT(0)
41-
/* Flag indicating that the host should wait for a firmware-ready response */
42-
#define WAIT_FW_READY BIT(1)
41+
/* Flag indicating that the host should wait for a firmware-confirmation response */
42+
#define WAIT_FW_CONFIRMATION BIT(1)
4343
#define REMOTE_READY_WAIT_MAX_RETRIES 500
4444

4545
/*
4646
* This flag is set in the DSP resource table's features field to indicate
47-
* that the firmware requires the host NOT to wait for a FW_READY response.
47+
* that the firmware requires the host NOT to wait for a FW_CONFIRMATION response.
4848
*/
49-
#define FEATURE_DONT_WAIT_FW_READY BIT(0)
49+
#define FEATURE_SKIP_FW_CONFIRMATION BIT(0)
5050

5151
/* att flags */
5252
/* DSP own area */
@@ -287,7 +287,7 @@ static int imx_dsp_rproc_ready(struct rproc *rproc)
287287
* @avail: available space in the resource table
288288
*
289289
* Parse the DSP-specific resource entry and update flags accordingly.
290-
* If the WAIT_FW_READY feature is set, the host must wait for the firmware
290+
* If the WAIT_FW_CONFIRMATION feature is set, the host must wait for the firmware
291291
* to signal readiness before proceeding with execution.
292292
*
293293
* Return: RSC_HANDLED if processed successfully, RSC_IGNORED otherwise.
@@ -322,7 +322,7 @@ static int imx_dsp_rproc_handle_rsc(struct rproc *rproc, u32 rsc_type,
322322

323323
/*
324324
* For now, in struct fw_rsc_imx_dsp, version 0,
325-
* only FEATURE_DONT_WAIT_FW_READY is valid.
325+
* only FEATURE_SKIP_FW_CONFIRMATION is valid.
326326
*
327327
* When adding new features, please upgrade version.
328328
*/
@@ -332,8 +332,8 @@ static int imx_dsp_rproc_handle_rsc(struct rproc *rproc, u32 rsc_type,
332332
return RSC_IGNORED;
333333
}
334334

335-
if (imx_dsp_rsc->features & FEATURE_DONT_WAIT_FW_READY)
336-
priv->flags &= ~WAIT_FW_READY;
335+
if (imx_dsp_rsc->features & FEATURE_SKIP_FW_CONFIRMATION)
336+
priv->flags &= ~WAIT_FW_CONFIRMATION;
337337

338338
return RSC_HANDLED;
339339
}
@@ -385,7 +385,7 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
385385
return ret;
386386
}
387387

388-
if (priv->flags & WAIT_FW_READY)
388+
if (priv->flags & WAIT_FW_CONFIRMATION)
389389
return imx_dsp_rproc_ready(rproc);
390390

391391
return 0;
@@ -644,6 +644,32 @@ static void imx_dsp_rproc_free_mbox(struct imx_dsp_rproc *priv)
644644
mbox_free_channel(priv->rxdb_ch);
645645
}
646646

647+
static int imx_dsp_rproc_mem_alloc(struct rproc *rproc,
648+
struct rproc_mem_entry *mem)
649+
{
650+
struct device *dev = rproc->dev.parent;
651+
void *va;
652+
653+
va = ioremap_wc(mem->dma, mem->len);
654+
if (!va) {
655+
dev_err(dev, "Unable to map memory region: %pa+%zx\n",
656+
&mem->dma, mem->len);
657+
return -ENOMEM;
658+
}
659+
660+
mem->va = va;
661+
662+
return 0;
663+
}
664+
665+
static int imx_dsp_rproc_mem_release(struct rproc *rproc,
666+
struct rproc_mem_entry *mem)
667+
{
668+
iounmap(mem->va);
669+
670+
return 0;
671+
}
672+
647673
/**
648674
* imx_dsp_rproc_add_carveout() - request mailbox channels
649675
* @priv: private data pointer
@@ -659,7 +685,6 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
659685
struct device *dev = rproc->dev.parent;
660686
struct device_node *np = dev->of_node;
661687
struct rproc_mem_entry *mem;
662-
void __iomem *cpu_addr;
663688
int a, i = 0;
664689
u64 da;
665690

@@ -673,15 +698,10 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
673698
if (imx_dsp_rproc_sys_to_da(priv, att->sa, att->size, &da))
674699
return -EINVAL;
675700

676-
cpu_addr = devm_ioremap_wc(dev, att->sa, att->size);
677-
if (!cpu_addr) {
678-
dev_err(dev, "failed to map memory %p\n", &att->sa);
679-
return -ENOMEM;
680-
}
681-
682701
/* Register memory region */
683-
mem = rproc_mem_entry_init(dev, (void __force *)cpu_addr, (dma_addr_t)att->sa,
684-
att->size, da, NULL, NULL, "dsp_mem");
702+
mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)att->sa,
703+
att->size, da, imx_dsp_rproc_mem_alloc,
704+
imx_dsp_rproc_mem_release, "dsp_mem");
685705

686706
if (mem)
687707
rproc_coredump_add_segment(rproc, da, att->size);
@@ -709,15 +729,11 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
709729
if (imx_dsp_rproc_sys_to_da(priv, res.start, resource_size(&res), &da))
710730
return -EINVAL;
711731

712-
cpu_addr = devm_ioremap_resource_wc(dev, &res);
713-
if (IS_ERR(cpu_addr)) {
714-
dev_err(dev, "failed to map memory %pR\n", &res);
715-
return PTR_ERR(cpu_addr);
716-
}
717-
718732
/* Register memory region */
719-
mem = rproc_mem_entry_init(dev, (void __force *)cpu_addr, (dma_addr_t)res.start,
720-
resource_size(&res), da, NULL, NULL,
733+
mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)res.start,
734+
resource_size(&res), da,
735+
imx_dsp_rproc_mem_alloc,
736+
imx_dsp_rproc_mem_release,
721737
"%.*s", strchrnul(res.name, '@') - res.name, res.name);
722738
if (!mem)
723739
return -ENOMEM;
@@ -984,9 +1000,11 @@ static int imx_dsp_rproc_load(struct rproc *rproc, const struct firmware *fw)
9841000
* Clear buffers after pm rumtime for internal ocram is not
9851001
* accessible if power and clock are not enabled.
9861002
*/
987-
list_for_each_entry(carveout, &rproc->carveouts, node) {
988-
if (carveout->va)
989-
memset(carveout->va, 0, carveout->len);
1003+
if (rproc->state == RPROC_OFFLINE) {
1004+
list_for_each_entry(carveout, &rproc->carveouts, node) {
1005+
if (carveout->va)
1006+
memset(carveout->va, 0, carveout->len);
1007+
}
9901008
}
9911009

9921010
ret = imx_dsp_rproc_elf_load_segments(rproc, fw);
@@ -1131,8 +1149,8 @@ static int imx_dsp_rproc_probe(struct platform_device *pdev)
11311149
priv = rproc->priv;
11321150
priv->rproc = rproc;
11331151
priv->dsp_dcfg = dsp_dcfg;
1134-
/* By default, host waits for fw_ready reply */
1135-
priv->flags |= WAIT_FW_READY;
1152+
/* By default, host waits for fw_confirmation reply */
1153+
priv->flags |= WAIT_FW_CONFIRMATION;
11361154

11371155
if (no_mailboxes)
11381156
imx_dsp_rproc_mbox_init = imx_dsp_rproc_mbox_no_alloc;
@@ -1242,6 +1260,21 @@ static int imx_dsp_suspend(struct device *dev)
12421260
if (rproc->state != RPROC_RUNNING)
12431261
goto out;
12441262

1263+
/*
1264+
* No channel available for sending messages;
1265+
* indicates no mailboxes present, so trigger PM runtime suspend
1266+
*/
1267+
if (!priv->tx_ch) {
1268+
dev_dbg(dev, "No initialized mbox tx channel, suspend directly.\n");
1269+
goto out;
1270+
}
1271+
1272+
/* No fw confirmation expected, so trigger PM runtime suspend */
1273+
if (!(priv->flags & WAIT_FW_CONFIRMATION)) {
1274+
dev_dbg(dev, "No FW_CONFIRMATION needed, suspend directly.\n");
1275+
goto out;
1276+
}
1277+
12451278
reinit_completion(&priv->pm_comp);
12461279

12471280
/* Tell DSP that suspend is happening */

0 commit comments

Comments
 (0)