static int tz_start(struct tee *tee) { struct tee_tz *ptee; int ret; BUG_ON(!tee || !tee->priv); dev_dbg(tee->dev, ">\n"); if (!CAPABLE(tee)) { dev_dbg(tee->dev, "< not capable\n"); return -EBUSY; } ptee = tee->priv; BUG_ON(ptee->started); ptee->started = true; ret = configure_shm(ptee); if (ret) goto exit; #ifdef CONFIG_OUTER_CACHE ret = register_outercache_mutex(ptee, true); if (ret) goto exit; #endif exit: if (ret) ptee->started = false; dev_dbg(tee->dev, "< ret=%d dev=%s\n", ret, tee->name); return ret; }
static int start_tz_world(void) { int ret; /* allow SMC call, mutex will prevent any other access */ mutex_lock(&g_mutex_teez); tee_tz_ready = true; /* Check that we're talking to the expected TEE */ if (!teesmc_api_uid_is_st() || !teesmc_os_uuid_is_optee()) { ret = -EINVAL; goto out; } ret = configure_shm(); if (ret) goto out; ret = register_l2cc_mutex(true); out: if (ret) tee_tz_ready = false; mutex_unlock(&g_mutex_teez); return ret; }