Skip to contentSkip to conversation

firmware: qcom: scm: Fix interrupted SCM calls fully

PATCH In review Sricharan R 2 participants 2 messages Sep 28, 2016 – Oct 26, 2016 Arm Qualcomm mailing list

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: qcom: scm: Fix interrupted SCM calls fully

Patch [1] fixes the issues with interrupted SCM64 calls
by returning the register r6 (Session ID) on the next try, but register r0 also needs to be preserved for the retry. r0 contains the result of the previous try. Without this i see that the SCM calls hang when retried.

[1] https://patchwork.kernel.org/patch/9291589/

---
 drivers/firmware/qcom_scm-64.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/firmware/qcom_scm-64.c +3 -0
index 7ecd0e7..28b604e 100755
@@ -134,6 +134,9 @@ static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id,
 		res->a6 = 0;
 
 		do {
+			if (res->a0 == QCOM_SCM_INTERRUPTED)
+				cmd = res->a0;
+
 			arm_smccc_smc(cmd, desc->arginfo, desc->args[0],
 				      desc->args[1], desc->args[2], x5, res->a6, 0,
 				      res);
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Sricharan R

Patch [1] fixes the issues with interrupted SCM64 calls
by returning the register r6 (Session ID) on the next try, but register r0 also needs to be preserved for the retry. r0 contains the result of the previous try. Without this i see that the SCM calls hang when retried.

[1] https://patchwork.kernel.org/patch/9291589/

Andy, this is needed as well on 8996 - or I get rcu stalls during firmware loading operations (so I guess it's busy spinning in that loop).

Regards,
Bjorn

Quoted 22 lines
---
 drivers/firmware/qcom_scm-64.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/firmware/qcom_scm-64.c +3 -0
index 7ecd0e7..28b604e 100755
@@ -134,6 +134,9 @@ static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id,
 		res->a6 = 0;
 
 		do {
+			if (res->a0 == QCOM_SCM_INTERRUPTED)
+				cmd = res->a0;
+
 			arm_smccc_smc(cmd, desc->arginfo, desc->args[0],
 				      desc->args[1], desc->args[2], x5, res->a6, 0,
 				      res);
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation