optee.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2019-2021 Linaro Ltd.
  4. */
  5. #include <linux/io.h>
  6. #include <linux/of.h>
  7. #include <linux/of_address.h>
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <linux/mutex.h>
  11. #include <linux/slab.h>
  12. #include <linux/tee_drv.h>
  13. #include <linux/uuid.h>
  14. #include <uapi/linux/tee.h>
  15. #include "common.h"
  16. #define SCMI_OPTEE_MAX_MSG_SIZE 128
  17. enum scmi_optee_pta_cmd {
  18. /*
  19. * PTA_SCMI_CMD_CAPABILITIES - Get channel capabilities
  20. *
  21. * [out] value[0].a: Capability bit mask (enum pta_scmi_caps)
  22. * [out] value[0].b: Extended capabilities or 0
  23. */
  24. PTA_SCMI_CMD_CAPABILITIES = 0,
  25. /*
  26. * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL - Process SCMI message in SMT buffer
  27. *
  28. * [in] value[0].a: Channel handle
  29. *
  30. * Shared memory used for SCMI message/response exhange is expected
  31. * already identified and bound to channel handle in both SCMI agent
  32. * and SCMI server (OP-TEE) parts.
  33. * The memory uses SMT header to carry SCMI meta-data (protocol ID and
  34. * protocol message ID).
  35. */
  36. PTA_SCMI_CMD_PROCESS_SMT_CHANNEL = 1,
  37. /*
  38. * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE - Process SMT/SCMI message
  39. *
  40. * [in] value[0].a: Channel handle
  41. * [in/out] memref[1]: Message/response buffer (SMT and SCMI payload)
  42. *
  43. * Shared memory used for SCMI message/response is a SMT buffer
  44. * referenced by param[1]. It shall be 128 bytes large to fit response
  45. * payload whatever message playload size.
  46. * The memory uses SMT header to carry SCMI meta-data (protocol ID and
  47. * protocol message ID).
  48. */
  49. PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE = 2,
  50. /*
  51. * PTA_SCMI_CMD_GET_CHANNEL - Get channel handle
  52. *
  53. * SCMI shm information are 0 if agent expects to use OP-TEE regular SHM
  54. *
  55. * [in] value[0].a: Channel identifier
  56. * [out] value[0].a: Returned channel handle
  57. * [in] value[0].b: Requested capabilities mask (enum pta_scmi_caps)
  58. */
  59. PTA_SCMI_CMD_GET_CHANNEL = 3,
  60. /*
  61. * PTA_SCMI_CMD_PROCESS_MSG_CHANNEL - Process SCMI message in a MSG
  62. * buffer pointed by memref parameters
  63. *
  64. * [in] value[0].a: Channel handle
  65. * [in] memref[1]: Message buffer (MSG and SCMI payload)
  66. * [out] memref[2]: Response buffer (MSG and SCMI payload)
  67. *
  68. * Shared memories used for SCMI message/response are MSG buffers
  69. * referenced by param[1] and param[2]. MSG transport protocol
  70. * uses a 32bit header to carry SCMI meta-data (protocol ID and
  71. * protocol message ID) followed by the effective SCMI message
  72. * payload.
  73. */
  74. PTA_SCMI_CMD_PROCESS_MSG_CHANNEL = 4,
  75. };
  76. /*
  77. * OP-TEE SCMI service capabilities bit flags (32bit)
  78. *
  79. * PTA_SCMI_CAPS_SMT_HEADER
  80. * When set, OP-TEE supports command using SMT header protocol (SCMI shmem) in
  81. * shared memory buffers to carry SCMI protocol synchronisation information.
  82. *
  83. * PTA_SCMI_CAPS_MSG_HEADER
  84. * When set, OP-TEE supports command using MSG header protocol in an OP-TEE
  85. * shared memory to carry SCMI protocol synchronisation information and SCMI
  86. * message payload.
  87. */
  88. #define PTA_SCMI_CAPS_NONE 0
  89. #define PTA_SCMI_CAPS_SMT_HEADER BIT(0)
  90. #define PTA_SCMI_CAPS_MSG_HEADER BIT(1)
  91. #define PTA_SCMI_CAPS_MASK (PTA_SCMI_CAPS_SMT_HEADER | \
  92. PTA_SCMI_CAPS_MSG_HEADER)
  93. /**
  94. * struct scmi_optee_channel - Description of an OP-TEE SCMI channel
  95. *
  96. * @channel_id: OP-TEE channel ID used for this transport
  97. * @tee_session: TEE session identifier
  98. * @caps: OP-TEE SCMI channel capabilities
  99. * @rx_len: Response size
  100. * @mu: Mutex protection on channel access
  101. * @cinfo: SCMI channel information
  102. * @shmem: Virtual base address of the shared memory
  103. * @req: Shared memory protocol handle for SCMI request and synchronous response
  104. * @tee_shm: TEE shared memory handle @req or NULL if using IOMEM shmem
  105. * @link: Reference in agent's channel list
  106. */
  107. struct scmi_optee_channel {
  108. u32 channel_id;
  109. u32 tee_session;
  110. u32 caps;
  111. u32 rx_len;
  112. struct mutex mu;
  113. struct scmi_chan_info *cinfo;
  114. union {
  115. struct scmi_shared_mem __iomem *shmem;
  116. struct scmi_msg_payld *msg;
  117. } req;
  118. struct tee_shm *tee_shm;
  119. struct list_head link;
  120. };
  121. /**
  122. * struct scmi_optee_agent - OP-TEE transport private data
  123. *
  124. * @dev: Device used for communication with TEE
  125. * @tee_ctx: TEE context used for communication
  126. * @caps: Supported channel capabilities
  127. * @mu: Mutex for protection of @channel_list
  128. * @channel_list: List of all created channels for the agent
  129. */
  130. struct scmi_optee_agent {
  131. struct device *dev;
  132. struct tee_context *tee_ctx;
  133. u32 caps;
  134. struct mutex mu;
  135. struct list_head channel_list;
  136. };
  137. /* There can be only 1 SCMI service in OP-TEE we connect to */
  138. static struct scmi_optee_agent *scmi_optee_private;
  139. /* Forward reference to scmi_optee transport initialization */
  140. static int scmi_optee_init(void);
  141. /* Open a session toward SCMI OP-TEE service with REE_KERNEL identity */
  142. static int open_session(struct scmi_optee_agent *agent, u32 *tee_session)
  143. {
  144. struct device *dev = agent->dev;
  145. struct tee_client_device *scmi_pta = to_tee_client_device(dev);
  146. struct tee_ioctl_open_session_arg arg = { };
  147. int ret;
  148. memcpy(arg.uuid, scmi_pta->id.uuid.b, TEE_IOCTL_UUID_LEN);
  149. arg.clnt_login = TEE_IOCTL_LOGIN_REE_KERNEL;
  150. ret = tee_client_open_session(agent->tee_ctx, &arg, NULL);
  151. if (ret < 0 || arg.ret) {
  152. dev_err(dev, "Can't open tee session: %d / %#x\n", ret, arg.ret);
  153. return -EOPNOTSUPP;
  154. }
  155. *tee_session = arg.session;
  156. return 0;
  157. }
  158. static void close_session(struct scmi_optee_agent *agent, u32 tee_session)
  159. {
  160. tee_client_close_session(agent->tee_ctx, tee_session);
  161. }
  162. static int get_capabilities(struct scmi_optee_agent *agent)
  163. {
  164. struct tee_ioctl_invoke_arg arg = { };
  165. struct tee_param param[1] = { };
  166. u32 caps;
  167. u32 tee_session;
  168. int ret;
  169. ret = open_session(agent, &tee_session);
  170. if (ret)
  171. return ret;
  172. arg.func = PTA_SCMI_CMD_CAPABILITIES;
  173. arg.session = tee_session;
  174. arg.num_params = 1;
  175. param[0].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT;
  176. ret = tee_client_invoke_func(agent->tee_ctx, &arg, param);
  177. close_session(agent, tee_session);
  178. if (ret < 0 || arg.ret) {
  179. dev_err(agent->dev, "Can't get capabilities: %d / %#x\n", ret, arg.ret);
  180. return -EOPNOTSUPP;
  181. }
  182. caps = param[0].u.value.a;
  183. if (!(caps & (PTA_SCMI_CAPS_SMT_HEADER | PTA_SCMI_CAPS_MSG_HEADER))) {
  184. dev_err(agent->dev, "OP-TEE SCMI PTA doesn't support SMT and MSG\n");
  185. return -EOPNOTSUPP;
  186. }
  187. agent->caps = caps;
  188. return 0;
  189. }
  190. static int get_channel(struct scmi_optee_channel *channel)
  191. {
  192. struct device *dev = scmi_optee_private->dev;
  193. struct tee_ioctl_invoke_arg arg = { };
  194. struct tee_param param[1] = { };
  195. unsigned int caps = 0;
  196. int ret;
  197. if (channel->tee_shm)
  198. caps = PTA_SCMI_CAPS_MSG_HEADER;
  199. else
  200. caps = PTA_SCMI_CAPS_SMT_HEADER;
  201. arg.func = PTA_SCMI_CMD_GET_CHANNEL;
  202. arg.session = channel->tee_session;
  203. arg.num_params = 1;
  204. param[0].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT;
  205. param[0].u.value.a = channel->channel_id;
  206. param[0].u.value.b = caps;
  207. ret = tee_client_invoke_func(scmi_optee_private->tee_ctx, &arg, param);
  208. if (ret || arg.ret) {
  209. dev_err(dev, "Can't get channel with caps %#x: %d / %#x\n", caps, ret, arg.ret);
  210. return -EOPNOTSUPP;
  211. }
  212. /* From now on use channel identifer provided by OP-TEE SCMI service */
  213. channel->channel_id = param[0].u.value.a;
  214. channel->caps = caps;
  215. return 0;
  216. }
  217. static int invoke_process_smt_channel(struct scmi_optee_channel *channel)
  218. {
  219. struct tee_ioctl_invoke_arg arg = {
  220. .func = PTA_SCMI_CMD_PROCESS_SMT_CHANNEL,
  221. .session = channel->tee_session,
  222. .num_params = 1,
  223. };
  224. struct tee_param param[1] = { };
  225. int ret;
  226. param[0].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT;
  227. param[0].u.value.a = channel->channel_id;
  228. ret = tee_client_invoke_func(scmi_optee_private->tee_ctx, &arg, param);
  229. if (ret < 0 || arg.ret) {
  230. dev_err(scmi_optee_private->dev, "Can't invoke channel %u: %d / %#x\n",
  231. channel->channel_id, ret, arg.ret);
  232. return -EIO;
  233. }
  234. return 0;
  235. }
  236. static int invoke_process_msg_channel(struct scmi_optee_channel *channel, size_t msg_size)
  237. {
  238. struct tee_ioctl_invoke_arg arg = {
  239. .func = PTA_SCMI_CMD_PROCESS_MSG_CHANNEL,
  240. .session = channel->tee_session,
  241. .num_params = 3,
  242. };
  243. struct tee_param param[3] = { };
  244. int ret;
  245. param[0].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT;
  246. param[0].u.value.a = channel->channel_id;
  247. param[1].attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT;
  248. param[1].u.memref.shm = channel->tee_shm;
  249. param[1].u.memref.size = msg_size;
  250. param[2].attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT;
  251. param[2].u.memref.shm = channel->tee_shm;
  252. param[2].u.memref.size = SCMI_OPTEE_MAX_MSG_SIZE;
  253. ret = tee_client_invoke_func(scmi_optee_private->tee_ctx, &arg, param);
  254. if (ret < 0 || arg.ret) {
  255. dev_err(scmi_optee_private->dev, "Can't invoke channel %u: %d / %#x\n",
  256. channel->channel_id, ret, arg.ret);
  257. return -EIO;
  258. }
  259. /* Save response size */
  260. channel->rx_len = param[2].u.memref.size;
  261. return 0;
  262. }
  263. static int scmi_optee_link_supplier(struct device *dev)
  264. {
  265. if (!scmi_optee_private) {
  266. if (scmi_optee_init())
  267. dev_dbg(dev, "Optee bus not yet ready\n");
  268. /* Wait for optee bus */
  269. return -EPROBE_DEFER;
  270. }
  271. if (!device_link_add(dev, scmi_optee_private->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) {
  272. dev_err(dev, "Adding link to supplier optee device failed\n");
  273. return -ECANCELED;
  274. }
  275. return 0;
  276. }
  277. static bool scmi_optee_chan_available(struct device *dev, int idx)
  278. {
  279. u32 channel_id;
  280. return !of_property_read_u32_index(dev->of_node, "linaro,optee-channel-id",
  281. idx, &channel_id);
  282. }
  283. static void scmi_optee_clear_channel(struct scmi_chan_info *cinfo)
  284. {
  285. struct scmi_optee_channel *channel = cinfo->transport_info;
  286. if (!channel->tee_shm)
  287. shmem_clear_channel(channel->req.shmem);
  288. }
  289. static int setup_dynamic_shmem(struct device *dev, struct scmi_optee_channel *channel)
  290. {
  291. const size_t msg_size = SCMI_OPTEE_MAX_MSG_SIZE;
  292. void *shbuf;
  293. channel->tee_shm = tee_shm_alloc_kernel_buf(scmi_optee_private->tee_ctx, msg_size);
  294. if (IS_ERR(channel->tee_shm)) {
  295. dev_err(channel->cinfo->dev, "shmem allocation failed\n");
  296. return -ENOMEM;
  297. }
  298. shbuf = tee_shm_get_va(channel->tee_shm, 0);
  299. memset(shbuf, 0, msg_size);
  300. channel->req.msg = shbuf;
  301. channel->rx_len = msg_size;
  302. return 0;
  303. }
  304. static int setup_static_shmem(struct device *dev, struct scmi_chan_info *cinfo,
  305. struct scmi_optee_channel *channel)
  306. {
  307. struct device_node *np;
  308. resource_size_t size;
  309. struct resource res;
  310. int ret;
  311. np = of_parse_phandle(cinfo->dev->of_node, "shmem", 0);
  312. if (!of_device_is_compatible(np, "arm,scmi-shmem")) {
  313. ret = -ENXIO;
  314. goto out;
  315. }
  316. ret = of_address_to_resource(np, 0, &res);
  317. if (ret) {
  318. dev_err(dev, "Failed to get SCMI Tx shared memory\n");
  319. goto out;
  320. }
  321. size = resource_size(&res);
  322. channel->req.shmem = devm_ioremap(dev, res.start, size);
  323. if (!channel->req.shmem) {
  324. dev_err(dev, "Failed to ioremap SCMI Tx shared memory\n");
  325. ret = -EADDRNOTAVAIL;
  326. goto out;
  327. }
  328. ret = 0;
  329. out:
  330. of_node_put(np);
  331. return ret;
  332. }
  333. static int setup_shmem(struct device *dev, struct scmi_chan_info *cinfo,
  334. struct scmi_optee_channel *channel)
  335. {
  336. if (of_find_property(cinfo->dev->of_node, "shmem", NULL))
  337. return setup_static_shmem(dev, cinfo, channel);
  338. else
  339. return setup_dynamic_shmem(dev, channel);
  340. }
  341. static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, bool tx)
  342. {
  343. struct scmi_optee_channel *channel;
  344. uint32_t channel_id;
  345. int ret;
  346. if (!tx)
  347. return -ENODEV;
  348. channel = devm_kzalloc(dev, sizeof(*channel), GFP_KERNEL);
  349. if (!channel)
  350. return -ENOMEM;
  351. ret = of_property_read_u32_index(cinfo->dev->of_node, "linaro,optee-channel-id",
  352. 0, &channel_id);
  353. if (ret)
  354. return ret;
  355. cinfo->transport_info = channel;
  356. channel->cinfo = cinfo;
  357. channel->channel_id = channel_id;
  358. mutex_init(&channel->mu);
  359. ret = setup_shmem(dev, cinfo, channel);
  360. if (ret)
  361. return ret;
  362. ret = open_session(scmi_optee_private, &channel->tee_session);
  363. if (ret)
  364. goto err_free_shm;
  365. ret = get_channel(channel);
  366. if (ret)
  367. goto err_close_sess;
  368. /* Enable polling */
  369. cinfo->no_completion_irq = true;
  370. mutex_lock(&scmi_optee_private->mu);
  371. list_add(&channel->link, &scmi_optee_private->channel_list);
  372. mutex_unlock(&scmi_optee_private->mu);
  373. return 0;
  374. err_close_sess:
  375. close_session(scmi_optee_private, channel->tee_session);
  376. err_free_shm:
  377. if (channel->tee_shm)
  378. tee_shm_free(channel->tee_shm);
  379. return ret;
  380. }
  381. static int scmi_optee_chan_free(int id, void *p, void *data)
  382. {
  383. struct scmi_chan_info *cinfo = p;
  384. struct scmi_optee_channel *channel = cinfo->transport_info;
  385. mutex_lock(&scmi_optee_private->mu);
  386. list_del(&channel->link);
  387. mutex_unlock(&scmi_optee_private->mu);
  388. close_session(scmi_optee_private, channel->tee_session);
  389. if (channel->tee_shm) {
  390. tee_shm_free(channel->tee_shm);
  391. channel->tee_shm = NULL;
  392. }
  393. cinfo->transport_info = NULL;
  394. channel->cinfo = NULL;
  395. scmi_free_channel(cinfo, data, id);
  396. return 0;
  397. }
  398. static int scmi_optee_send_message(struct scmi_chan_info *cinfo,
  399. struct scmi_xfer *xfer)
  400. {
  401. struct scmi_optee_channel *channel = cinfo->transport_info;
  402. int ret;
  403. mutex_lock(&channel->mu);
  404. if (channel->tee_shm) {
  405. msg_tx_prepare(channel->req.msg, xfer);
  406. ret = invoke_process_msg_channel(channel, msg_command_size(xfer));
  407. } else {
  408. shmem_tx_prepare(channel->req.shmem, xfer, cinfo);
  409. ret = invoke_process_smt_channel(channel);
  410. }
  411. if (ret)
  412. mutex_unlock(&channel->mu);
  413. return ret;
  414. }
  415. static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo,
  416. struct scmi_xfer *xfer)
  417. {
  418. struct scmi_optee_channel *channel = cinfo->transport_info;
  419. if (channel->tee_shm)
  420. msg_fetch_response(channel->req.msg, channel->rx_len, xfer);
  421. else
  422. shmem_fetch_response(channel->req.shmem, xfer);
  423. }
  424. static void scmi_optee_mark_txdone(struct scmi_chan_info *cinfo, int ret,
  425. struct scmi_xfer *__unused)
  426. {
  427. struct scmi_optee_channel *channel = cinfo->transport_info;
  428. mutex_unlock(&channel->mu);
  429. }
  430. static struct scmi_transport_ops scmi_optee_ops = {
  431. .link_supplier = scmi_optee_link_supplier,
  432. .chan_available = scmi_optee_chan_available,
  433. .chan_setup = scmi_optee_chan_setup,
  434. .chan_free = scmi_optee_chan_free,
  435. .send_message = scmi_optee_send_message,
  436. .mark_txdone = scmi_optee_mark_txdone,
  437. .fetch_response = scmi_optee_fetch_response,
  438. .clear_channel = scmi_optee_clear_channel,
  439. };
  440. static int scmi_optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
  441. {
  442. return ver->impl_id == TEE_IMPL_ID_OPTEE;
  443. }
  444. static int scmi_optee_service_probe(struct device *dev)
  445. {
  446. struct scmi_optee_agent *agent;
  447. struct tee_context *tee_ctx;
  448. int ret;
  449. /* Only one SCMI OP-TEE device allowed */
  450. if (scmi_optee_private) {
  451. dev_err(dev, "An SCMI OP-TEE device was already initialized: only one allowed\n");
  452. return -EBUSY;
  453. }
  454. tee_ctx = tee_client_open_context(NULL, scmi_optee_ctx_match, NULL, NULL);
  455. if (IS_ERR(tee_ctx))
  456. return -ENODEV;
  457. agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL);
  458. if (!agent) {
  459. ret = -ENOMEM;
  460. goto err;
  461. }
  462. agent->dev = dev;
  463. agent->tee_ctx = tee_ctx;
  464. INIT_LIST_HEAD(&agent->channel_list);
  465. mutex_init(&agent->mu);
  466. ret = get_capabilities(agent);
  467. if (ret)
  468. goto err;
  469. /* Ensure agent resources are all visible before scmi_optee_private is */
  470. smp_mb();
  471. scmi_optee_private = agent;
  472. return 0;
  473. err:
  474. tee_client_close_context(tee_ctx);
  475. return ret;
  476. }
  477. static int scmi_optee_service_remove(struct device *dev)
  478. {
  479. struct scmi_optee_agent *agent = scmi_optee_private;
  480. if (!scmi_optee_private)
  481. return -EINVAL;
  482. if (!list_empty(&scmi_optee_private->channel_list))
  483. return -EBUSY;
  484. /* Ensure cleared reference is visible before resources are released */
  485. smp_store_mb(scmi_optee_private, NULL);
  486. tee_client_close_context(agent->tee_ctx);
  487. return 0;
  488. }
  489. static const struct tee_client_device_id scmi_optee_service_id[] = {
  490. {
  491. UUID_INIT(0xa8cfe406, 0xd4f5, 0x4a2e,
  492. 0x9f, 0x8d, 0xa2, 0x5d, 0xc7, 0x54, 0xc0, 0x99)
  493. },
  494. { }
  495. };
  496. MODULE_DEVICE_TABLE(tee, scmi_optee_service_id);
  497. static struct tee_client_driver scmi_optee_driver = {
  498. .id_table = scmi_optee_service_id,
  499. .driver = {
  500. .name = "scmi-optee",
  501. .bus = &tee_bus_type,
  502. .probe = scmi_optee_service_probe,
  503. .remove = scmi_optee_service_remove,
  504. },
  505. };
  506. static int scmi_optee_init(void)
  507. {
  508. return driver_register(&scmi_optee_driver.driver);
  509. }
  510. static void scmi_optee_exit(void)
  511. {
  512. if (scmi_optee_private)
  513. driver_unregister(&scmi_optee_driver.driver);
  514. }
  515. const struct scmi_desc scmi_optee_desc = {
  516. .transport_exit = scmi_optee_exit,
  517. .ops = &scmi_optee_ops,
  518. .max_rx_timeout_ms = 30,
  519. .max_msg = 20,
  520. .max_msg_size = SCMI_OPTEE_MAX_MSG_SIZE,
  521. .sync_cmds_completed_on_ret = true,
  522. };