linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: chen jiangnan <chen.jiangnan@zlingsmart.com>
Cc: "riteshh@codeaurora.org" <riteshh@codeaurora.org>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"ulf.hansson@linaro.or" <ulf.hansson@linaro.or>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: 0001-Fix-CQE-task-queue-timeout.patch
Date: Wed, 1 Jul 2020 12:57:10 +0300	[thread overview]
Message-ID: <40cccbed-1cbf-c709-9d5b-b87e796b07e5@intel.com> (raw)
In-Reply-To: <5a7b5ad9-bb3a-4281-a065-f57f9cf71a5a.chen.jiangnan@zlingsmart.com>

On 22/06/20 8:44 am, chen jiangnan wrote:
> From 547e5635c04f4f9d62cbc1e3a4b4527f87c4e83b Mon Sep 17 00:00:00 2001
> From: JiangnanChen <chen.jiangnan@zlingsmart.com>
> Date: Mon, 22 Jun 2020 05:32:21 +0000
> Subject: [PATCH] Fix CQE task queue timeout. CQE notifies the software that

Please separate subject from commit message.

>  task has completed through task completion notification (TCN), but some CQE
>  will occasionally mark the task in the pending state (via DPT). At this time,
>  if a QBR task (such as flush cache) is followed, the entire command queue
>  will be blocked, causing the mmc subsystem to report a timeout error, and cqe
>  enters the recovery process.

It seems like this is a workaround for broken HW, so you could create a quirk for
this, but making use of the ->write_l host op is cleaner for cqhci.

e.g. in your driver, for the broken controller set cqhci_host_ops write_l to use
the following:

static void ???_cqhci_writel(struct cqhci_host *cq_host, u32 val, int reg)
{
	writel_relaxed(val, cq_host->mmio + reg);

	if (reg == CQHCI_TCN) {
               u32 pend_status = cqhci_readl(cq_host, CQHCI_DPT);
               if (val & pend_status) {
                       pr_debug("%s: cqhci conflict: TCN: 0x%08lx DPT: 0x%08lx\n",
                                mmc_hostname(cq_host->mmc), val, pend_status);
                       cqhci_writel(cq_host, val & pend_status, CQHCI_TCLR);
               }
	}
}

> 
> Signed-off-by: JiangnanChen <chen.jiangnan@zlingsmart.com>
> ---
>  drivers/mmc/host/cqhci.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
> index 75934f3c117e..b8c7f6119ac4 100644
> --- a/drivers/mmc/host/cqhci.c
> +++ b/drivers/mmc/host/cqhci.c
> @@ -760,7 +760,7 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,
>                       int data_error)
>  {
>         u32 status;
> -       unsigned long tag = 0, comp_status;
> +       unsigned long tag = 0, comp_status, pend_status;
>         struct cqhci_host *cq_host = mmc->cqe_private;
>  
>         status = cqhci_readl(cq_host, CQHCI_IS);
> @@ -778,6 +778,13 @@ irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error,
>                 pr_debug("%s: cqhci: TCN: 0x%08lx\n",
>                          mmc_hostname(mmc), comp_status);
>  
> +               pend_status = cqhci_readl(cq_host, CQHCI_DPT);
> +               if (comp_status & pend_status) {
> +                       pr_debug("%s: cqhci conflict: TCN: 0x%08lx DPT: 0x%08lx\n",
> +                                mmc_hostname(mmc), comp_status, pend_status);
> +                       cqhci_writel(cq_host, comp_status & pend_status, CQHCI_TCLR);
> +               }
> +
>                 spin_lock(&cq_host->lock);
>  
>                 for_each_set_bit(tag, &comp_status, cq_host->num_slots) {
> -- 
> 2.17.1


           reply	other threads:[~2020-07-01  9:57 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <5a7b5ad9-bb3a-4281-a065-f57f9cf71a5a.chen.jiangnan@zlingsmart.com>]

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=40cccbed-1cbf-c709-9d5b-b87e796b07e5@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=asutoshd@codeaurora.org \
    --cc=chen.jiangnan@zlingsmart.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=riteshh@codeaurora.org \
    --cc=ulf.hansson@linaro.or \
    /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).