All of lore.kernel.org
 help / color / mirror / Atom feed
From: CK Hu <ck.hu@mediatek.com>
To: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
Cc: devicetree@vger.kernel.org, srv_heupstream@mediatek.com,
	wsd_upstream@mediatek.com, Jassi Brar <jassisinghbrar@gmail.com>,
	linux-kernel@vger.kernel.org,
	Houlong Wei <houlong.wei@mediatek.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-mediatek@lists.infradead.org,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Ming-Fan Chen <ming-fan.chen@mediatek.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 04/13] mailbox: mediatek: cmdq: clear task in channel before shutdown
Date: Fri, 28 Feb 2020 23:57:02 +0800	[thread overview]
Message-ID: <1582905422.14824.22.camel@mtksdaap41> (raw)
In-Reply-To: <1582897461-15105-6-git-send-email-dennis-yc.hsieh@mediatek.com>

Hi, Dennis:

On Fri, 2020-02-28 at 21:44 +0800, Dennis YC Hsieh wrote:
> Do success callback in channel when shutdown. For those task not finish,
> callback with error code thus client has chance to cleanup or reset.
> 
> Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
> ---
>  drivers/mailbox/mtk-cmdq-mailbox.c | 38 ++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index 7246b7e21a2e..50dec015593f 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -387,6 +387,12 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
>  
>  	if (list_empty(&thread->task_busy_list)) {
>  		WARN_ON(clk_enable(cmdq->clock) < 0);
> +		/*
> +		 * The thread reset will clear thread related register to 0,
> +		 * including pc, end, priority, irq, suspend and enable. Thus
> +		 * set CMDQ_THR_ENABLED to CMDQ_THR_ENABLE_TASK will enable
> +		 * thread and make it running.
> +		 */
>  		WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
>  
>  		writel(task->pa_base >> cmdq->shift_pa,
> @@ -450,6 +456,38 @@ static int cmdq_mbox_startup(struct mbox_chan *chan)
>  
>  static void cmdq_mbox_shutdown(struct mbox_chan *chan)
>  {
> +	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
> +	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
> +	struct cmdq_task *task, *tmp;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&thread->chan->lock, flags);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
> +
> +	/* make sure executed tasks have success callback */
> +	cmdq_thread_irq_handler(cmdq, thread);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
> +				 list_entry) {
> +		cmdq_task_exec_done(task, -ECONNABORTED);

cmdq_task_exec_done(task, CMDQ_CB_ERROR) ? However, I've like to use the
standard error as you write here.

Regards,
CK

> +		kfree(task);
> +	}
> +
> +	cmdq_thread_disable(cmdq, thread);
> +	clk_disable(cmdq->clock);
> +done:
> +	/*
> +	 * The thread->task_busy_list empty means thread already disable. The
> +	 * cmdq_mbox_send_data() always reset thread which clear disable and
> +	 * suspend statue when first pkt send to channel, so there is no need
> +	 * to do any operation here, only unlock and leave.
> +	 */
> +	spin_unlock_irqrestore(&thread->chan->lock, flags);
>  }
>  
>  static const struct mbox_chan_ops cmdq_mbox_chan_ops = {

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: CK Hu <ck.hu@mediatek.com>
To: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
Cc: devicetree@vger.kernel.org, srv_heupstream@mediatek.com,
	wsd_upstream@mediatek.com, Jassi Brar <jassisinghbrar@gmail.com>,
	linux-kernel@vger.kernel.org,
	Houlong Wei <houlong.wei@mediatek.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-mediatek@lists.infradead.org,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Ming-Fan Chen <ming-fan.chen@mediatek.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 04/13] mailbox: mediatek: cmdq: clear task in channel before shutdown
Date: Fri, 28 Feb 2020 23:57:02 +0800	[thread overview]
Message-ID: <1582905422.14824.22.camel@mtksdaap41> (raw)
In-Reply-To: <1582897461-15105-6-git-send-email-dennis-yc.hsieh@mediatek.com>

Hi, Dennis:

