Skip to contentSkip to conversation

dt-bindings: soc: qcom: smp2p: document WCSS restart kick

PATCH New Robert Marko 2 participants 4 messages Nov 26

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dt-bindings: soc: qcom: smp2p: document WCSS restart kick

On IPQ8074 and IPQ6018, WCSS firmware waits for a new outbound doorbell after its inbound SMP2P entry returns to zero during a remoteproc restart. Without it, WCSS does not raise the ready indication on the next boot.

Document qcom,wcss-restart-kick for SMP2P links that require this additional doorbell.

---
 .../devicetree/bindings/soc/qcom/qcom,smp2p.yaml          | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.yaml +8 -0
index 7862d68c9678..5c90d9db8f73 100644
@@ -59,6 +59,14 @@ properties:
     description:
       Two identifiers of the inbound and outbound smem items used for this edge.
 
+  qcom,wcss-restart-kick:
+    type: boolean
+    description:
+      IPQ8074 and IPQ6018 WCSS firmware need another outgoing doorbell when
+      the inbound entry returns to zero during a remote processor restart.
+      Without this kick, WCSS does not raise the ready indication for the
+      next boot.
+
 patternProperties:
   "^master-kernel|slave-kernel|ipa-ap-to-modem|ipa-modem-to-ap|sleepstate|wlan-ap-to-wpss|wlan-wpss-to-ap$":
     type: object
Signature · 1 line
2.56.1
#1 lore raw

PATCH 2/3 soc: qcom: smp2p: kick WCSS after restart when requested

From: Ziyang Huang <[email protected]>

IPQ8074 and IPQ6018 WCSS need another outbound kick after a remoteproc restart. On IPQ8074, ath11k starts WCSS, stops it for coldboot calibration, and then starts it again. The first start succeeds, but the second times out waiting for the SMP2P ready indication.

The first start gets an outbound kick from qcom_smp2p_probe(). The SMP2P driver remains bound across the restart, so this kick is not repeated. WCSS waits for another kick before raising its inbound slave-kernel ready bit.

When the SSR ACK feature is negotiated, qcom_smp2p_check_ssr() resets last_value to zero before inbound entries are processed. If slave-kernel is also zero, qcom_smp2p_notify_in() sees no change and skips it. Kick the peer before the unchanged-value check when an inbound entry is zero.

Limit this behavior to WCSS links with qcom,wcss-restart-kick. Other SMP2P links do not need a kick for a zero inbound value.

---
 drivers/soc/qcom/smp2p.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/soc/qcom/smp2p.c +8 -0
index cf06a49149be..bf11b7d450a4 100644
@@ -128,6 +128,7 @@ struct smp2p_entry {
  * @ssr_ack_enabled: SMP2P_FEATURE_SSR_ACK feature is supported and was enabled
  * @ssr_ack: current cached state of the local ack bit
  * @negotiation_done: whether negotiating finished
+ * @wcss_restart_kick: kick WCSS when an inbound entry returns to zero
  * @local_pid:	processor id of the inbound edge
  * @remote_pid:	processor id of the outbound edge
  * @ipc_regmap:	regmap for the outbound ipc
@@ -151,6 +152,7 @@ struct qcom_smp2p {
 	bool ssr_ack_enabled;
 	bool ssr_ack;
 	bool negotiation_done;
+	bool wcss_restart_kick;
 
 	unsigned local_pid;
 	unsigned remote_pid;
@@ -341,6 +343,10 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
 
 		trace_smp2p_notify_in(entry, status, val);
 
+		/* Some WCSS firmware needs a kick after restarting. */
+		if (smp2p->wcss_restart_kick && val == 0)
+			qcom_smp2p_kick(smp2p);
+
 		/* No changes of this entry? */
 		if (!status)
 			continue;
@@ -681,6 +687,8 @@ static int qcom_smp2p_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	smp2p->dev = &pdev->dev;
+	smp2p->wcss_restart_kick =
+		of_property_read_bool(pdev->dev.of_node, "qcom,wcss-restart-kick");
 	INIT_LIST_HEAD(&smp2p->inbound);
 	INIT_LIST_HEAD(&smp2p->outbound);
 
Signature · 1 line
2.56.1
#2 lore raw

Re: [PATCH 2/3] soc: qcom: smp2p: kick WCSS after restart when requested

Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] soc: qcom: smp2p: interrupt storm in…

Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] soc: qcom: smp2p: interrupt storm in qcom_smp2p_check_ssr() [1] --

