Skip to content

Commit 3337a6f

Browse files
Kathiravan Thirumoorthyandersson
authored andcommitted
firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit
Per the "SMC calling convention specification", the 64-bit calling convention can only be used when the client is 64-bit. Whereas the 32-bit calling convention can be used by either a 32-bit or a 64-bit client. Currently during SCM probe, irrespective of the client, 64-bit calling convention is made, which is incorrect and may lead to the undefined behaviour when the client is 32-bit. Let's fix it. Cc: stable@vger.kernel.org Fixes: 9a434ce ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions") Reviewed-By: Elliot Berman <quic_eberman@quicinc.com> Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com> Link: https://lore.kernel.org/r/20230925-scm-v3-1-8790dff6a749@quicinc.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent f1a1bc8 commit 3337a6f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/firmware/qcom_scm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ static enum qcom_scm_convention __get_convention(void)
215215
if (likely(qcom_scm_convention != SMC_CONVENTION_UNKNOWN))
216216
return qcom_scm_convention;
217217

218+
/*
219+
* Per the "SMC calling convention specification", the 64-bit calling
220+
* convention can only be used when the client is 64-bit, otherwise
221+
* system will encounter the undefined behaviour.
222+
*/
223+
#if IS_ENABLED(CONFIG_ARM64)
218224
/*
219225
* Device isn't required as there is only one argument - no device
220226
* needed to dma_map_single to secure world
@@ -235,6 +241,7 @@ static enum qcom_scm_convention __get_convention(void)
235241
forced = true;
236242
goto found;
237243
}
244+
#endif
238245

239246
probed_convention = SMC_CONVENTION_ARM_32;
240247
ret = __scm_smc_call(NULL, &desc, probed_convention, &res, true);

0 commit comments

Comments
 (0)