On Fri, 2020-02-28 at 21:44 +0800, Dennis YC Hsieh wrote:
> Do success callback in channel when shutdown. For those task not finish,
> callback with error code thus client has chance to cleanup or reset.
> 
> Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
> ---
>  drivers/mailbox/mtk-cmdq-mailbox.c | 38 ++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index 7246b7e21a2e..50dec015593f 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -387,6 +387,12 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
>  
>  	if (list_empty(&thread->task_busy_list)) {
>  		WARN_ON(clk_enable(cmdq->clock) < 0);
> +		/*
> +		 * The thread reset will clear thread related register to 0,
> +		 * including pc, end, priority, irq, suspend and enable. Thus
> +		 * set CMDQ_THR_ENABLED to CMDQ_THR_ENABLE_TASK will enable
> +		 * thread and make it running.
> +		 */
>  		WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
>  
>  		writel(task->pa_base >> cmdq->shift_pa,
> @@ -450,6 +456,38 @@ static int cmdq_mbox_startup(struct mbox_chan *chan)
>  
>  static void cmdq_mbox_shutdown(struct mbox_chan *chan)
>  {
> +	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
> +	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
> +	struct cmdq_task *task, *tmp;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&thread->chan->lock, flags);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
> +
> +	/* make sure executed tasks have success callback */
> +	cmdq_thread_irq_handler(cmdq, thread);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
> +				 list_entry) {
> +		cmdq_task_exec_done(task, -ECONNABORTED);

cmdq_task_exec_done(task, CMDQ_CB_ERROR) ? However, I've like to use the
standard error as you write here.

Regards,
CK

> +		kfree(task);
> +	}
> +
> +	cmdq_thread_disable(cmdq, thread);
> +	clk_disable(cmdq->clock);
> +done:
> +	/*
> +	 * The thread->task_busy_list empty means thread already disable. The
> +	 * cmdq_mbox_send_data() always reset thread which clear disable and
> +	 * suspend statue when first pkt send to channel, so there is no need
> +	 * to do any operation here, only unlock and leave.
> +	 */
> +	spin_unlock_irqrestore(&thread->chan->lock, flags);
>  }
>  
>  static const struct mbox_chan_ops cmdq_mbox_chan_ops = {

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: CK Hu <ck.hu@mediatek.com>
To: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <wsd_upstream@mediatek.com>,
	Bibby Hsieh <bibby.hsieh@mediatek.com>,
	Houlong Wei <houlong.wei@mediatek.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<srv_heupstream@mediatek.com>,
	"Ming-Fan Chen" <ming-fan.chen@mediatek.com>
Subject: Re: [PATCH v3 04/13] mailbox: mediatek: cmdq: clear task in channel before shutdown
Date: Fri, 28 Feb 2020 23:57:02 +0800	[thread overview]
Message-ID: <1582905422.14824.22.camel@mtksdaap41> (raw)
In-Reply-To: <1582897461-15105-6-git-send-email-dennis-yc.hsieh@mediatek.com>

Hi, Dennis:

On Fri, 2020-02-28 at 21:44 +0800, Dennis YC Hsieh wrote:
> Do success callback in channel when shutdown. For those task not finish,
> callback with error code thus client has chance to cleanup or reset.
> 
> Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
> ---
>  drivers/mailbox/mtk-cmdq-mailbox.c | 38 ++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index 7246b7e21a2e..50dec015593f 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -387,6 +387,12 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
>  
>  	if (list_empty(&thread->task_busy_list)) {
>  		WARN_ON(clk_enable(cmdq->clock) < 0);
> +		/*
> +		 * The thread reset will clear thread related register to 0,
> +		 * including pc, end, priority, irq, suspend and enable. Thus
> +		 * set CMDQ_THR_ENABLED to CMDQ_THR_ENABLE_TASK will enable
> +		 * thread and make it running.
> +		 */
>  		WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
>  
>  		writel(task->pa_base >> cmdq->shift_pa,
> @@ -450,6 +456,38 @@ static int cmdq_mbox_startup(struct mbox_chan *chan)
>  
>  static void cmdq_mbox_shutdown(struct mbox_chan *chan)
>  {
> +	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
> +	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
> +	struct cmdq_task *task, *tmp;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&thread->chan->lock, flags);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
> +
> +	/* make sure executed tasks have success callback */
> +	cmdq_thread_irq_handler(cmdq, thread);
> +	if (list_empty(&thread->task_busy_list))
> +		goto done;
> +
> +	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
> +				 list_entry) {
> +		cmdq_task_exec_done(task, -ECONNABORTED);

cmdq_task_exec_done(task, CMDQ_CB_ERROR) ? However, I've like to use the
standard error as you write here.

Regards,
CK

> +		kfree(task);
> +	}
> +
> +	cmdq_thread_disable(cmdq, thread);
> +	clk_disable(cmdq->clock);
> +done:
> +	/*
> +	 * The thread->task_busy_list empty means thread already disable. The
> +	 * cmdq_mbox_send_data() always reset thread which clear disable and
> +	 * suspend statue when first pkt send to channel, so there is no need
> +	 * to do any operation here, only unlock and leave.
> +	 */
> +	spin_unlock_irqrestore(&thread->chan->lock, flags);
>  }
>  
>  static const struct mbox_chan_ops cmdq_mbox_chan_ops = {


  reply	other threads:[~2020-02-28 15:57 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 13:44 [PATCH v3 00/13] support gce on mt6779 platform Dennis YC Hsieh
2020-02-28 13:44 ` Dennis YC Hsieh
2020-02-28 13:44 ` Dennis YC Hsieh
2020-02-28 13:44 ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44 ` [PATCH v3 01/13] dt-binding: gce: add gce header file for mt6779 Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 15:26   ` CK Hu
2020-02-28 15:26     ` CK Hu
2020-02-28 15:26     ` CK Hu
2020-03-02 20:15   ` Rob Herring
2020-03-02 20:15     ` Rob Herring
2020-03-02 20:15     ` Rob Herring
2020-02-28 13:44 ` [PATCH v3 02/13] mailbox: cmdq: variablize address shift in platform Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 15:22   ` CK Hu
2020-02-28 15:22     ` CK Hu
2020-02-28 15:22     ` CK Hu
2020-02-29 13:36     ` Dennis-YC Hsieh
2020-02-29 13:36       ` Dennis-YC Hsieh
2020-02-29 13:36       ` Dennis-YC Hsieh
2020-02-28 13:44 ` [PATCH v3 03/13] mailbox: cmdq: support mt6779 gce platform definition Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44 ` [PATCH v3 04/13] mailbox: mediatek: cmdq: clear task in channel before shutdown Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 15:57   ` CK Hu [this message]
2020-02-28 15:57     ` CK Hu
2020-02-28 15:57     ` CK Hu
2020-02-29 13:40     ` Dennis-YC Hsieh
2020-02-29 13:40       ` Dennis-YC Hsieh
2020-02-29 13:40       ` Dennis-YC Hsieh
2020-02-28 13:44 ` [PATCH v3 05/13] soc: mediatek: cmdq: return send msg error code Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 15:39   ` CK Hu
2020-02-28 15:39     ` CK Hu
2020-02-28 15:39     ` CK Hu
2020-02-29 13:41     ` Dennis-YC Hsieh
2020-02-29 13:41       ` Dennis-YC Hsieh
2020-02-29 13:41       ` Dennis-YC Hsieh
2020-02-28 13:44 ` [PATCH v3 06/13] soc: mediatek: cmdq: add assign function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:44   ` CK Hu
2020-02-28 14:44     ` CK Hu
2020-02-28 14:44     ` CK Hu
2020-02-28 13:44 ` [PATCH v3 07/13] soc: mediatek: cmdq: add write_s function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:49   ` CK Hu
2020-02-28 14:49     ` CK Hu
2020-02-28 14:49     ` CK Hu
2020-02-28 13:44 ` [PATCH v3 08/13] soc: mediatek: cmdq: add read_s function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:50   ` CK Hu
2020-02-28 14:50     ` CK Hu
2020-02-28 14:50     ` CK Hu
2020-02-28 13:44 ` [PATCH v3 09/13] soc: mediatek: cmdq: add write_s value function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:55   ` CK Hu
2020-02-28 14:55     ` CK Hu
2020-02-28 14:55     ` CK Hu
2020-02-28 13:44 ` [PATCH v3 10/13] soc: mediatek: cmdq: export finalize function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44 ` [PATCH v3 11/13] soc: mediatek: cmdq: add jump function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:59   ` CK Hu
2020-02-28 14:59     ` CK Hu
2020-02-28 14:59     ` CK Hu
2020-02-29 13:42     ` Dennis-YC Hsieh
2020-02-29 13:42       ` Dennis-YC Hsieh
2020-02-29 13:42       ` Dennis-YC Hsieh
2020-02-28 13:44 ` [PATCH v3 12/13] soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 14:32   ` CK Hu
2020-02-28 14:32     ` CK Hu
2020-02-28 14:32     ` CK Hu
2020-02-29 14:37     ` Dennis-YC Hsieh
2020-02-29 14:37       ` Dennis-YC Hsieh
2020-02-29 14:37       ` Dennis-YC Hsieh
2020-02-28 13:44 ` [PATCH v3 13/13] soc: mediatek: cmdq: add set event function Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 13:44   ` Dennis YC Hsieh
2020-02-28 15:05   ` CK Hu
2020-02-28 15:05     ` CK Hu
2020-02-28 15:05     ` CK Hu

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=1582905422.14824.22.camel@mtksdaap41 \
    --to=ck.hu@mediatek.com \
    --cc=bibby.hsieh@mediatek.com \
    --cc=dennis-yc.hsieh@mediatek.com \
    --cc=devicetree@vger.kernel.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=ming-fan.chen@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=wsd_upstream@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.