Skip to content

Commit 9cf5b50

Browse files
committed
Merge tag 'rproc-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux
Pull remoteproc updates from Bjorn Andersson: "rproc-virtio device names are now auto generated, to avoid conflicts between remoteproc instances. The imx_rproc driver is extended with support for communicating with and attaching to a running M4 on i.MX8QXP, as well as support for attaching to the M4 after self-recovering from a crash. Support is added for i.MX8QM and mailbox channels are reconnected during the recovery process, in order to avoid data corruption. The Xilinx Zynqmp firmware interface is extended and support for the Xilinx R5 RPU is introduced. Various resources leaks, primarily in error paths, throughout the Qualcomm drivers are corrected. Lastly a fix to ensure that pm_relax is invoked even if the remoteproc instance is stopped between a crash is being reported and the recovery handler is scheduled" * tag 'rproc-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: (25 commits) remoteproc: core: Do pm_relax when in RPROC_OFFLINE state remoteproc: qcom: q6v5: Fix missing clk_disable_unprepare() in q6v5_wcss_qcs404_power_on() remoteproc: qcom_q6v5_pas: Fix missing of_node_put() in adsp_alloc_memory_region() remoteproc: qcom_q6v5_pas: detach power domains on remove remoteproc: qcom_q6v5_pas: disable wakeup on probe fail or remove remoteproc: qcom: q6v5: Fix potential null-ptr-deref in q6v5_wcss_init_mmio() remoteproc: sysmon: fix memory leak in qcom_add_sysmon_subdev() remoteproc: sysmon: Make QMI message rules const drivers: remoteproc: Add Xilinx r5 remoteproc driver firmware: xilinx: Add RPU configuration APIs firmware: xilinx: Add shutdown/wakeup APIs firmware: xilinx: Add ZynqMP firmware ioctl enums for RPU configuration. arm64: dts: xilinx: zynqmp: Add RPU subsystem device node dt-bindings: remoteproc: Add Xilinx RPU subsystem bindings remoteproc: core: Use device_match_of_node() remoteproc: imx_rproc: Correct i.MX93 DRAM mapping remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXP remoteproc: imx_rproc: Request mbox channel later remoteproc: imx_rproc: Support i.MX8QM remoteproc: imx_rproc: Support kicking Mcore from Linux for i.MX8QXP ...
2 parents f2855ee + 11c7f9e commit 9cf5b50

File tree

15 files changed

+1760
-20
lines changed

15 files changed

+1760
-20
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ properties:
2222
- fsl,imx8mn-cm7
2323
- fsl,imx8mp-cm7
2424
- fsl,imx8mq-cm4
25+
- fsl,imx8qm-cm4
26+
- fsl,imx8qxp-cm4
2527
- fsl,imx8ulp-cm33
2628
- fsl,imx93-cm33
2729

@@ -54,12 +56,26 @@ properties:
5456
minItems: 1
5557
maxItems: 32
5658

59+
power-domains:
60+
maxItems: 8
61+
5762
fsl,auto-boot:
5863
$ref: /schemas/types.yaml#/definitions/flag
5964
description:
6065
Indicate whether need to load the default firmware and start the remote
6166
processor automatically.
6267

