Skip to contentSkip to conversation

Two nimor eMMc changes

PATCH In review Bean Huo 2 participants 7 messages Sep 7, 2021 – Sep 15, 2021

Subsystems (2)
lore
Share & tools
lore

Bean Huo

author
#0 lore raw

cover Two nimor eMMc changes

From: Bean Huo <[email protected]>

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(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 mmc: cqhci: Print out qcnt in case of timeout

From: Bean Huo <[email protected]>

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

---
 drivers/mmc/host/cqhci-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/cqhci-core.c +2 -2
index 38559a956330..ca8329d55f43 100644
@@ -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);
 	}
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v1 1/2] mmc: cqhci: Print out qcnt in case of timeout

Quoted 7 lines · Bean Huo

From: Bean Huo <[email protected]>

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

Applied for next, thanks!

Kind regards
Uffe

Quoted 22 lines
---
 drivers/mmc/host/cqhci-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/cqhci-core.c +2 -3
index 38559a956330..ca8329d55f43 100644
@@ -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

author
#3 lore raw

PATCH 2/2 mmc: core: No need to calculate the timeout value for CQE data transmission

In reply to Bean Huo

From: Bean Huo <[email protected]>

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.

---
 drivers/mmc/core/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/mmc/core/core.c +8 -0
index 240c5af793dc..0b571a3bc988 100644
@@ -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
 	 */
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission

Quoted 26 lines · Bean Huo

From: Bean Huo <[email protected]>

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.

---
 drivers/mmc/core/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/mmc/core/core.c +1 -0
index 240c5af793dc..0b571a3bc988 100644
@@ -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.

drivers/mmc/core/core.c void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) · line 667

Quoted 8 lines
drivers/mmc/core/core.c +5 -0
@@ -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.

drivers/mmc/core/core.c void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) · line 672

Quoted 5 lines
drivers/mmc/core/core.c +2 -0
+               return;
+
        /*
         * SD cards use a 100 multiplier rather than 10
         */

Kind regards
Uffe

author
#5 lore raw

Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission

Quoted 10 lines · Ulf Hansson

Review

Quoted 8 lines
         }
(quoted diff) +2 -0
+       /*
+        * 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.

(quoted diff) +2 -0
+        */
+       if (host->cqe_enabled)
Quoted 3 lines

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?

drivers/mmc/core/core.c +0 -0
index 240c5af793dc..7235e398ef93 100644
@@ -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

#6 lore raw

Re: [PATCH v1 2/2] mmc: core: No need to calculate the timeout value for CQE data transmission

Quoted 48 lines · Bean Huo
Quoted 10 lines · Ulf Hansson

Review

Quoted 8 lines
         }
(quoted diff) +2 -0
+       /*
+        * 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.

(quoted diff) +2 -0
+        */
+       if (host->cqe_enabled)
Quoted 3 lines

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?

drivers/mmc/core/core.c +1 -0
index 240c5af793dc..7235e398ef93 100644
@@ -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.

drivers/mmc/core/core.c +2 -0
@@ -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

drivers/mmc/core/core.c

Quoted 4 lines
drivers/mmc/core/core.c +4 -0
+        * 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().

Quoted 10 lines
        /*
         * 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