core.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /*
  2. * Copyright (c) 2015, Linaro Limited
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  15. #include <linux/arm-smccc.h>
  16. #include <linux/errno.h>
  17. #include <linux/io.h>
  18. #include <linux/module.h>
  19. #include <linux/of.h>
  20. #include <linux/of_platform.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/slab.h>
  23. #include <linux/string.h>
  24. #include <linux/tee_drv.h>
  25. #include <linux/types.h>
  26. #include <linux/uaccess.h>
  27. #include "optee_private.h"
  28. #include "optee_smc.h"
  29. #define DRIVER_NAME "optee"
  30. #define OPTEE_SHM_NUM_PRIV_PAGES 1
  31. /**
  32. * optee_from_msg_param() - convert from OPTEE_MSG parameters to
  33. * struct tee_param
  34. * @params: subsystem internal parameter representation
  35. * @num_params: number of elements in the parameter arrays
  36. * @msg_params: OPTEE_MSG parameters
  37. * Returns 0 on success or <0 on failure
  38. */
  39. int optee_from_msg_param(struct tee_param *params, size_t num_params,
  40. const struct optee_msg_param *msg_params)
  41. {
  42. int rc;
  43. size_t n;
  44. struct tee_shm *shm;
  45. phys_addr_t pa;
  46. for (n = 0; n < num_params; n++) {
  47. struct tee_param *p = params + n;
  48. const struct optee_msg_param *mp = msg_params + n;
  49. u32 attr = mp->attr & OPTEE_MSG_ATTR_TYPE_MASK;
  50. switch (attr) {
  51. case OPTEE_MSG_ATTR_TYPE_NONE:
  52. p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
  53. memset(&p->u, 0, sizeof(p->u));
  54. break;
  55. case OPTEE_MSG_ATTR_TYPE_VALUE_INPUT:
  56. case OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT:
  57. case OPTEE_MSG_ATTR_TYPE_VALUE_INOUT:
  58. p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT +
  59. attr - OPTEE_MSG_ATTR_TYPE_VALUE_INPUT;
  60. p->u.value.a = mp->u.value.a;
  61. p->u.value.b = mp->u.value.b;
  62. p->u.value.c = mp->u.value.c;
  63. break;
  64. case OPTEE_MSG_ATTR_TYPE_TMEM_INPUT:
  65. case OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT:
  66. case OPTEE_MSG_ATTR_TYPE_TMEM_INOUT:
  67. p->attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT +
  68. attr - OPTEE_MSG_ATTR_TYPE_TMEM_INPUT;
  69. p->u.memref.size = mp->u.tmem.size;
  70. shm = (struct tee_shm *)(unsigned long)
  71. mp->u.tmem.shm_ref;
  72. if (!shm) {
  73. p->u.memref.shm_offs = 0;
  74. p->u.memref.shm = NULL;
  75. break;
  76. }
  77. rc = tee_shm_get_pa(shm, 0, &pa);
  78. if (rc)
  79. return rc;
  80. p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa;
  81. p->u.memref.shm = shm;
  82. /* Check that the memref is covered by the shm object */
  83. if (p->u.memref.size) {
  84. size_t o = p->u.memref.shm_offs +
  85. p->u.memref.size - 1;
  86. rc = tee_shm_get_pa(shm, o, NULL);
  87. if (rc)
  88. return rc;
  89. }
  90. break;
  91. default:
  92. return -EINVAL;
  93. }
  94. }
  95. return 0;
  96. }
  97. /**
  98. * optee_to_msg_param() - convert from struct tee_params to OPTEE_MSG parameters
  99. * @msg_params: OPTEE_MSG parameters
  100. * @num_params: number of elements in the parameter arrays
  101. * @params: subsystem itnernal parameter representation
  102. * Returns 0 on success or <0 on failure
  103. */
  104. int optee_to_msg_param(struct optee_msg_param *msg_params, size_t num_params,
  105. const struct tee_param *params)
  106. {
  107. int rc;
  108. size_t n;
  109. phys_addr_t pa;
  110. for (n = 0; n < num_params; n++) {
  111. const struct tee_param *p = params + n;
  112. struct optee_msg_param *mp = msg_params + n;
  113. switch (p->attr) {
  114. case TEE_IOCTL_PARAM_ATTR_TYPE_NONE:
  115. mp->attr = TEE_IOCTL_PARAM_ATTR_TYPE_NONE;
  116. memset(&mp->u, 0, sizeof(mp->u));
  117. break;
  118. case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT:
  119. case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT:
  120. case TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT:
  121. mp->attr = OPTEE_MSG_ATTR_TYPE_VALUE_INPUT + p->attr -
  122. TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT;
  123. mp->u.value.a = p->u.value.a;
  124. mp->u.value.b = p->u.value.b;
  125. mp->u.value.c = p->u.value.c;
  126. break;
  127. case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT:
  128. case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT:
  129. case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT:
  130. mp->attr = OPTEE_MSG_ATTR_TYPE_TMEM_INPUT +
  131. p->attr -
  132. TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
  133. mp->u.tmem.shm_ref = (unsigned long)p->u.memref.shm;
  134. mp->u.tmem.size = p->u.memref.size;
  135. if (!p->u.memref.shm) {
  136. mp->u.tmem.buf_ptr = 0;
  137. break;
  138. }
  139. rc = tee_shm_get_pa(p->u.memref.shm,
  140. p->u.memref.shm_offs, &pa);
  141. if (rc)
  142. return rc;
  143. mp->u.tmem.buf_ptr = pa;
  144. mp->attr |= OPTEE_MSG_ATTR_CACHE_PREDEFINED <<
  145. OPTEE_MSG_ATTR_CACHE_SHIFT;
  146. break;
  147. default:
  148. return -EINVAL;
  149. }
  150. }
  151. return 0;
  152. }
  153. static void optee_get_version(struct tee_device *teedev,
  154. struct tee_ioctl_version_data *vers)
  155. {
  156. struct tee_ioctl_version_data v = {
  157. .impl_id = TEE_IMPL_ID_OPTEE,
  158. .impl_caps = TEE_OPTEE_CAP_TZ,
  159. .gen_caps = TEE_GEN_CAP_GP,
  160. };
  161. *vers = v;
  162. }
  163. static int optee_open(struct tee_context *ctx)
  164. {
  165. struct optee_context_data *ctxdata;
  166. struct tee_device *teedev = ctx->teedev;
  167. struct optee *optee = tee_get_drvdata(teedev);
  168. ctxdata = kzalloc(sizeof(*ctxdata), GFP_KERNEL);
  169. if (!ctxdata)
  170. return -ENOMEM;
  171. if (teedev == optee->supp_teedev) {
  172. bool busy = true;
  173. mutex_lock(&optee->supp.ctx_mutex);
  174. if (!optee->supp.ctx) {
  175. busy = false;
  176. optee->supp.ctx = ctx;
  177. }
  178. mutex_unlock(&optee->supp.ctx_mutex);
  179. if (busy) {
  180. kfree(ctxdata);
  181. return -EBUSY;
  182. }
  183. }
  184. mutex_init(&ctxdata->mutex);
  185. INIT_LIST_HEAD(&ctxdata->sess_list);
  186. ctx->data = ctxdata;
  187. return 0;
  188. }
  189. static void optee_release(struct tee_context *ctx)
  190. {
  191. struct optee_context_data *ctxdata = ctx->data;
  192. struct tee_device *teedev = ctx->teedev;
  193. struct optee *optee = tee_get_drvdata(teedev);
  194. struct tee_shm *shm;
  195. struct optee_msg_arg *arg = NULL;
  196. phys_addr_t parg;
  197. struct optee_session *sess;
  198. struct optee_session *sess_tmp;
  199. if (!ctxdata)
  200. return;
  201. shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED);
  202. if (!IS_ERR(shm)) {
  203. arg = tee_shm_get_va(shm, 0);
  204. /*
  205. * If va2pa fails for some reason, we can't call into
  206. * secure world, only free the memory. Secure OS will leak
  207. * sessions and finally refuse more sessions, but we will
  208. * at least let normal world reclaim its memory.
  209. */
  210. if (!IS_ERR(arg))
  211. if (tee_shm_va2pa(shm, arg, &parg))
  212. arg = NULL; /* prevent usage of parg below */
  213. }
  214. list_for_each_entry_safe(sess, sess_tmp, &ctxdata->sess_list,
  215. list_node) {
  216. list_del(&sess->list_node);
  217. if (!IS_ERR_OR_NULL(arg)) {
  218. memset(arg, 0, sizeof(*arg));
  219. arg->cmd = OPTEE_MSG_CMD_CLOSE_SESSION;
  220. arg->session = sess->session_id;
  221. optee_do_call_with_arg(ctx, parg);
  222. }
  223. kfree(sess);
  224. }
  225. kfree(ctxdata);
  226. if (!IS_ERR(shm))
  227. tee_shm_free(shm);
  228. ctx->data = NULL;
  229. if (teedev == optee->supp_teedev) {
  230. mutex_lock(&optee->supp.ctx_mutex);
  231. optee->supp.ctx = NULL;
  232. mutex_unlock(&optee->supp.ctx_mutex);
  233. }
  234. }
  235. static const struct tee_driver_ops optee_ops = {
  236. .get_version = optee_get_version,
  237. .open = optee_open,
  238. .release = optee_release,
  239. .open_session = optee_open_session,
  240. .close_session = optee_close_session,
  241. .invoke_func = optee_invoke_func,
  242. .cancel_req = optee_cancel_req,
  243. };
  244. static const struct tee_desc optee_desc = {
  245. .name = DRIVER_NAME "-clnt",
  246. .ops = &optee_ops,
  247. .owner = THIS_MODULE,
  248. };
  249. static const struct tee_driver_ops optee_supp_ops = {
  250. .get_version = optee_get_version,
  251. .open = optee_open,
  252. .release = optee_release,
  253. .supp_recv = optee_supp_recv,
  254. .supp_send = optee_supp_send,
  255. };
  256. static const struct tee_desc optee_supp_desc = {
  257. .name = DRIVER_NAME "-supp",
  258. .ops = &optee_supp_ops,
  259. .owner = THIS_MODULE,
  260. .flags = TEE_DESC_PRIVILEGED,
  261. };
  262. static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
  263. {
  264. struct arm_smccc_res res;
  265. invoke_fn(OPTEE_SMC_CALLS_UID, 0, 0, 0, 0, 0, 0, 0, &res);
  266. if (res.a0 == OPTEE_MSG_UID_0 && res.a1 == OPTEE_MSG_UID_1 &&
  267. res.a2 == OPTEE_MSG_UID_2 && res.a3 == OPTEE_MSG_UID_3)
  268. return true;
  269. return false;
  270. }
  271. static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
  272. {
  273. union {
  274. struct arm_smccc_res smccc;
  275. struct optee_smc_calls_revision_result result;
  276. } res;
  277. invoke_fn(OPTEE_SMC_CALLS_REVISION, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
  278. if (res.result.major == OPTEE_MSG_REVISION_MAJOR &&
  279. (int)res.result.minor >= OPTEE_MSG_REVISION_MINOR)
  280. return true;
  281. return false;
  282. }
  283. static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn,
  284. u32 *sec_caps)
  285. {
  286. union {
  287. struct arm_smccc_res smccc;
  288. struct optee_smc_exchange_capabilities_result result;
  289. } res;
  290. u32 a1 = 0;
  291. /*
  292. * TODO This isn't enough to tell if it's UP system (from kernel
  293. * point of view) or not, is_smp() returns the the information
  294. * needed, but can't be called directly from here.
  295. */
  296. if (!IS_ENABLED(CONFIG_SMP) || nr_cpu_ids == 1)
  297. a1 |= OPTEE_SMC_NSEC_CAP_UNIPROCESSOR;
  298. invoke_fn(OPTEE_SMC_EXCHANGE_CAPABILITIES, a1, 0, 0, 0, 0, 0, 0,
  299. &res.smccc);
  300. if (res.result.status != OPTEE_SMC_RETURN_OK)
  301. return false;
  302. *sec_caps = res.result.capabilities;
  303. return true;
  304. }
  305. static struct tee_shm_pool *
  306. optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm)
  307. {
  308. union {
  309. struct arm_smccc_res smccc;
  310. struct optee_smc_get_shm_config_result result;
  311. } res;
  312. struct tee_shm_pool *pool;
  313. unsigned long vaddr;
  314. phys_addr_t paddr;
  315. size_t size;
  316. phys_addr_t begin;
  317. phys_addr_t end;
  318. void *va;
  319. struct tee_shm_pool_mem_info priv_info;
  320. struct tee_shm_pool_mem_info dmabuf_info;
  321. invoke_fn(OPTEE_SMC_GET_SHM_CONFIG, 0, 0, 0, 0, 0, 0, 0, &res.smccc);
  322. if (res.result.status != OPTEE_SMC_RETURN_OK) {
  323. pr_info("shm service not available\n");
  324. return ERR_PTR(-ENOENT);
  325. }
  326. if (res.result.settings != OPTEE_SMC_SHM_CACHED) {
  327. pr_err("only normal cached shared memory supported\n");
  328. return ERR_PTR(-EINVAL);
  329. }
  330. begin = roundup(res.result.start, PAGE_SIZE);
  331. end = rounddown(res.result.start + res.result.size, PAGE_SIZE);
  332. paddr = begin;
  333. size = end - begin;
  334. if (size < 2 * OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE) {
  335. pr_err("too small shared memory area\n");
  336. return ERR_PTR(-EINVAL);
  337. }
  338. va = memremap(paddr, size, MEMREMAP_WB);
  339. if (!va) {
  340. pr_err("shared memory ioremap failed\n");
  341. return ERR_PTR(-EINVAL);
  342. }
  343. vaddr = (unsigned long)va;
  344. priv_info.vaddr = vaddr;
  345. priv_info.paddr = paddr;
  346. priv_info.size = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
  347. dmabuf_info.vaddr = vaddr + OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
  348. dmabuf_info.paddr = paddr + OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
  349. dmabuf_info.size = size - OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE;
  350. pool = tee_shm_pool_alloc_res_mem(&priv_info, &dmabuf_info);
  351. if (IS_ERR(pool)) {
  352. memunmap(va);
  353. goto out;
  354. }
  355. *memremaped_shm = va;
  356. out:
  357. return pool;
  358. }
  359. /* Simple wrapper functions to be able to use a function pointer */
  360. static void optee_smccc_smc(unsigned long a0, unsigned long a1,
  361. unsigned long a2, unsigned long a3,
  362. unsigned long a4, unsigned long a5,
  363. unsigned long a6, unsigned long a7,
  364. struct arm_smccc_res *res)
  365. {
  366. arm_smccc_smc(a0, a1, a2, a3, a4, a5, a6, a7, res);
  367. }
  368. static void optee_smccc_hvc(unsigned long a0, unsigned long a1,
  369. unsigned long a2, unsigned long a3,
  370. unsigned long a4, unsigned long a5,
  371. unsigned long a6, unsigned long a7,
  372. struct arm_smccc_res *res)
  373. {
  374. arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res);
  375. }
  376. static optee_invoke_fn *get_invoke_func(struct device_node *np)
  377. {
  378. const char *method;
  379. pr_info("probing for conduit method from DT.\n");
  380. if (of_property_read_string(np, "method", &method)) {
  381. pr_warn("missing \"method\" property\n");
  382. return ERR_PTR(-ENXIO);
  383. }
  384. if (!strcmp("hvc", method))
  385. return optee_smccc_hvc;
  386. else if (!strcmp("smc", method))
  387. return optee_smccc_smc;
  388. pr_warn("invalid \"method\" property: %s\n", method);
  389. return ERR_PTR(-EINVAL);
  390. }
  391. static struct optee *optee_probe(struct device_node *np)
  392. {
  393. optee_invoke_fn *invoke_fn;
  394. struct tee_shm_pool *pool;
  395. struct optee *optee = NULL;
  396. void *memremaped_shm = NULL;
  397. struct tee_device *teedev;
  398. u32 sec_caps;
  399. int rc;
  400. invoke_fn = get_invoke_func(np);
  401. if (IS_ERR(invoke_fn))
  402. return (void *)invoke_fn;
  403. if (!optee_msg_api_uid_is_optee_api(invoke_fn)) {
  404. pr_warn("api uid mismatch\n");
  405. return ERR_PTR(-EINVAL);
  406. }
  407. if (!optee_msg_api_revision_is_compatible(invoke_fn)) {
  408. pr_warn("api revision mismatch\n");
  409. return ERR_PTR(-EINVAL);
  410. }
  411. if (!optee_msg_exchange_capabilities(invoke_fn, &sec_caps)) {
  412. pr_warn("capabilities mismatch\n");
  413. return ERR_PTR(-EINVAL);
  414. }
  415. /*
  416. * We have no other option for shared memory, if secure world
  417. * doesn't have any reserved memory we can use we can't continue.
  418. */
  419. if (!(sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM))
  420. return ERR_PTR(-EINVAL);
  421. pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm);
  422. if (IS_ERR(pool))
  423. return (void *)pool;
  424. optee = kzalloc(sizeof(*optee), GFP_KERNEL);
  425. if (!optee) {
  426. rc = -ENOMEM;
  427. goto err;
  428. }
  429. optee->invoke_fn = invoke_fn;
  430. teedev = tee_device_alloc(&optee_desc, NULL, pool, optee);
  431. if (IS_ERR(teedev)) {
  432. rc = PTR_ERR(teedev);
  433. goto err;
  434. }
  435. optee->teedev = teedev;
  436. teedev = tee_device_alloc(&optee_supp_desc, NULL, pool, optee);
  437. if (IS_ERR(teedev)) {
  438. rc = PTR_ERR(teedev);
  439. goto err;
  440. }
  441. optee->supp_teedev = teedev;
  442. rc = tee_device_register(optee->teedev);
  443. if (rc)
  444. goto err;
  445. rc = tee_device_register(optee->supp_teedev);
  446. if (rc)
  447. goto err;
  448. mutex_init(&optee->call_queue.mutex);
  449. INIT_LIST_HEAD(&optee->call_queue.waiters);
  450. optee_wait_queue_init(&optee->wait_queue);
  451. optee_supp_init(&optee->supp);
  452. optee->memremaped_shm = memremaped_shm;
  453. optee->pool = pool;
  454. optee_enable_shm_cache(optee);
  455. pr_info("initialized driver\n");
  456. return optee;
  457. err:
  458. if (optee) {
  459. /*
  460. * tee_device_unregister() is safe to call even if the
  461. * devices hasn't been registered with
  462. * tee_device_register() yet.
  463. */
  464. tee_device_unregister(optee->supp_teedev);
  465. tee_device_unregister(optee->teedev);
  466. kfree(optee);
  467. }
  468. if (pool)
  469. tee_shm_pool_free(pool);
  470. if (memremaped_shm)
  471. memunmap(memremaped_shm);
  472. return ERR_PTR(rc);
  473. }
  474. static void optee_remove(struct optee *optee)
  475. {
  476. /*
  477. * Ask OP-TEE to free all cached shared memory objects to decrease
  478. * reference counters and also avoid wild pointers in secure world
  479. * into the old shared memory range.
  480. */
  481. optee_disable_shm_cache(optee);
  482. /*
  483. * The two devices has to be unregistered before we can free the
  484. * other resources.
  485. */
  486. tee_device_unregister(optee->supp_teedev);
  487. tee_device_unregister(optee->teedev);
  488. tee_shm_pool_free(optee->pool);
  489. if (optee->memremaped_shm)
  490. memunmap(optee->memremaped_shm);
  491. optee_wait_queue_exit(&optee->wait_queue);
  492. optee_supp_uninit(&optee->supp);
  493. mutex_destroy(&optee->call_queue.mutex);
  494. kfree(optee);
  495. }
  496. static const struct of_device_id optee_match[] = {
  497. { .compatible = "linaro,optee-tz" },
  498. {},
  499. };
  500. static struct optee *optee_svc;
  501. static int __init optee_driver_init(void)
  502. {
  503. struct device_node *fw_np;
  504. struct device_node *np;
  505. struct optee *optee;
  506. /* Node is supposed to be below /firmware */
  507. fw_np = of_find_node_by_name(NULL, "firmware");
  508. if (!fw_np)
  509. return -ENODEV;
  510. np = of_find_matching_node(fw_np, optee_match);
  511. of_node_put(fw_np);
  512. if (!np)
  513. return -ENODEV;
  514. optee = optee_probe(np);
  515. of_node_put(np);
  516. if (IS_ERR(optee))
  517. return PTR_ERR(optee);
  518. optee_svc = optee;
  519. return 0;
  520. }
  521. module_init(optee_driver_init);
  522. static void __exit optee_driver_exit(void)
  523. {
  524. struct optee *optee = optee_svc;
  525. optee_svc = NULL;
  526. if (optee)
  527. optee_remove(optee);
  528. }
  529. module_exit(optee_driver_exit);
  530. MODULE_AUTHOR("Linaro");
  531. MODULE_DESCRIPTION("OP-TEE driver");
  532. MODULE_SUPPORTED_DEVICE("");
  533. MODULE_VERSION("1.0");
  534. MODULE_LICENSE("GPL v2");