68+
fsl,entry-address:
69+
$ref: /schemas/types.yaml#/definitions/uint32
70+
description:
71+
Specify CPU entry address for SCU enabled processor.
72+
73+
fsl,resource-id:
74+
$ref: /schemas/types.yaml#/definitions/uint32
75+
description:
76+
This property is to specify the resource id of the remote processor in SoC
77+
which supports SCFW
78+
6379
required:
6480
- compatible
6581

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/remoteproc/xlnx,zynqmp-r5fss.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Xilinx R5F processor subsystem
8+
9+
maintainers:
10+
- Ben Levinsky <[email protected]>
11+
- Tanmay Shah <[email protected]>
12+
13+
description: |
14+
The Xilinx platforms include a pair of Cortex-R5F processors (RPU) for
15+
real-time processing based on the Cortex-R5F processor core from ARM.
16+
The Cortex-R5F processor implements the Arm v7-R architecture and includes a
17+
floating-point unit that implements the Arm VFPv3 instruction set.
18+
19+
properties:
20+
compatible:
21+
const: xlnx,zynqmp-r5fss
22+
23+
xlnx,cluster-mode:
24+
$ref: /schemas/types.yaml#/definitions/uint32
25+
enum: [0, 1, 2]
26+
description: |
27+
The RPU MPCore can operate in split mode (Dual-processor performance), Safety
28+
lock-step mode(Both RPU cores execute the same code in lock-step,
29+
clock-for-clock) or Single CPU mode (RPU core 0 is held in reset while
30+
core 1 runs normally). The processor does not support dynamic configuration.
31+
Switching between modes is only permitted immediately after a processor reset.
32+
If set to 1 then lockstep mode and if 0 then split mode.
33+
If set to 2 then single CPU mode. When not defined, default will be lockstep mode.
34+
In summary,
35+
0: split mode
36+
1: lockstep mode (default)
37+
2: single cpu mode
38+
39+
patternProperties:
40+
"^r5f-[a-f0-9]+$":
41+
type: object
42+
description: |
43+
The RPU is located in the Low Power Domain of the Processor Subsystem.
44+
Each processor includes separate L1 instruction and data caches and
45+
tightly coupled memories (TCM). System memory is cacheable, but the TCM
46+
memory space is non-cacheable.
47+
48+
Each RPU contains one 64KB memory and two 32KB memories that
49+
are accessed via the TCM A and B port interfaces, for a total of 128KB
50+
per processor. In lock-step mode, the processor has access to 256KB of
51+
TCM memory.
52+
53+
properties:
54+
compatible:
55+
const: xlnx,zynqmp-r5f
56+
57+
power-domains:
58+
maxItems: 1
59+
60+
mboxes:
61+
minItems: 1
62+
items:
63+
- description: mailbox channel to send data to RPU
64+
- description: mailbox channel to receive data from RPU
65+
66+
mbox-names:
67+
minItems: 1
68+
items:
69+
- const: tx
70+
- const: rx
71+
72+
sram:
73+
$ref: /schemas/types.yaml#/definitions/phandle-array
74+
minItems: 1
75+
maxItems: 8
76+
items:
77+
maxItems: 1
78+
description: |
79+
phandles to one or more reserved on-chip SRAM regions. Other than TCM,
80+
the RPU can execute instructions and access data from the OCM memory,
81+
the main DDR memory, and other system memories.
82+
83+
The regions should be defined as child nodes of the respective SRAM
84+
node, and should be defined as per the generic bindings in
85+
Documentation/devicetree/bindings/sram/sram.yaml
86+
87+
memory-region:
88+
description: |
89+
List of phandles to the reserved memory regions associated with the
90+
remoteproc device. This is variable and describes the memories shared with
91+
the remote processor (e.g. remoteproc firmware and carveouts, rpmsg
92+
vrings, ...). This reserved memory region will be allocated in DDR memory.
93+
minItems: 1
94+
maxItems: 8
95+
items:
96+
- description: region used for RPU firmware image section
97+
- description: vdev buffer
98+
- description: vring0
99+
- description: vring1
100+
additionalItems: true
101+
102+
required:
103+
- compatible
104+
- power-domains
105+
106+
unevaluatedProperties: false
107+
108+
required:
109+
- compatible
110+
111+
additionalProperties: false
112+
113+
examples:
114+
- |
115+
remoteproc {
116+
compatible = "xlnx,zynqmp-r5fss";
117+
xlnx,cluster-mode = <1>;
118+
119+
r5f-0 {
120+
compatible = "xlnx,zynqmp-r5f";
121+
power-domains = <&zynqmp_firmware 0x7>;
122+
memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>;
123+
mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>;
124+
mbox-names = "tx", "rx";
125+
};
126+
127+
r5f-1 {
128+
compatible = "xlnx,zynqmp-r5f";
129+
power-domains = <&zynqmp_firmware 0x8>;
130+
memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, <&rpu1vdev0vring0>, <&rpu1vdev0vring1>;
131+
mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>;
132+
mbox-names = "tx", "rx";
133+
};
134+
};
135+
...

