Skip to contentSkip to conversation

mmc: mmc_test: Ensure command queue is disabled for testing

PATCH Applied Adrian Hunter 2 participants 4 messages Dec 1, 2017 – Dec 5, 2017 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

cover mmc: mmc_test: Ensure command queue is disabled for testing

Hi

Here are a couple of fixes related to mmc_test.

Adrian Hunter (2):
mmc: core: Ensure cmd_completion is initialized
mmc: mmc_test: Ensure command queue is disabled for testing

 drivers/mmc/core/core.c     |  6 ++----
 drivers/mmc/core/mmc_test.c | 11 +++++++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

Regards
Adrian

#1 lore raw

PATCH 1/2 mmc: core: Ensure cmd_completion is initialized

mmc_test now uses mmc_start_request() to test sending commands during "ongoing" asynchronous transfers, i.e. tests:
Commands during non-blocking read - use Set Block Count (CMD23) Commands during non-blocking write - use Set Block Count (CMD23)

mmc_start_request() was not initializing cmd_completion, but cmd_completion is used by "ongoing" transfers, so move initialization of cmd_completion into making mmc_start_request().

Fixes cb39f61e9b1e ("mmc: core: Export a few functions needed for blkmq support")
---
 drivers/mmc/core/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/core/core.c +2 -4
index 617802f45386..455abbf4f41e 100644
@@ -348,6 +348,8 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
 	int err;
 
+	init_completion(&mrq->cmd_completion);
+
 	mmc_retune_hold(host);
 
 	if (mmc_card_removed(host->card))
@@ -418,8 +420,6 @@ static int __mmc_start_data_req(struct mmc_host *host, struct mmc_request *mrq)
 	mrq->done = mmc_wait_data_done;
 	mrq->host = host;
 
-	init_completion(&mrq->cmd_completion);
-
 	err = mmc_start_request(host, mrq);
 	if (err) {
 		mrq->cmd->error = err;
@@ -439,8 +439,6 @@ static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
 	init_completion(&mrq->completion);
 	mrq->done = mmc_wait_done;
 
-	init_completion(&mrq->cmd_completion);
-
 	err = mmc_start_request(host, mrq);
 	if (err) {
 		mrq->cmd->error = err;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 mmc: mmc_test: Ensure command queue is disabled for testing

In reply to Adrian Hunter

mmc_test disables the command queue because none of the tests use the command queue. However the Reset Test will re-enable it, so disable it in that case too.

Fixes 9d4579a85c84 ("mmc: mmc_test: Disable Command Queue while mmc_test is used")
---
 drivers/mmc/core/mmc_test.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/mmc/core/mmc_test.c +9 -2
index f96bbb8014e1..ef18daeaa4cc 100644
@@ -2320,10 +2320,17 @@ static int mmc_test_reset(struct mmc_test_card *test)
 	int err;
 
 	err = mmc_hw_reset(host);
-	if (!err)
+	if (!err) {
+		/*
+		 * Reset will re-enable the card's command queue, but tests
+		 * expect it to be disabled.
+		 */
+		if (card->ext_csd.cmdq_en)
+			mmc_cmdq_disable(card);
 		return RESULT_OK;
-	else if (err == -EOPNOTSUPP)
+	} else if (err == -EOPNOTSUPP) {
 		return RESULT_UNSUP_HOST;
+	}
 
 	return RESULT_FAIL;
 }
Signature · 1 line
1.9.1
Applied
#3 lore raw
In reply to Adrian Hunter
Quoted 5 lines · Adrian Hunter

Hi

Here are a couple of fixes related to mmc_test.

Quoted 9 lines

Adrian Hunter (2):
mmc: core: Ensure cmd_completion is initialized
mmc: mmc_test: Ensure command queue is disabled for testing

 drivers/mmc/core/core.c     |  6 ++----
 drivers/mmc/core/mmc_test.c | 11 +++++++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

Thanks, applied for next!

Kind regards
Uffe