aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorAndy Gross <andy.gross@linaro.org>2017-04-04 15:32:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-12 06:41:21 -0400
commitbec9918bb4dae2099c37791133403c32aa2738c7 (patch)
tree8bda4c001768c2246736edbd2b833b1d236d6613 /drivers/firmware
parent007f0a2f2c0fcfa9ecef016c0910aebd0b784fdd (diff)
firmware: qcom: scm: Fix interrupted SCM calls
[ Upstream commit 82bcd087029f6056506ea929f11af02622230901 ] This patch adds a Qualcomm specific quirk to the arm_smccc_smc call. On Qualcomm ARM64 platforms, the SMC call can return before it has completed. If this occurs, the call can be restarted, but it requires using the returned session ID value from the interrupted SMC call. The quirk stores off the session ID from the interrupted call in the quirk structure so that it can be used by the caller. This patch folds in a fix given by Sricharan R: https://lkml.org/lkml/2016/9/28/272 Signed-off-by: Andy Gross <andy.gross@linaro.org> Reviewed-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/qcom_scm-64.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c
index 4a0f5ead4fb5..1e2e5198db53 100644
--- a/drivers/firmware/qcom_scm-64.c
+++ b/drivers/firmware/qcom_scm-64.c
@@ -91,6 +91,7 @@ static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id,
91 dma_addr_t args_phys = 0; 91 dma_addr_t args_phys = 0;
92 void *args_virt = NULL; 92 void *args_virt = NULL;
93 size_t alloc_len; 93 size_t alloc_len;
94 struct arm_smccc_quirk quirk = {.id = ARM_SMCCC_QUIRK_QCOM_A6};
94 95
95 if (unlikely(arglen > N_REGISTER_ARGS)) { 96 if (unlikely(arglen > N_REGISTER_ARGS)) {
96 alloc_len = N_EXT_QCOM_SCM_ARGS * sizeof(u64); 97 alloc_len = N_EXT_QCOM_SCM_ARGS * sizeof(u64);
@@ -131,10 +132,16 @@ static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id,
131 qcom_smccc_convention, 132 qcom_smccc_convention,
132 ARM_SMCCC_OWNER_SIP, fn_id); 133 ARM_SMCCC_OWNER_SIP, fn_id);
133 134
135 quirk.state.a6 = 0;
136
134 do { 137 do {
135 arm_smccc_smc(cmd, desc->arginfo, desc->args[0], 138 arm_smccc_smc_quirk(cmd, desc->arginfo, desc->args[0],
136 desc->args[1], desc->args[2], x5, 0, 0, 139 desc->args[1], desc->args[2], x5,
137 res); 140 quirk.state.a6, 0, res, &quirk);
141
142 if (res->a0 == QCOM_SCM_INTERRUPTED)
143 cmd = res->a0;
144
138 } while (res->a0 == QCOM_SCM_INTERRUPTED); 145 } while (res->a0 == QCOM_SCM_INTERRUPTED);
139 146
140 mutex_unlock(&qcom_scm_lock); 147 mutex_unlock(&qcom_scm_lock);