Hi Jan

I pinged Jens for some help with the OP-TEE path.

[...]

> --- a/drivers/tee/optee/rpmb.c
> +++ b/drivers/tee/optee/rpmb.c
> @@ -191,3 +191,23 @@ void optee_suppl_rpmb_release(struct udevice *dev)
>  {
>         release_mmc(dev_get_priv(dev));
>  }
> +
> +void optee_rpmb_available(void)
> +{
> +       struct udevice *dev;
> +       struct uclass *uc;
> +       u32 tee_sess;
> +
> +       uclass_id_foreach_dev(UCLASS_TEE, dev, uc) {
> +               if (strcmp(dev->driver->name, "optee") != 0 ||
> +                   !device_active(dev))
> +                       continue;
> +
> +               if (optee_open_enum_session(dev, &tee_sess) != 0)
> +                       continue;
> +
> +               optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);

so both optee_probe() and this function will now call
optee_bind_services(dev, tee_sess, PTA_CMD_GET_DEVICES_RPMB);.
In OP-TEE that ends up holding a mutex in tee_rpmb_reinit(), but I
don't know OP-TEE that well to figure out if this can deadlock.

Jens?

Cheers
/Ilias
> +
> +               tee_close_session(dev, tee_sess);
> +       }
> +}
> diff --git a/include/tee/optee.h b/include/tee/optee.h
> index d1194493780..755533b2c0b 100644
> --- a/include/tee/optee.h
> +++ b/include/tee/optee.h
> @@ -74,4 +74,10 @@ static inline bool is_optee_smc_api(void)
>  }
>  #endif
>
> +#if defined(CONFIG_OPTEE) && defined(CONFIG_SUPPORT_EMMC_RPMB)
> +void optee_rpmb_available(void);
> +#else
> +static inline void optee_rpmb_available(void) {}
> +#endif
> +
>  #endif /* _OPTEE_H */
> --
> 2.47.3
>

Reply via email to