Skip to content

Commit f489f6c

Browse files
quic-qqzhouandersson
authored andcommitted
firmware: qcom: scm: Return -EOPNOTSUPP for unsupported SHM bridge enabling
When enabling SHM bridge, QTEE returns 0 and sets error 4 in result to qcom_scm for unsupported platforms. Currently, tzmem interprets this as an unknown error rather than recognizing it as an unsupported platform. Error log: [ 0.177224] qcom_scm firmware:scm: error (____ptrval____): Failed to enable the TrustZone memory allocator [ 0.177244] qcom_scm firmware:scm: probe with driver qcom_scm failed with error 4 To address this, modify the function call qcom_scm_shm_bridge_enable() to remap result to indicate an unsupported error. This way, tzmem will correctly identify it as an unsupported platform case instead of reporting it as an error. Fixes: 178e19c ("firmware: qcom: scm: add support for SHM bridge operations") Signed-off-by: Qingqing Zhou <[email protected]> Co-developed-by: Kuldeep Singh <[email protected]> Signed-off-by: Kuldeep Singh <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 0a97195 commit f489f6c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/firmware/qcom/qcom_scm.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ enum qcom_scm_qseecom_tz_cmd_info {
112112
};
113113

114114
#define QSEECOM_MAX_APP_NAME_SIZE 64
115+
#define SHMBRIDGE_RESULT_NOTSUPP 4
115116

116117
/* Each bit configures cold/warm boot address for one of the 4 CPUs */
117118
static const u8 qcom_scm_cpu_cold_bits[QCOM_SCM_BOOT_MAX_CPUS] = {
@@ -1361,6 +1362,8 @@ EXPORT_SYMBOL_GPL(qcom_scm_lmh_dcvsh_available);
13611362

13621363
int qcom_scm_shm_bridge_enable(void)
13631364
{
1365+
int ret;
1366+
13641367
struct qcom_scm_desc desc = {
13651368
.svc = QCOM_SCM_SVC_MP,
13661369
.cmd = QCOM_SCM_MP_SHM_BRIDGE_ENABLE,
@@ -1373,7 +1376,15 @@ int qcom_scm_shm_bridge_enable(void)
13731376
QCOM_SCM_MP_SHM_BRIDGE_ENABLE))
13741377
return -EOPNOTSUPP;
13751378

1376-
return qcom_scm_call(__scm->dev, &desc, &res) ?: res.result[0];
1379+
ret = qcom_scm_call(__scm->dev, &desc, &res);
1380+
1381+
if (ret)
1382+
return ret;
1383+
1384+
if (res.result[0] == SHMBRIDGE_RESULT_NOTSUPP)
1385+
return -EOPNOTSUPP;
1386+
1387+
return res.result[0];
13771388
}
13781389
EXPORT_SYMBOL_GPL(qcom_scm_shm_bridge_enable);
13791390

0 commit comments

Comments
 (0)