提交 bf322084 编写于 作者: C Cristian Marussi 提交者: Sudeep Holla

firmware: arm_scmi: Make optee support sync_cmds_completed_on_ret

Declare each OPTEE SCMI channel as not having a completion_irq so as to
enable polling mode and then enable also .sync_cmds_completed_on_ret flag
in the OPTEE transport descriptor so that real polling is itself
effectively bypassed on the rx path: once the optee command invocation has
successfully returned the core will directly fetch the response from the
shared memory area.

Remove OPTEE SCMI transport specific .poll_done callback support since
real polling is effectively bypassed when .sync_cmds_completed_on_ret is
set.

Add OPTEE SCMI transport specific .mark_txdone callback support in order to
properly handle channel locking along the tx path.

Link: https://lore.kernel.org/r/20211220195646.44498-6-cristian.marussi@arm.com
Cc: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: NCristian Marussi <cristian.marussi@arm.com>
Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
上级 117542b8
...@@ -363,6 +363,9 @@ static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *de ...@@ -363,6 +363,9 @@ static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *de
if (ret) if (ret)
goto err_close_sess; goto err_close_sess;
/* Enable polling */
cinfo->no_completion_irq = true;
mutex_lock(&scmi_optee_private->mu); mutex_lock(&scmi_optee_private->mu);
list_add(&channel->link, &scmi_optee_private->channel_list); list_add(&channel->link, &scmi_optee_private->channel_list);
mutex_unlock(&scmi_optee_private->mu); mutex_unlock(&scmi_optee_private->mu);
...@@ -423,9 +426,8 @@ static int scmi_optee_send_message(struct scmi_chan_info *cinfo, ...@@ -423,9 +426,8 @@ static int scmi_optee_send_message(struct scmi_chan_info *cinfo,
shmem_tx_prepare(shmem, xfer); shmem_tx_prepare(shmem, xfer);
ret = invoke_process_smt_channel(channel); ret = invoke_process_smt_channel(channel);
if (ret)
scmi_rx_callback(cinfo, shmem_read_header(shmem), NULL); mutex_unlock(&channel->mu);
mutex_unlock(&channel->mu);
return ret; return ret;
} }
...@@ -439,13 +441,11 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo, ...@@ -439,13 +441,11 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo,
shmem_fetch_response(shmem, xfer); shmem_fetch_response(shmem, xfer);
} }
static bool scmi_optee_poll_done(struct scmi_chan_info *cinfo, static void scmi_optee_mark_txdone(struct scmi_chan_info *cinfo, int ret)
struct scmi_xfer *xfer)
{ {
struct scmi_optee_channel *channel = cinfo->transport_info; struct scmi_optee_channel *channel = cinfo->transport_info;
struct scmi_shared_mem *shmem = get_channel_shm(channel, xfer);
return shmem_poll_done(shmem, xfer); mutex_unlock(&channel->mu);
} }
static struct scmi_transport_ops scmi_optee_ops = { static struct scmi_transport_ops scmi_optee_ops = {
...@@ -454,9 +454,9 @@ static struct scmi_transport_ops scmi_optee_ops = { ...@@ -454,9 +454,9 @@ static struct scmi_transport_ops scmi_optee_ops = {
.chan_setup = scmi_optee_chan_setup, .chan_setup = scmi_optee_chan_setup,
.chan_free = scmi_optee_chan_free, .chan_free = scmi_optee_chan_free,
.send_message = scmi_optee_send_message, .send_message = scmi_optee_send_message,
.mark_txdone = scmi_optee_mark_txdone,
.fetch_response = scmi_optee_fetch_response, .fetch_response = scmi_optee_fetch_response,
.clear_channel = scmi_optee_clear_channel, .clear_channel = scmi_optee_clear_channel,
.poll_done = scmi_optee_poll_done,
}; };
static int scmi_optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data) static int scmi_optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
...@@ -562,4 +562,5 @@ const struct scmi_desc scmi_optee_desc = { ...@@ -562,4 +562,5 @@ const struct scmi_desc scmi_optee_desc = {
.max_rx_timeout_ms = 30, .max_rx_timeout_ms = 30,
.max_msg = 20, .max_msg = 20,
.max_msg_size = SCMI_OPTEE_MAX_MSG_SIZE, .max_msg_size = SCMI_OPTEE_MAX_MSG_SIZE,
.sync_cmds_completed_on_ret = true,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册