Lines Matching refs:channel

221 static int get_channel(struct scmi_optee_channel *channel)  in get_channel()  argument
229 if (channel->tee_shm) in get_channel()
235 arg.session = channel->tee_session; in get_channel()
239 param[0].u.value.a = channel->channel_id; in get_channel()
250 channel->channel_id = param[0].u.value.a; in get_channel()
251 channel->caps = caps; in get_channel()
256 static int invoke_process_smt_channel(struct scmi_optee_channel *channel) in invoke_process_smt_channel() argument
260 .session = channel->tee_session, in invoke_process_smt_channel()
267 param[0].u.value.a = channel->channel_id; in invoke_process_smt_channel()
272 channel->channel_id, ret, arg.ret); in invoke_process_smt_channel()
279 static int invoke_process_msg_channel(struct scmi_optee_channel *channel, size_t msg_size) in invoke_process_msg_channel() argument
283 .session = channel->tee_session, in invoke_process_msg_channel()
290 param[0].u.value.a = channel->channel_id; in invoke_process_msg_channel()
293 param[1].u.memref.shm = channel->tee_shm; in invoke_process_msg_channel()
297 param[2].u.memref.shm = channel->tee_shm; in invoke_process_msg_channel()
303 channel->channel_id, ret, arg.ret); in invoke_process_msg_channel()
308 channel->rx_len = param[2].u.memref.size; in invoke_process_msg_channel()
341 struct scmi_optee_channel *channel = cinfo->transport_info; in scmi_optee_clear_channel() local
343 if (!channel->tee_shm) in scmi_optee_clear_channel()
344 shmem_clear_channel(channel->req.shmem); in scmi_optee_clear_channel()
347 static int setup_dynamic_shmem(struct device *dev, struct scmi_optee_channel *channel) in setup_dynamic_shmem() argument
352 channel->tee_shm = tee_shm_alloc_kernel_buf(scmi_optee_private->tee_ctx, msg_size); in setup_dynamic_shmem()
353 if (IS_ERR(channel->tee_shm)) { in setup_dynamic_shmem()
354 dev_err(channel->cinfo->dev, "shmem allocation failed\n"); in setup_dynamic_shmem()
358 shbuf = tee_shm_get_va(channel->tee_shm, 0); in setup_dynamic_shmem()
360 channel->req.msg = shbuf; in setup_dynamic_shmem()
361 channel->rx_len = msg_size; in setup_dynamic_shmem()
367 struct scmi_optee_channel *channel) in setup_static_shmem() argument
388 channel->req.shmem = devm_ioremap(dev, res.start, size); in setup_static_shmem()
389 if (!channel->req.shmem) { in setup_static_shmem()
404 struct scmi_optee_channel *channel) in setup_shmem() argument
407 return setup_static_shmem(dev, cinfo, channel); in setup_shmem()
409 return setup_dynamic_shmem(dev, channel); in setup_shmem()
414 struct scmi_optee_channel *channel; in scmi_optee_chan_setup() local
421 channel = devm_kzalloc(dev, sizeof(*channel), GFP_KERNEL); in scmi_optee_chan_setup()
422 if (!channel) in scmi_optee_chan_setup()
430 cinfo->transport_info = channel; in scmi_optee_chan_setup()
431 channel->cinfo = cinfo; in scmi_optee_chan_setup()
432 channel->channel_id = channel_id; in scmi_optee_chan_setup()
433 mutex_init(&channel->mu); in scmi_optee_chan_setup()
435 ret = setup_shmem(dev, cinfo, channel); in scmi_optee_chan_setup()
439 ret = open_session(scmi_optee_private, &channel->tee_session); in scmi_optee_chan_setup()
443 ret = get_channel(channel); in scmi_optee_chan_setup()
451 list_add(&channel->link, &scmi_optee_private->channel_list); in scmi_optee_chan_setup()
457 close_session(scmi_optee_private, channel->tee_session); in scmi_optee_chan_setup()
459 if (channel->tee_shm) in scmi_optee_chan_setup()
460 tee_shm_free(channel->tee_shm); in scmi_optee_chan_setup()
468 struct scmi_optee_channel *channel = cinfo->transport_info; in scmi_optee_chan_free() local
474 if (!channel) in scmi_optee_chan_free()
478 list_del(&channel->link); in scmi_optee_chan_free()
481 close_session(scmi_optee_private, channel->tee_session); in scmi_optee_chan_free()
483 if (channel->tee_shm) { in scmi_optee_chan_free()
484 tee_shm_free(channel->tee_shm); in scmi_optee_chan_free()
485 channel->tee_shm = NULL; in scmi_optee_chan_free()
489 channel->cinfo = NULL; in scmi_optee_chan_free()
497 struct scmi_optee_channel *channel = cinfo->transport_info; in scmi_optee_send_message() local
500 mutex_lock(&channel->mu); in scmi_optee_send_message()
502 if (channel->tee_shm) { in scmi_optee_send_message()
503 msg_tx_prepare(channel->req.msg, xfer); in scmi_optee_send_message()
504 ret = invoke_process_msg_channel(channel, msg_command_size(xfer)); in scmi_optee_send_message()
506 shmem_tx_prepare(channel->req.shmem, xfer, cinfo); in scmi_optee_send_message()
507 ret = invoke_process_smt_channel(channel); in scmi_optee_send_message()
511 mutex_unlock(&channel->mu); in scmi_optee_send_message()
519 struct scmi_optee_channel *channel = cinfo->transport_info; in scmi_optee_fetch_response() local
521 if (channel->tee_shm) in scmi_optee_fetch_response()
522 msg_fetch_response(channel->req.msg, channel->rx_len, xfer); in scmi_optee_fetch_response()
524 shmem_fetch_response(channel->req.shmem, xfer); in scmi_optee_fetch_response()
530 struct scmi_optee_channel *channel = cinfo->transport_info; in scmi_optee_mark_txdone() local
532 mutex_unlock(&channel->mu); in scmi_optee_mark_txdone()