arch/arm64/boot/dts/xilinx/zynqmp.dtsi

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@
100100
};
101101
};
102102

103+
reserved-memory {
104+
#address-cells = <2>;
105+
#size-cells = <2>;
106+
ranges;
107+
108+
rproc_0_fw_image: memory@3ed00000 {
109+
no-map;
110+
reg = <0x0 0x3ed00000 0x0 0x40000>;
111+
};
112+
113+
rproc_1_fw_image: memory@3ef00000 {
114+
no-map;
115+
reg = <0x0 0x3ef00000 0x0 0x40000>;
116+
};
117+
};
118+
103119
zynqmp_ipi: zynqmp_ipi {
104120
compatible = "xlnx,zynqmp-ipi-mailbox";
105121
interrupt-parent = <&gic>;
@@ -203,6 +219,23 @@
203219
ranges;
204220
};
205221

222+
remoteproc {
223+
compatible = "xlnx,zynqmp-r5fss";
224+
xlnx,cluster-mode = <1>;
225+
226+
r5f-0 {
227+
compatible = "xlnx,zynqmp-r5f";
228+
power-domains = <&zynqmp_firmware PD_RPU_0>;
229+
memory-region = <&rproc_0_fw_image>;
230+
};
231+
232+
r5f-1 {
233+
compatible = "xlnx,zynqmp-r5f";
234+
power-domains = <&zynqmp_firmware PD_RPU_1>;
235+
memory-region = <&rproc_1_fw_image>;
236+
};
237+
};
238+
206239
amba: axi {
207240
compatible = "simple-bus";
208241
#address-cells = <2>;

drivers/firmware/xilinx/zynqmp.c

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,103 @@ int zynqmp_pm_release_node(const u32 node)
11661166
}
11671167
EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
11681168

