public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing
@ 2017-12-01 12:55 Adrian Hunter
  2017-12-01 12:55 ` [PATCH 1/2] mmc: core: Ensure cmd_completion is initialized Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-12-01 12:55 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

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

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

* [PATCH 1/2] mmc: core: Ensure cmd_completion is initialized
  2017-12-01 12:55 [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
@ 2017-12-01 12:55 ` Adrian Hunter
  2017-12-01 12:55 ` [PATCH 2/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
  2017-12-05 16:24 ` [PATCH 0/2] " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-12-01 12:55 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

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")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 617802f45386..455abbf4f41e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -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;
-- 
1.9.1


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

* [PATCH 2/2] mmc: mmc_test: Ensure command queue is disabled for testing
  2017-12-01 12:55 [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
  2017-12-01 12:55 ` [PATCH 1/2] mmc: core: Ensure cmd_completion is initialized Adrian Hunter
@ 2017-12-01 12:55 ` Adrian Hunter
  2017-12-05 16:24 ` [PATCH 0/2] " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-12-01 12:55 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc

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")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/core/mmc_test.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index f96bbb8014e1..ef18daeaa4cc 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -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;
 }
-- 
1.9.1


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

* Re: [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing
  2017-12-01 12:55 [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
  2017-12-01 12:55 ` [PATCH 1/2] mmc: core: Ensure cmd_completion is initialized Adrian Hunter
  2017-12-01 12:55 ` [PATCH 2/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
@ 2017-12-05 16:24 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2017-12-05 16:24 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

On 1 December 2017 at 13:55, Adrian Hunter <adrian.hunter@intel.com> wrote:
> 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(-)
>
>

Thanks, applied for next!

Kind regards
Uffe

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

end of thread, other threads:[~2017-12-05 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-01 12:55 [PATCH 0/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
2017-12-01 12:55 ` [PATCH 1/2] mmc: core: Ensure cmd_completion is initialized Adrian Hunter
2017-12-01 12:55 ` [PATCH 2/2] mmc: mmc_test: Ensure command queue is disabled for testing Adrian Hunter
2017-12-05 16:24 ` [PATCH 0/2] " Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox