linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Two nimor eMMc changes
@ 2021-09-07 15:12 Bean Huo
  2021-09-07 15:12 ` [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout Bean Huo
  2021-09-07 15:12 ` [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission Bean Huo
  0 siblings, 2 replies; 7+ messages in thread
From: Bean Huo @ 2021-09-07 15:12 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, wsa+renesas, linus.walleij,
	avri.altman, linux-mmc, linux-kernel
  Cc: beanhuo

From: Bean Huo <beanhuo@micron.com>


Bean Huo (2):
  mmc: cqhci: Print out qcnt in case of timeout
  mmc: core: No need to calculate the timeout value for CQE data
    transmission

 drivers/mmc/core/core.c       | 8 ++++++++
 drivers/mmc/host/cqhci-core.c | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout
  2021-09-07 15:12 [PATCH v1 0/2] Two nimor eMMc changes Bean Huo
@ 2021-09-07 15:12 ` Bean Huo
  2021-09-14 11:23   ` Ulf Hansson
  2021-09-07 15:12 ` [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission Bean Huo
  1 sibling, 1 reply; 7+ messages in thread
From: Bean Huo @ 2021-09-07 15:12 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, wsa+renesas, linus.walleij,
	avri.altman, linux-mmc, linux-kernel
  Cc: beanhuo

From: Bean Huo <beanhuo@micron.com>

Print task count that has not been completed, this is for the
purpose of debugging.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/mmc/host/cqhci-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
index 38559a956330..ca8329d55f43 100644
--- a/drivers/mmc/host/cqhci-core.c
+++ b/drivers/mmc/host/cqhci-core.c
@@ -899,8 +899,8 @@ static bool cqhci_timeout(struct mmc_host *mmc, struct mmc_request *mrq,
 	spin_unlock_irqrestore(&cq_host->lock, flags);
 
 	if (timed_out) {
-		pr_err("%s: cqhci: timeout for tag %d\n",
-		       mmc_hostname(mmc), tag);
+		pr_err("%s: cqhci: timeout for tag %d, qcnt %d\n",
+		       mmc_hostname(mmc), tag, cq_host->qcnt);
 		cqhci_dumpregs(cq_host);
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission
  2021-09-07 15:12 [PATCH v1 0/2] Two nimor eMMc changes Bean Huo
  2021-09-07 15:12 ` [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout Bean Huo
@ 2021-09-07 15:12 ` Bean Huo
  2021-09-14  8:13   ` Ulf Hansson
  1 sibling, 1 reply; 7+ messages in thread
From: Bean Huo @ 2021-09-07 15:12 UTC (permalink / raw)
  To: ulf.hansson, adrian.hunter, wsa+renesas, linus.walleij,
	avri.altman, linux-mmc, linux-kernel
  Cc: beanhuo

From: Bean Huo <beanhuo@micron.com>

In case CQE is enabled, the timeout value of data transmission is always
set to be maximum in sdhci_cqe_enable(), so, calculating its timeout value
is obviously superfluous. Change to return directly, which can save some CPU
cycle time.

Signed-off-by: Bean Huo <beanhuo@micron.com>
---
 drivers/mmc/core/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 240c5af793dc..0b571a3bc988 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -649,6 +649,7 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
 void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
 {
 	unsigned int mult;
+	struct mmc_host *host = card->host;
 
 	/*
 	 * SDIO cards only define an upper 1 s limit on access.
@@ -659,6 +660,13 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
 		return;
 	}
 
+	/*
+	 * In case CQE is enabled, the timeout will be set a maximum timeout in
+	 * sdhci_cqe_enable(), so, no need to go through the below algorithm.
+	 */
+	if (host->cqe_enabled)
+		return;
+
 	/*
 	 * SD cards use a 100 multiplier rather than 10
 	 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission
  2021-09-07 15:12 ` [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission Bean Huo
@ 2021-09-14  8:13   ` Ulf Hansson
  2021-09-15  9:54     ` Bean Huo
  0 siblings, 1 reply; 7+ messages in thread
From: Ulf Hansson @ 2021-09-14  8:13 UTC (permalink / raw)
  To: Bean Huo
  Cc: Adrian Hunter, Wolfram Sang, Linus Walleij, Avri Altman,
	linux-mmc, Linux Kernel Mailing List, Bean Huo (beanhuo)

On Tue, 7 Sept 2021 at 17:12, Bean Huo <huobean@gmail.com> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> In case CQE is enabled, the timeout value of data transmission is always
> set to be maximum in sdhci_cqe_enable(), so, calculating its timeout value
> is obviously superfluous. Change to return directly, which can save some CPU
> cycle time.
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/mmc/core/core.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 240c5af793dc..0b571a3bc988 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -649,6 +649,7 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
>  void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
>  {
>         unsigned int mult;
> +       struct mmc_host *host = card->host;
>
>         /*
>          * SDIO cards only define an upper 1 s limit on access.
> @@ -659,6 +660,13 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
>                 return;
>         }
>
> +       /*
> +        * In case CQE is enabled, the timeout will be set a maximum timeout in
> +        * sdhci_cqe_enable(), so, no need to go through the below algorithm.
> +        */
> +       if (host->cqe_enabled)

 I don't think this is a good idea. For example, host->cqe_enabled is
set for the hsq case well.

> +               return;
> +
>         /*
>          * SD cards use a 100 multiplier rather than 10
>          */

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout
  2021-09-07 15:12 ` [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout Bean Huo
@ 2021-09-14 11:23   ` Ulf Hansson
  0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2021-09-14 11:23 UTC (permalink / raw)
  To: Bean Huo
  Cc: Adrian Hunter, Wolfram Sang, Linus Walleij, Avri Altman,
	linux-mmc, Linux Kernel Mailing List, Bean Huo (beanhuo)

On Tue, 7 Sept 2021 at 17:12, Bean Huo <huobean@gmail.com> wrote:
>
> From: Bean Huo <beanhuo@micron.com>
>
> Print task count that has not been completed, this is for the
> purpose of debugging.
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/cqhci-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index 38559a956330..ca8329d55f43 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -899,8 +899,8 @@ static bool cqhci_timeout(struct mmc_host *mmc, struct mmc_request *mrq,
>         spin_unlock_irqrestore(&cq_host->lock, flags);
>
>         if (timed_out) {
> -               pr_err("%s: cqhci: timeout for tag %d\n",
> -                      mmc_hostname(mmc), tag);
> +               pr_err("%s: cqhci: timeout for tag %d, qcnt %d\n",
> +                      mmc_hostname(mmc), tag, cq_host->qcnt);
>                 cqhci_dumpregs(cq_host);
>         }
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission
  2021-09-14  8:13   ` Ulf Hansson
@ 2021-09-15  9:54     ` Bean Huo
  2021-09-15 12:48       ` Ulf Hansson
  0 siblings, 1 reply; 7+ messages in thread
From: Bean Huo @ 2021-09-15  9:54 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Wolfram Sang, Linus Walleij, Avri Altman,
	linux-mmc, Linux Kernel Mailing List, Bean Huo (beanhuo)

On Tue, 2021-09-14 at 10:13 +0200, Ulf Hansson wrote:
> >          }
> > +       /*
> > +        * In case CQE is enabled, the timeout will be set a
> > maximum timeout in
> > +        * sdhci_cqe_enable(), so, no need to go through the below
> > algorithm.
> > +        */
> > +       if (host->cqe_enabled)
> 
> 
>  I don't think this is a good idea. For example, host->cqe_enabled is
> 
> set for the hsq case well.

Uffe,

My apologies for this, I forgot to check hsq, hsq will call
sdhci_send_command() as well.


How about changing it to this?

 
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 240c5af793dc..7235e398ef93 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -649,6 +649,7 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
 void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card
*card)
 {
        unsigned int mult;
+       struct mmc_host *host = card->host;
 
        /*
         * SDIO cards only define an upper 1 s limit on access.
@@ -659,6 +660,13 @@ void mmc_set_data_timeout(struct mmc_data *data,
const struct mmc_card *card)
                return;
        }
 
+       /*
+        * For the CQE use case, the data transfer timeout will be set
a maximum
+        * timeout value in HW timer in function sdhci_cqe_enable(),
so, no need
+        * to go through the below algorithm.
+        */
+       if (host->cqe_enabled && !host->hsq_enabled)
+               return;
        /*
         * SD cards use a 100 multiplier rather than 10
         */

I have another timeout change associated with data transfer as well, if
this change is acceptible, I will submit it with that together.

Kind regards,
Bean


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission
  2021-09-15  9:54     ` Bean Huo
@ 2021-09-15 12:48       ` Ulf Hansson
  0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2021-09-15 12:48 UTC (permalink / raw)
  To: Bean Huo
  Cc: Adrian Hunter, Wolfram Sang, Linus Walleij, Avri Altman,
	linux-mmc, Linux Kernel Mailing List, Bean Huo (beanhuo)

On Wed, 15 Sept 2021 at 11:54, Bean Huo <huobean@gmail.com> wrote:
>
> On Tue, 2021-09-14 at 10:13 +0200, Ulf Hansson wrote:
> > >          }
> > > +       /*
> > > +        * In case CQE is enabled, the timeout will be set a
> > > maximum timeout in
> > > +        * sdhci_cqe_enable(), so, no need to go through the below
> > > algorithm.
> > > +        */
> > > +       if (host->cqe_enabled)
> >
> >
> >  I don't think this is a good idea. For example, host->cqe_enabled is
> >
> > set for the hsq case well.
>
> Uffe,
>
> My apologies for this, I forgot to check hsq, hsq will call
> sdhci_send_command() as well.
>
>
> How about changing it to this?
>
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 240c5af793dc..7235e398ef93 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -649,6 +649,7 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
>  void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card
> *card)
>  {
>         unsigned int mult;
> +       struct mmc_host *host = card->host;
>
>         /*
>          * SDIO cards only define an upper 1 s limit on access.
> @@ -659,6 +660,13 @@ void mmc_set_data_timeout(struct mmc_data *data,
> const struct mmc_card *card)
>                 return;
>         }
>
> +       /*
> +        * For the CQE use case, the data transfer timeout will be set
> a maximum
> +        * timeout value in HW timer in function sdhci_cqe_enable(),
> so, no need
> +        * to go through the below algorithm.
> +        */
> +       if (host->cqe_enabled && !host->hsq_enabled)
> +               return;

Are you really sure the timeout isn't used (or could make sense to be
used for new cases)?

For example, we also have mtk-sd, which doesn't make use of sdhci_cqe_enable().

>         /*
>          * SD cards use a 100 multiplier rather than 10
>          */
>
> I have another timeout change associated with data transfer as well, if
> this change is acceptible, I will submit it with that together.
>
> Kind regards,
> Bean
>

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-15 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 15:12 [PATCH v1 0/2] Two nimor eMMc changes Bean Huo
2021-09-07 15:12 ` [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout Bean Huo
2021-09-14 11:23   ` Ulf Hansson
2021-09-07 15:12 ` [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission Bean Huo
2021-09-14  8:13   ` Ulf Hansson
2021-09-15  9:54     ` Bean Huo
2021-09-15 12:48       ` Ulf Hansson

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).