firmware: qcom: scm: initialize tzmem before marking SCM as available
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 30 Jun 2025 12:12:04 +0000 (14:12 +0200)
committerBjorn Andersson <andersson@kernel.org>
Thu, 17 Jul 2025 03:50:55 +0000 (22:50 -0500)
commit87be3e7a2d0030cda6314d2ec96b37991f636ccd
treec3500178948621df462fecb78d9b46a385329e20
parentdc3f4e75c54c19bad9a70419afae00ce6baf3ebf
firmware: qcom: scm: initialize tzmem before marking SCM as available

Now that qcom_scm_shm_bridge_enable() uses the struct device passed to
it as argument to make the QCOM_SCM_MP_SHM_BRIDGE_ENABLE SCM call, we
can move the TZMem initialization before the assignment of the __scm
pointer in the SCM driver (which marks SCM as ready to users) thus
fixing the potential race between consumer calls and the memory pool
initialization.

Reported-by: Johan Hovold <johan+linaro@kernel.org>
Closes: https://lore.kernel.org/all/20250120151000.13870-1-johan+linaro@kernel.org/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250630-qcom-scm-race-v2-3-fa3851c98611@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/firmware/qcom/qcom_scm.c