From: CK Hu <ck.hu@mediatek.com>
To: Bibby Hsieh <bibby.hsieh@mediatek.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Rob Herring <robh+dt@kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<srv_heupstream@mediatek.com>,
Nicolas Boichat <drinkcat@chromium.org>,
Dennis-YC Hsieh <dennis-yc.hsieh@mediatek.com>,
Houlong Wei <houlong.wei@mediatek.com>
Subject: Re: [PATCH 2/3] mailbox: mediatek: remove implementation related to atomic_exec
Date: Fri, 14 Feb 2020 13:54:10 +0800 [thread overview]
Message-ID: <1581659650.12440.5.camel@mtksdaap41> (raw)
In-Reply-To: <20200214043325.16618-3-bibby.hsieh@mediatek.com>
Hi, Bibby:
On Fri, 2020-02-14 at 12:33 +0800, Bibby Hsieh wrote:
> After implement flush, client can flush the executing
> command buffer or abort the still waiting for event
> command buffer, so controller do not need to implement
> atomic_exe feature. remove it.
>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
> Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> ---
> drivers/mailbox/mtk-cmdq-mailbox.c | 76 ++++--------------------------
> 1 file changed, 8 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index 03e58ff62007..3ce777001aa5 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -57,7 +57,6 @@ struct cmdq_thread {
> void __iomem *base;
> struct list_head task_busy_list;
> u32 priority;
> - bool atomic_exec;
> };
>
> struct cmdq_task {
> @@ -163,48 +162,11 @@ static void cmdq_task_insert_into_thread(struct cmdq_task *task)
> cmdq_thread_invalidate_fetched_data(thread);
> }
>
> -static bool cmdq_command_is_wfe(u64 cmd)
> -{
> - u64 wfe_option = CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE;
> - u64 wfe_op = (u64)(CMDQ_CODE_WFE << CMDQ_OP_CODE_SHIFT) << 32;
> - u64 wfe_mask = (u64)CMDQ_OP_CODE_MASK << 32 | 0xffffffff;
> -
> - return ((cmd & wfe_mask) == (wfe_op | wfe_option));
> -}
> -
> -/* we assume tasks in the same display GCE thread are waiting the same event. */
> -static void cmdq_task_remove_wfe(struct cmdq_task *task)
> -{
> - struct device *dev = task->cmdq->mbox.dev;
> - u64 *base = task->pkt->va_base;
> - int i;
> -
> - dma_sync_single_for_cpu(dev, task->pa_base, task->pkt->cmd_buf_size,
> - DMA_TO_DEVICE);
> - for (i = 0; i < CMDQ_NUM_CMD(task->pkt); i++)
> - if (cmdq_command_is_wfe(base[i]))
> - base[i] = (u64)CMDQ_JUMP_BY_OFFSET << 32 |
> - CMDQ_JUMP_PASS;
> - dma_sync_single_for_device(dev, task->pa_base, task->pkt->cmd_buf_size,
> - DMA_TO_DEVICE);
> -}
> -
> static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread)
> {
> return readl(thread->base + CMDQ_THR_WAIT_TOKEN) & CMDQ_THR_IS_WAITING;
> }
>
> -static void cmdq_thread_wait_end(struct cmdq_thread *thread,
> - unsigned long end_pa)
> -{
> - struct device *dev = thread->chan->mbox->dev;
> - unsigned long curr_pa;
> -
> - if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_ADDR,
> - curr_pa, curr_pa == end_pa, 1, 20))
> - dev_err(dev, "GCE thread cannot run to end.\n");
> -}
> -
> static void cmdq_task_exec_done(struct cmdq_task *task, enum cmdq_cb_status sta)
> {
> struct cmdq_task_cb *cb = &task->pkt->async_cb;
> @@ -384,36 +346,15 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
> WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
> curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR);
> end_pa = readl(thread->base + CMDQ_THR_END_ADDR);
> -
> - /*
> - * Atomic execution should remove the following wfe, i.e. only
> - * wait event at first task, and prevent to pause when running.
> - */
> - if (thread->atomic_exec) {
> - /* GCE is executing if command is not WFE */
> - if (!cmdq_thread_is_in_wfe(thread)) {
> - cmdq_thread_resume(thread);
> - cmdq_thread_wait_end(thread, end_pa);
> - WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
> - /* set to this task directly */
> - writel(task->pa_base,
> - thread->base + CMDQ_THR_CURR_ADDR);
> - } else {
> - cmdq_task_insert_into_thread(task);
> - cmdq_task_remove_wfe(task);
> - smp_mb(); /* modify jump before enable thread */
> - }
> + /* check boundary */
> + if (curr_pa == end_pa - CMDQ_INST_SIZE ||
> + curr_pa == end_pa) {
> + /* set to this task directly */
> + writel(task->pa_base,
> + thread->base + CMDQ_THR_CURR_ADDR);
> } else {
> - /* check boundary */
> - if (curr_pa == end_pa - CMDQ_INST_SIZE ||
> - curr_pa == end_pa) {
> - /* set to this task directly */
> - writel(task->pa_base,
> - thread->base + CMDQ_THR_CURR_ADDR);
> - } else {
> - cmdq_task_insert_into_thread(task);
> - smp_mb(); /* modify jump before enable thread */
> - }
> + cmdq_task_insert_into_thread(task);
> + smp_mb(); /* modify jump before enable thread */
> }
> writel(task->pa_base + pkt->cmd_buf_size,
> thread->base + CMDQ_THR_END_ADDR);
> @@ -495,7 +436,6 @@ static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox,
>
> thread = (struct cmdq_thread *)mbox->chans[ind].con_priv;
> thread->priority = sp->args[1];
> - thread->atomic_exec = (sp->args[2] != 0);
> thread->chan = &mbox->chans[ind];
>
> return &mbox->chans[ind];
next prev parent reply other threads:[~2020-02-14 5:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 4:33 [PATCH 0/3] Remove atomic_exec Bibby Hsieh
2020-02-14 4:33 ` [PATCH 1/3] mailbox: mediatek: implement flush function Bibby Hsieh
2020-02-14 5:53 ` CK Hu
2020-02-14 4:33 ` [PATCH 2/3] mailbox: mediatek: remove implementation related to atomic_exec Bibby Hsieh
2020-02-14 5:54 ` CK Hu [this message]
2020-02-14 4:33 ` [PATCH 3/3] dt-binding: gce: remove atomic_exec in mboxes property Bibby Hsieh
2020-02-14 5:05 ` CK Hu
2020-02-14 10:30 ` Matthias Brugger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1581659650.12440.5.camel@mtksdaap41 \
--to=ck.hu@mediatek.com \
--cc=bibby.hsieh@mediatek.com \
--cc=dennis-yc.hsieh@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=drinkcat@chromium.org \
--cc=houlong.wei@mediatek.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=srv_heupstream@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).