Re: [PATCH 3/4] firmware: qcom: scm: initialize tzmem before marking SCM as available
From: Bartosz Golaszewski
Date: Wed Jun 25 2025 - 10:56:06 EST
On Wed, Jun 25, 2025 at 4:47 PM Konrad Dybcio
<konrad.dybcio@xxxxxxxxxxxxxxxx> wrote:
>
> On 6/25/25 10:14 AM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > 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.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> > ---
>
> I'm not sure any user of tzmem ever checks qcom_scm_is_available()
>
Well, they all should, right? At least the ICE and fastrpc drivers do
check this from a quick glance. Also: every call that has more than 4
arguments will be an implicit user of tzmem.
Bartosz