commit 4020c9b303d93a1d27eff1767bf735415220859a
Author: Ziyang Huang <[email protected]>

soc: qcom: smp2p: kick WCSS after restart when requested

This commit adds support for the qcom,wcss-restart-kick device-tree property to send an outbound kick in qcom_smp2p_notify_in() when an inbound entry reads as zero.

Quoted 4 lines
drivers/soc/qcom/smp2p.c +0 -0
index cf06a49149be1..bf11b7d450a43 100644

[ ... ]

drivers/soc/qcom/smp2p.c static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p) · line 352

Quoted 11 lines
drivers/soc/qcom/smp2p.c +4 -0
@@ -341,6 +343,10 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
 
 		trace_smp2p_notify_in(entry, status, val);
 
+		/* Some WCSS firmware needs a kick after restarting. */
+		if (smp2p->wcss_restart_kick && val == 0)
+			qcom_smp2p_kick(smp2p);
+
 		/* No changes of this entry? */
 		if (!status)
 			continue;

[Severity: High]
This problem wasn't introduced by this patch, but does qcom_smp2p_check_ssr() unconditionally reset entry->last_value to 0 on every interrupt when SSR ACK is enabled [1]?

drivers/soc/qcom/smp2p.c:qcom_smp2p_check_ssr() {
	...
	restart_done = in->flags & BIT(SMP2P_FLAGS_RESTART_DONE_BIT);
	restart = restart_done != smp2p->ssr_ack;
	list_for_each_entry(entry, &smp2p->inbound, node) {
		if (!entry->value)
			continue;
		entry->last_value = 0;
	}

	return restart;
}

Because the loop is not guarded by if (restart), qcom_smp2p_notify_in() computes status = val ^ 0 on every incoming notification and treats every currently asserted bit as a new rising edge, firing spurious nested interrupts.

[1] https://sashiko.dev/#/bug/linux-bc3d0c88-94cb-435f-b51e-d084030debce

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#3 lore raw

PATCH 3/3 arm64: dts: qcom: ipq8074: add WCSS SMP2P node

In reply to Robert Marko

Describe the SMP2P link between the application processor and WCSS. Provide the inbound interrupt channel and outbound state channel needed by the secure WCSS remote processor.

WCSS also needs an outbound kick after its inbound entry returns to zero during a restart. Enable the restart-kick property for this link.

---
 arch/arm64/boot/dts/qcom/ipq8074.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +21 -0
index 1d1c9aab5fdb..7842a2bc4175 100644
@@ -142,6 +142,27 @@ scm {
 		};
 	};
 
+	shared-memory {
+		compatible = "qcom,smp2p";
+		interrupts = <GIC_SPI 322 IRQ_TYPE_EDGE_RISING>;
+		mboxes = <&apcs_glb 9>;
+		qcom,local-pid = <0>;
+		qcom,remote-pid = <1>;
+		qcom,smem = <435>, <428>;
+		qcom,wcss-restart-kick;
+
+		wcss_smp2p_out: master-kernel {
+			qcom,entry-name = "master-kernel";
+			#qcom,smem-state-cells = <1>;
+		};
+
+		wcss_smp2p_in: slave-kernel {
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			qcom,entry-name = "slave-kernel";
+		};
+	};
+
 	soc: soc@0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
Signature · 1 line
2.56.1