qcom_scm: Retry T-Base smc call when TZ is busy.

We cannot guarantee the Trustonic nq kthread is always uninterruptable,
atomic and SMP safe, so that we will send the command to the SCM and
wait for the command to finish processing from secure world in case
the QSEE might be busy at that point. This can be used in pre-emptible
context when the Trustonic fast call is invoked to run whereby the scm
handler happens to be owned by other threads.

Change-Id: I0aac105684c7b8b7bed7ab2146b8ef62dab42837
Signed-off-by: quebs2 <quebs2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1902496
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jefferson Rodrigo Capovilla <jeffecap@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
quebs2 2021-03-16 15:29:40 +08:00 • committed by Xiaojun Ji
commit 3d90262b58

View file

@ -2440,7 +2440,7 @@ int __trustonic_smc_fastcall(void *fc_generic, size_t size)
desc.args[3] = (u32)size;
desc.arginfo = QCOM_SCM_ARGS(4, QCOM_SCM_RW, QCOM_SCM_VAL, QCOM_SCM_RW, QCOM_SCM_VAL);
ret = qcom_scm_call_atomic(NULL, &desc);
ret = qcom_scm_call(NULL, &desc);
qtee_shmbridge_inv_shm_buf(&scm_shm);
memset(fc_generic, 0x00, size);
memcpy(fc_generic, scm_buf_va, size);