1169+
/**
1170+
* zynqmp_pm_get_rpu_mode() - Get RPU mode
1171+
* @node_id: Node ID of the device
1172+
* @rpu_mode: return by reference value
1173+
* either split or lockstep
1174+
*
1175+
* Return: return 0 on success or error+reason.
1176+
* if success, then rpu_mode will be set
1177+
* to current rpu mode.
1178+
*/
1179+
int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode)
1180+
{
1181+
u32 ret_payload[PAYLOAD_ARG_CNT];
1182+
int ret;
1183+
1184+
ret = zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
1185+
IOCTL_GET_RPU_OPER_MODE, 0, 0, ret_payload);
1186+
1187+
/* only set rpu_mode if no error */
1188+
if (ret == XST_PM_SUCCESS)
1189+
*rpu_mode = ret_payload[0];
1190+
1191+
return ret;
1192+
}
1193+
EXPORT_SYMBOL_GPL(zynqmp_pm_get_rpu_mode);
1194+
1195+
/**
1196+
* zynqmp_pm_set_rpu_mode() - Set RPU mode
1197+
* @node_id: Node ID of the device
1198+
* @rpu_mode: Argument 1 to requested IOCTL call. either split or lockstep
1199+
*
1200+
* This function is used to set RPU mode to split or
1201+
* lockstep
1202+
*
1203+
* Return: Returns status, either success or error+reason
1204+
*/
1205+
int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
1206+
{
1207+
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
1208+
IOCTL_SET_RPU_OPER_MODE, (u32)rpu_mode,
1209+
0, NULL);
1210+
}
1211+
EXPORT_SYMBOL_GPL(zynqmp_pm_set_rpu_mode);
1212+
1213+
/**
1214+
* zynqmp_pm_set_tcm_config - configure TCM
1215+
* @node_id: Firmware specific TCM subsystem ID
1216+
* @tcm_mode: Argument 1 to requested IOCTL call
1217+
* either PM_RPU_TCM_COMB or PM_RPU_TCM_SPLIT
1218+
*
1219+
* This function is used to set RPU mode to split or combined
1220+
*
1221+
* Return: status: 0 for success, else failure
1222+
*/
1223+
int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
1224+
{
1225+
return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
1226+
IOCTL_TCM_COMB_CONFIG, (u32)tcm_mode, 0,
1227+
NULL);
1228+
}
1229+
EXPORT_SYMBOL_GPL(zynqmp_pm_set_tcm_config);
1230+
1231+
/**
1232+
* zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to
1233+
* be powered down forcefully
1234+
* @node: Node ID of the targeted PU or subsystem
1235+
* @ack: Flag to specify whether acknowledge is requested
1236+
*
1237+
* Return: status, either success or error+reason
1238+
*/
1239+
int zynqmp_pm_force_pwrdwn(const u32 node,
1240+
const enum zynqmp_pm_request_ack ack)
1241+
{
1242+
return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, node, ack, 0, 0, NULL);
1243+
}
1244+
EXPORT_SYMBOL_GPL(zynqmp_pm_force_pwrdwn);
1245+
1246+
/**
1247+
* zynqmp_pm_request_wake - PM call to wake up selected master or subsystem
1248+
* @node: Node ID of the master or subsystem
1249+
* @set_addr: Specifies whether the address argument is relevant
1250+
* @address: Address from which to resume when woken up
1251+
* @ack: Flag to specify whether acknowledge requested
1252+
*
1253+
* Return: status, either success or error+reason
1254+
*/
1255+
int zynqmp_pm_request_wake(const u32 node,
1256+
const bool set_addr,
1257+
const u64 address,
1258+
const enum zynqmp_pm_request_ack ack)
1259+
{
1260+
/* set_addr flag is encoded into 1st bit of address */
1261+
return zynqmp_pm_invoke_fn(PM_REQUEST_WAKEUP, node, address | set_addr,
1262+
address >> 32, ack, NULL);
1263+
}
1264+
EXPORT_SYMBOL_GPL(zynqmp_pm_request_wake);
1265+
11691266
/**
11701267
* zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
11711268
* @node: Node ID of the slave

drivers/remoteproc/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,19 @@ config TI_K3_R5_REMOTEPROC
352352
It's safe to say N here if you're not interested in utilizing
353353
a slave processor.
354354

355+
config XLNX_R5_REMOTEPROC
356+
tristate "Xilinx R5 remoteproc support"
357+
depends on PM && ARCH_ZYNQMP
358+
select ZYNQMP_FIRMWARE
359+
select RPMSG_VIRTIO
360+
select MAILBOX
361+
select ZYNQMP_IPI_MBOX
362+
help
363+
Say y or m here to support Xilinx R5 remote processors via the remote
364+
processor framework.
365+
366+
It's safe to say N if not interested in using RPU r5f cores.
367+
355368
endif # REMOTEPROC
356369

357370
endmenu

drivers/remoteproc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
3838
obj-$(CONFIG_STM32_RPROC) += stm32_rproc.o
3939
obj-$(CONFIG_TI_K3_DSP_REMOTEPROC) += ti_k3_dsp_remoteproc.o
4040
obj-$(CONFIG_TI_K3_R5_REMOTEPROC) += ti_k3_r5_remoteproc.o
41+
obj-$(CONFIG_XLNX_R5_REMOTEPROC) += xlnx_r5_remoteproc.o

drivers/remoteproc/imx_dsp_rproc.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,6 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
347347
struct device *dev = rproc->dev.parent;
348348
int ret = 0;
349349

350-
/* Make sure work is finished */
351-
flush_work(&priv->rproc_work);
352-
353350
if (rproc->state == RPROC_CRASHED) {
354351
priv->flags &= ~REMOTE_IS_READY;
355352
return 0;
@@ -432,9 +429,18 @@ static void imx_dsp_rproc_vq_work(struct work_struct *work)
432429
{
433430
struct imx_dsp_rproc *priv = container_of(work, struct imx_dsp_rproc,
434431
rproc_work);
432+
struct rproc *rproc = priv->rproc;
433+
434+
mutex_lock(&rproc->lock);
435+
436+
if (rproc->state != RPROC_RUNNING)
437+
goto unlock_mutex;
435438

436439
rproc_vq_interrupt(priv->rproc, 0);
437440
rproc_vq_interrupt(priv->rproc, 1);
441+
442+
unlock_mutex:
443+
mutex_unlock(&rproc->lock);
438444
}
439445

440446
/**

0 commit comments

Comments
 (0)