Skip to contentSkip to conversation

mmc: Add Command Queue support

PATCH Superseded Adrian Hunter 3 participants 19 messages Jun 15, 2017 – Jul 21, 2017

Subsystems (4)

v3 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Adrian Hunter

author maintainer
#0 lore raw

v3 cover mmc: Add Command Queue support

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority. Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

 drivers/mmc/core/block.c          |  240 +++++++-
 drivers/mmc/core/block.h          |    7 +
 drivers/mmc/core/bus.c            |    7 +
 drivers/mmc/core/core.c           |  156 ++++-
 drivers/mmc/core/host.c           |    6 +
 drivers/mmc/core/host.h           |    1 +
 drivers/mmc/core/mmc.c            |   30 +-
 drivers/mmc/core/queue.c          |  273 ++++++++-
 drivers/mmc/core/queue.h          |   42 +-
 drivers/mmc/host/Kconfig          |   14 +
 drivers/mmc/host/Makefile         |    1 +
 drivers/mmc/host/cqhci.c          | 1146 +++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/cqhci.h          |  240 ++++++++
 drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
 include/linux/mmc/core.h          |   18 +-
 include/linux/mmc/host.h          |   24 +
 include/trace/events/mmc.h        |   36 +-
 17 files changed, 2354 insertions(+), 40 deletions(-)
 create mode 100644 drivers/mmc/host/cqhci.c
 create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian

author maintainer
#1 lore raw

PATCH v3 1/11 mmc: core: Add mmc_retune_hold_now()

In preparation for CQE support.

---
 drivers/mmc/core/host.c | 6 ++++++
 drivers/mmc/core/host.h | 1 +
 2 files changed, 7 insertions(+)
drivers/mmc/core/host.c +6 -0
index 1503412f826c..ad88deb2e8f3 100644
@@ -111,6 +111,12 @@ void mmc_retune_hold(struct mmc_host *host)
 	host->hold_retune += 1;
 }
 
+void mmc_retune_hold_now(struct mmc_host *host)
+{
+	host->retune_now = 0;
+	host->hold_retune += 1;
+}
+
 void mmc_retune_release(struct mmc_host *host)
 {
 	if (host->hold_retune)
drivers/mmc/core/host.h +1 -0
index fb6a76a03833..77d6f60d1bf9 100644
@@ -19,6 +19,7 @@
 void mmc_retune_enable(struct mmc_host *host);
 void mmc_retune_disable(struct mmc_host *host);
 void mmc_retune_hold(struct mmc_host *host);
+void mmc_retune_hold_now(struct mmc_host *host);
 void mmc_retune_release(struct mmc_host *host);
 int mmc_retune(struct mmc_host *host);
 void mmc_retune_pause(struct mmc_host *host);
Signature · 1 line
1.9.1
author maintainer
#2 lore raw

PATCH v3 2/11 mmc: core: Add members to mmc_request and mmc_data for CQE's

In reply to Adrian Hunter

Most of the information needed to issue requests to a CQE is already in struct mmc_request and struct mmc_data. Add data block address, some flags, and the task id (tag), and allow for cmd being NULL which it is for CQE tasks.

---
 include/linux/mmc/core.h   | 13 +++++++++++--
 include/trace/events/mmc.h | 36 +++++++++++++++++++++++-------------
 2 files changed, 34 insertions(+), 15 deletions(-)
include/linux/mmc/core.h +11 -2
index a0c63ea28796..bf1788a224e6 100644
@@ -122,11 +122,18 @@ struct mmc_data {
 	unsigned int		timeout_clks;	/* data timeout (in clocks) */
 	unsigned int		blksz;		/* data block size */
 	unsigned int		blocks;		/* number of blocks */
+	unsigned int		blk_addr;	/* block address */
 	int			error;		/* data error */
 	unsigned int		flags;
 
-#define MMC_DATA_WRITE	(1 << 8)
-#define MMC_DATA_READ	(1 << 9)
+#define MMC_DATA_WRITE		BIT(8)
+#define MMC_DATA_READ		BIT(9)
+/* Extra flags used by CQE */
+#define MMC_DATA_QBR		BIT(10)		/* CQE queue barrier*/
+#define MMC_DATA_PRIO		BIT(11)		/* CQE high priority */
+#define MMC_DATA_REL_WR		BIT(12)		/* Reliable write */
+#define MMC_DATA_DAT_TAG	BIT(13)		/* Tag request */
+#define MMC_DATA_FORCED_PRG	BIT(14)		/* Forced programming */
 
 	unsigned int		bytes_xfered;
 
@@ -153,6 +160,8 @@ struct mmc_request {
 
 	/* Allow other commands during this ongoing data transfer or busy wait */
 	bool			cap_cmd_during_tfr;
+
+	int			tag;
 };
 
 struct mmc_card;
include/trace/events/mmc.h +23 -13
index a72f9b94c80b..f30a99ac65b6 100644
@@ -29,8 +29,10 @@
 		__field(unsigned int,		sbc_flags)
 		__field(unsigned int,		sbc_retries)
 		__field(unsigned int,		blocks)
+		__field(unsigned int,		blk_addr)
 		__field(unsigned int,		blksz)
 		__field(unsigned int,		data_flags)
+		__field(int,			tag)
 		__field(unsigned int,		can_retune)
 		__field(unsigned int,		doing_retune)
 		__field(unsigned int,		retune_now)
@@ -42,10 +44,10 @@
 	),
 
 	TP_fast_assign(
-		__entry->cmd_opcode = mrq->cmd->opcode;
-		__entry->cmd_arg = mrq->cmd->arg;
-		__entry->cmd_flags = mrq->cmd->flags;
-		__entry->cmd_retries = mrq->cmd->retries;
+		__entry->cmd_opcode = mrq->cmd ? mrq->cmd->opcode : 0;
+		__entry->cmd_arg = mrq->cmd ? mrq->cmd->arg : 0;
+		__entry->cmd_flags = mrq->cmd ? mrq->cmd->flags : 0;
+		__entry->cmd_retries = mrq->cmd ? mrq->cmd->retries : 0;
 		__entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
 		__entry->stop_arg = mrq->stop ? mrq->stop->arg : 0;
 		__entry->stop_flags = mrq->stop ? mrq->stop->flags : 0;
@@ -56,7 +58,9 @@
 		__entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
 		__entry->blksz = mrq->data ? mrq->data->blksz : 0;
 		__entry->blocks = mrq->data ? mrq->data->blocks : 0;
+		__entry->blk_addr = mrq->data ? mrq->data->blk_addr : 0;
 		__entry->data_flags = mrq->data ? mrq->data->flags : 0;
+		__entry->tag = mrq->tag;
 		__entry->can_retune = host->can_retune;
 		__entry->doing_retune = host->doing_retune;
 		__entry->retune_now = host->retune_now;
@@ -71,8 +75,8 @@
 		  "cmd_opcode=%u cmd_arg=0x%x cmd_flags=0x%x cmd_retries=%u "
 		  "stop_opcode=%u stop_arg=0x%x stop_flags=0x%x stop_retries=%u "
 		  "sbc_opcode=%u sbc_arg=0x%x sbc_flags=0x%x sbc_retires=%u "
-		  "blocks=%u block_size=%u data_flags=0x%x "
-		  "can_retune=%u doing_retune=%u retune_now=%u "
+		  "blocks=%u block_size=%u blk_addr=%u data_flags=0x%x "
+		  "tag=%d can_retune=%u doing_retune=%u retune_now=%u "
 		  "need_retune=%d hold_retune=%d retune_period=%u",
 		  __get_str(name), __entry->mrq,
 		  __entry->cmd_opcode, __entry->cmd_arg,
@@ -81,7 +85,8 @@
 		  __entry->stop_flags, __entry->stop_retries,
 		  __entry->sbc_opcode, __entry->sbc_arg,
 		  __entry->sbc_flags, __entry->sbc_retries,
-		  __entry->blocks, __entry->blksz, __entry->data_flags,
+		  __entry->blocks, __entry->blk_addr,
+		  __entry->blksz, __entry->data_flags, __entry->tag,
 		  __entry->can_retune, __entry->doing_retune,
 		  __entry->retune_now, __entry->need_retune,
 		  __entry->hold_retune, __entry->retune_period)
@@ -108,6 +113,7 @@
 		__field(unsigned int,		sbc_retries)
 		__field(unsigned int,		bytes_xfered)
 		__field(int,			data_err)
+		__field(int,			tag)
 		__field(unsigned int,		can_retune)
 		__field(unsigned int,		doing_retune)
 		__field(unsigned int,		retune_now)
@@ -119,10 +125,13 @@
 	),
 
 	TP_fast_assign(
-		__entry->cmd_opcode = mrq->cmd->opcode;
-		__entry->cmd_err = mrq->cmd->error;
-		memcpy(__entry->cmd_resp, mrq->cmd->resp, 4);
-		__entry->cmd_retries = mrq->cmd->retries;
+		__entry->cmd_opcode = mrq->cmd ? mrq->cmd->opcode : 0;
+		__entry->cmd_err = mrq->cmd ? mrq->cmd->error : 0;
+		__entry->cmd_resp[0] = mrq->cmd ? mrq->cmd->resp[0] : 0;
+		__entry->cmd_resp[1] = mrq->cmd ? mrq->cmd->resp[1] : 0;
+		__entry->cmd_resp[2] = mrq->cmd ? mrq->cmd->resp[2] : 0;
+		__entry->cmd_resp[3] = mrq->cmd ? mrq->cmd->resp[3] : 0;
+		__entry->cmd_retries = mrq->cmd ? mrq->cmd->retries : 0;
 		__entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
 		__entry->stop_err = mrq->stop ? mrq->stop->error : 0;
 		__entry->stop_resp[0] = mrq->stop ? mrq->stop->resp[0] : 0;
@@ -139,6 +148,7 @@
 		__entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
 		__entry->bytes_xfered = mrq->data ? mrq->data->bytes_xfered : 0;
 		__entry->data_err = mrq->data ? mrq->data->error : 0;
+		__entry->tag = mrq->tag;
 		__entry->can_retune = host->can_retune;
 		__entry->doing_retune = host->doing_retune;
 		__entry->retune_now = host->retune_now;
@@ -154,7 +164,7 @@
 		  "cmd_retries=%u stop_opcode=%u stop_err=%d "
 		  "stop_resp=0x%x 0x%x 0x%x 0x%x stop_retries=%u "
 		  "sbc_opcode=%u sbc_err=%d sbc_resp=0x%x 0x%x 0x%x 0x%x "
-		  "sbc_retries=%u bytes_xfered=%u data_err=%d "
+		  "sbc_retries=%u bytes_xfered=%u data_err=%d tag=%d "
 		  "can_retune=%u doing_retune=%u retune_now=%u need_retune=%d "
 		  "hold_retune=%d retune_period=%u",
 		  __get_str(name), __entry->mrq,
@@ -170,7 +180,7 @@
 		  __entry->sbc_resp[0], __entry->sbc_resp[1],
 		  __entry->sbc_resp[2], __entry->sbc_resp[3],
 		  __entry->sbc_retries,
-		  __entry->bytes_xfered, __entry->data_err,
+		  __entry->bytes_xfered, __entry->data_err, __entry->tag,
 		  __entry->can_retune, __entry->doing_retune,
 		  __entry->retune_now, __entry->need_retune,
 		  __entry->hold_retune, __entry->retune_period)
Signature · 1 line
1.9.1
author maintainer
#3 lore raw

PATCH v3 3/11 mmc: host: Add CQE interface

In reply to Adrian Hunter

Add CQE host operations, capabilities, and host members.

---
 include/linux/mmc/host.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
include/linux/mmc/host.h +24 -0
index ebd1cebbef0c..4dd7ada9b4b9 100644
@@ -162,6 +162,19 @@ struct mmc_host_ops {
 				  unsigned int direction, int blk_size);
 };
 
+struct mmc_cqe_ops {
+	int	(*cqe_enable)(struct mmc_host *host, struct mmc_card *card);
+	void	(*cqe_disable)(struct mmc_host *host);
+	int	(*cqe_request)(struct mmc_host *host, struct mmc_request *mrq);
+	void	(*cqe_post_req)(struct mmc_host *host, struct mmc_request *mrq);
+	void	(*cqe_off)(struct mmc_host *host);
+	int	(*cqe_wait_for_idle)(struct mmc_host *host);
+	bool	(*cqe_timeout)(struct mmc_host *host, struct mmc_request *mrq,
+			       bool *recovery_needed);
+	void	(*cqe_recovery_start)(struct mmc_host *host);
+	void	(*cqe_recovery_finish)(struct mmc_host *host);
+};
+
 struct mmc_async_req {
 	/* active mmc request */
 	struct mmc_request	*mrq;
@@ -307,6 +320,8 @@ struct mmc_host {
 #define MMC_CAP2_HS400_ES	(1 << 20)	/* Host supports enhanced strobe */
 #define MMC_CAP2_NO_SD		(1 << 21)	/* Do not send SD commands during initialization */
 #define MMC_CAP2_NO_MMC		(1 << 22)	/* Do not send (e)MMC commands during initialization */
+#define MMC_CAP2_CQE		(1 << 23)	/* Has eMMC command queue engine */
+#define MMC_CAP2_CQE_DCMD	(1 << 24)	/* CQE can issue a direct command */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
@@ -393,6 +408,15 @@ struct mmc_host {
 	int			dsr_req;	/* DSR value is valid */
 	u32			dsr;	/* optional driver stage (DSR) value */
 
+	/* Command Queue Engine (CQE) support */
+	const struct mmc_cqe_ops *cqe_ops;
+	void			*cqe_private;
+	void			(*cqe_recovery_notifier)(struct mmc_host *,
+							 struct mmc_request *);
+	int			cqe_qdepth;
+	bool			cqe_enabled;
+	bool			cqe_on;
+
 	unsigned long		private[0] ____cacheline_aligned;
 };
 
Signature · 1 line
1.9.1
author maintainer
#4 lore raw

PATCH v3 4/11 mmc: core: Turn off CQE before sending commands

In reply to Adrian Hunter

Turn off the CQE before sending commands, and ensure it is off in any reset or power management paths, or re-tuning.

---
 drivers/mmc/core/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/core/core.c +9 -0
index 26431267a3e2..b0af9db18eef 100644
@@ -260,6 +260,9 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 
 	trace_mmc_request_start(host, mrq);
 
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	host->ops->request(host, mrq);
 }
 
@@ -982,6 +985,9 @@ int mmc_execute_tuning(struct mmc_card *card)
 	if (!host->ops->execute_tuning)
 		return 0;
 
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	if (mmc_card_mmc(card))
 		opcode = MMC_SEND_TUNING_BLOCK_HS200;
 	else
@@ -1021,6 +1027,9 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
  */
 void mmc_set_initial_state(struct mmc_host *host)
 {
+	if (host->cqe_on)
+		host->cqe_ops->cqe_off(host);
+
 	mmc_retune_disable(host);
 
 	if (mmc_host_is_spi(host))
Signature · 1 line
1.9.1
author maintainer
#5 lore raw

PATCH v3 5/11 mmc: core: Add support for handling CQE requests

In reply to Adrian Hunter

Add core support for handling CQE requests, including starting, completing and recovering.

---
 drivers/mmc/core/core.c  | 147 +++++++++++++++++++++++++++++++++++++++++++++--
 include/linux/mmc/core.h |   5 ++
 2 files changed, 147 insertions(+), 5 deletions(-)
drivers/mmc/core/core.c +142 -5
index b0af9db18eef..5a9d837599a1 100644
@@ -266,7 +266,8 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 	host->ops->request(host, mrq);
 }
 
-static void mmc_mrq_pr_debug(struct mmc_host *host, struct mmc_request *mrq)
+static void mmc_mrq_pr_debug(struct mmc_host *host, struct mmc_request *mrq,
+			     bool cqe)
 {
 	if (mrq->sbc) {
 		pr_debug("<%s: starting CMD%u arg %08x flags %08x>\n",
@@ -275,9 +276,12 @@ static void mmc_mrq_pr_debug(struct mmc_host *host, struct mmc_request *mrq)
 	}
 
 	if (mrq->cmd) {
-		pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
-			 mmc_hostname(host), mrq->cmd->opcode, mrq->cmd->arg,
-			 mrq->cmd->flags);
+		pr_debug("%s: starting %sCMD%u arg %08x flags %08x\n",
+			 mmc_hostname(host), cqe ? "CQE direct " : "",
+			 mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags);
+	} else if (cqe) {
+		pr_debug("%s: starting CQE transfer for tag %d blkaddr %u\n",
+			 mmc_hostname(host), mrq->tag, mrq->data->blk_addr);
 	}
 
 	if (mrq->data) {
@@ -345,7 +349,7 @@ static int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 	if (mmc_card_removed(host->card))
 		return -ENOMEDIUM;
 
-	mmc_mrq_pr_debug(host, mrq);
+	mmc_mrq_pr_debug(host, mrq, false);
 
 	WARN_ON(!host->claimed);
 
@@ -485,6 +489,139 @@ void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq)
 }
 EXPORT_SYMBOL(mmc_wait_for_req_done);
 
+int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)
+{
+	int err;
+
+	/* Caller must hold retuning while CQE is in use */
+	err = mmc_retune(host);
+	if (err)
+		goto out_err;
+
+	mrq->host = host;
+
+	mmc_mrq_pr_debug(host, mrq, true);
+
+	err = mmc_mrq_prep(host, mrq);
+	if (err)
+		goto out_err;
+
+	err = host->cqe_ops->cqe_request(host, mrq);
+	if (err)
+		goto out_err;
+
+	trace_mmc_request_start(host, mrq);
+
+	return 0;
+
+out_err:
+	if (mrq->cmd) {
+		pr_debug("%s: failed to start CQE direct CMD%u, error %d\n",
+			 mmc_hostname(host), mrq->cmd->opcode, err);
+	} else {
+		pr_debug("%s: failed to start CQE transfer for tag %d, error %d\n",
+			 mmc_hostname(host), mrq->tag, err);
+	}
+	return err;
+}
+EXPORT_SYMBOL(mmc_cqe_start_req);
+
+static void __mmc_cqe_request_done(struct mmc_host *host,
+				   struct mmc_request *mrq)
+{
+	mmc_should_fail_request(host, mrq);
+
+	/* Flag re-tuning needed on CRC errors */
+	if ((mrq->cmd && mrq->cmd->error == -EILSEQ) ||
+	    (mrq->data && mrq->data->error == -EILSEQ))
+		mmc_retune_needed(host);
+
+	trace_mmc_request_done(host, mrq);
+
+	if (mrq->cmd) {
+		pr_debug("%s: CQE req done (direct CMD%u): %d\n",
+			 mmc_hostname(host), mrq->cmd->opcode, mrq->cmd->error);
+	} else {
+		pr_debug("%s: CQE transfer done tag %d\n",
+			 mmc_hostname(host), mrq->tag);
+	}
+
+	if (mrq->data) {
+		pr_debug("%s:     %d bytes transferred: %d\n",
+			 mmc_hostname(host),
+			 mrq->data->bytes_xfered, mrq->data->error);
+	}
+}
+
+/**
+ *	mmc_cqe_request_done - CQE has finished processing an MMC request
+ *	@host: MMC host which completed request
+ *	@mrq: MMC request which completed
+ *
+ *	CQE drivers should call this function when they have completed
+ *	their processing of a request.
+ */
+void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq)
+{
+	__mmc_cqe_request_done(host, mrq);
+
+	mrq->done(mrq);
+}
+EXPORT_SYMBOL(mmc_cqe_request_done);
+
+/**
+ *	mmc_cqe_post_req - CQE post process of a completed MMC request
+ *	@host: MMC host
+ *	@mrq: MMC request to be processed
+ */
+void mmc_cqe_post_req(struct mmc_host *host, struct mmc_request *mrq)
+{
+	if (host->cqe_ops->cqe_post_req)
+		host->cqe_ops->cqe_post_req(host, mrq);
+}
+EXPORT_SYMBOL(mmc_cqe_post_req);
+
+/* Arbitrary 1 second timeout */
+#define MMC_CQE_RECOVERY_TIMEOUT	1000
+
+int mmc_cqe_recovery(struct mmc_host *host)
+{
+	struct mmc_command cmd;
+	int err;
+
+	mmc_retune_hold_now(host);
+
+	/*
+	 * Recovery is expected seldom, if at all, but it reduces performance,
+	 * so make sure it is not completely silent.
+	 */
+	pr_warn("%s: running CQE recovery\n", mmc_hostname(host));
+
+	host->cqe_ops->cqe_recovery_start(host);
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.opcode       = MMC_STOP_TRANSMISSION,
+	cmd.flags        = MMC_RSP_R1B | MMC_CMD_AC,
+	cmd.flags       &= ~MMC_RSP_CRC; /* Ignore CRC */
+	cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT,
+	mmc_wait_for_cmd(host, &cmd, 0);
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.opcode       = MMC_CMDQ_TASK_MGMT;
+	cmd.arg          = 1; /* Discard entire queue */
+	cmd.flags        = MMC_RSP_R1B | MMC_CMD_AC;
+	cmd.flags       &= ~MMC_RSP_CRC; /* Ignore CRC */
+	cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT,
+	err = mmc_wait_for_cmd(host, &cmd, 0);
+
+	host->cqe_ops->cqe_recovery_finish(host);
+
+	mmc_retune_release(host);
+
+	return err;
+}
+EXPORT_SYMBOL(mmc_cqe_recovery);
+
 /**
  *	mmc_is_req_done - Determine if a 'cap_cmd_during_tfr' request is done
  *	@host: MMC host
include/linux/mmc/core.h +5 -0
index bf1788a224e6..1974fcfd4284 100644
@@ -174,6 +174,11 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host,
 int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
 		int retries);
 
+int mmc_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq);
+void mmc_cqe_request_done(struct mmc_host *host, struct mmc_request *mrq);
+void mmc_cqe_post_req(struct mmc_host *host, struct mmc_request *mrq);
+int mmc_cqe_recovery(struct mmc_host *host);
+
 int mmc_hw_reset(struct mmc_host *host);
 void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);
 
Signature · 1 line
1.9.1
author maintainer
#6 lore raw

PATCH v3 6/11 mmc: mmc: Enable Command Queuing

In reply to Adrian Hunter

Enable the Command Queue if the host controller supports i a command queue engine. It is not compatible with Packed Commands, so do not enable that at the same time.

---
 drivers/mmc/core/mmc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/mmc/core/mmc.c +16 -1
index 4ffea14b7eb6..2ff0caf92bc8 100644
@@ -1783,6 +1783,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 		}
 	}
 
+	/* Enable Command Queue if supported */
+	card->ext_csd.cmdq_en = false;
+	if (card->ext_csd.cmdq_support && host->caps2 & MMC_CAP2_CQE) {
+		err = mmc_cmdq_enable(card);
+		if (err && err != -EBADMSG)
+			goto free_card;
+		if (err) {
+			pr_warn("%s: Enabling CMDQ failed\n",
+				mmc_hostname(card->host));
+			card->ext_csd.cmdq_support = false;
+			card->ext_csd.cmdq_depth = 0;
+			err = 0;
+		}
+	}
 	/*
 	 * In some cases (e.g. RPMB or mmc_test), the Command Queue must be
 	 * disabled for a time, so a flag is needed to indicate to re-enable the
@@ -1796,7 +1810,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 */
 	if (card->ext_csd.max_packed_writes >= 3 &&
 	    card->ext_csd.max_packed_reads >= 5 &&
-	    host->caps2 & MMC_CAP2_PACKED_CMD) {
+	    host->caps2 & MMC_CAP2_PACKED_CMD &&
+	    !card->ext_csd.cmdq_en) {
 		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
 				EXT_CSD_EXP_EVENTS_CTRL,
 				EXT_CSD_PACKED_EVENT_EN,
Signature · 1 line
1.9.1
author maintainer
#7 lore raw

PATCH v3 7/11 mmc: mmc: Enable CQE's

In reply to Adrian Hunter

Enable or disable CQE when a card is added or removed respectively.

---
 drivers/mmc/core/bus.c |  7 +++++++
 drivers/mmc/core/mmc.c | 13 +++++++++++++
 2 files changed, 20 insertions(+)
drivers/mmc/core/bus.c +7 -0
index 301246513a37..a4b49e25fe96 100644
@@ -369,10 +369,17 @@ int mmc_add_card(struct mmc_card *card)
  */
 void mmc_remove_card(struct mmc_card *card)
 {
+	struct mmc_host *host = card->host;
+
 #ifdef CONFIG_DEBUG_FS
 	mmc_remove_card_debugfs(card);
 #endif
 
+	if (host->cqe_enabled) {
+		host->cqe_ops->cqe_disable(host);
+		host->cqe_enabled = false;
+	}
+
 	if (mmc_card_present(card)) {
 		if (mmc_host_is_spi(card->host)) {
 			pr_info("%s: SPI card removed\n",
drivers/mmc/core/mmc.c +13 -0
index 2ff0caf92bc8..92c6167d64e0 100644
@@ -1804,6 +1804,19 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 */
 	card->reenable_cmdq = card->ext_csd.cmdq_en;
 
+	if (card->ext_csd.cmdq_en && (host->caps2 & MMC_CAP2_CQE) &&
+	    !host->cqe_enabled) {
+		err = host->cqe_ops->cqe_enable(host, card);
+		if (err) {
+			pr_err("%s: Failed to enable CQE, error %d\n",
+				mmc_hostname(host), err);
+		} else {
+			host->cqe_enabled = true;
+			pr_info("%s: Command Queue Engine enabled\n",
+				mmc_hostname(host));
+		}
+	}
+
 	/*
 	 * The mandatory minimum values are defined for packed command.
 	 * read: 5, write: 3
Signature · 1 line
1.9.1
author maintainer
#8 lore raw

PATCH v3 8/11 mmc: block: Prepare CQE data

In reply to Adrian Hunter

Enhance mmc_blk_data_prep() to support CQE requests.

---
 drivers/mmc/core/block.c | 45 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 11 deletions(-)
drivers/mmc/core/block.c +34 -11
index 3c7efbdc8591..cde5dd205e2b 100644
@@ -36,6 +36,7 @@
 #include <linux/compat.h>
 #include <linux/pm_runtime.h>
 #include <linux/idr.h>
+#include <linux/ioprio.h>
 
 #include <linux/mmc/ioctl.h>
 #include <linux/mmc/card.h>
@@ -1479,25 +1480,27 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
 }
 
 static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
-			      int disable_multi, bool *do_rel_wr,
-			      bool *do_data_tag)
+			      int disable_multi, bool *do_rel_wr_p,
+			      bool *do_data_tag_p)
 {
 	struct mmc_blk_data *md = mq->blkdata;
 	struct mmc_card *card = md->queue.card;
 	struct mmc_blk_request *brq = &mqrq->brq;
 	struct request *req = mmc_queue_req_to_req(mqrq);
+	bool do_rel_wr, do_data_tag;
 
 	/*
 	 * Reliable writes are used to implement Forced Unit Access and
 	 * are supported only on MMCs.
 	 */
-	*do_rel_wr = (req->cmd_flags & REQ_FUA) &&
-		     rq_data_dir(req) == WRITE &&
-		     (md->flags & MMC_BLK_REL_WR);
+	do_rel_wr = (req->cmd_flags & REQ_FUA) &&
+		    rq_data_dir(req) == WRITE &&
+		    (md->flags & MMC_BLK_REL_WR);
 
 	memset(brq, 0, sizeof(struct mmc_blk_request));
 
 	brq->mrq.data = &brq->data;
+	brq->mrq.tag = req->tag;
 
 	brq->stop.opcode = MMC_STOP_TRANSMISSION;
 	brq->stop.arg = 0;
@@ -1512,6 +1515,15 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
 
 	brq->data.blksz = 512;
 	brq->data.blocks = blk_rq_sectors(req);
+	brq->data.blk_addr = blk_rq_pos(req);
+
+	/*
+	 * The command queue supports 2 priorities: "high" (1) and "simple" (0).
+	 * The eMMC will give "high" priority tasks priority over "simple"
+	 * priority tasks. Here we give priority to IOPRIO_CLASS_RT.
+	 */
+	if (IOPRIO_PRIO_CLASS(req_get_ioprio(req)) == IOPRIO_CLASS_RT)
+		brq->data.flags |= MMC_DATA_PRIO;
 
 	/*
 	 * The block layer doesn't support all sector count
@@ -1541,18 +1553,23 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
 						brq->data.blocks);
 	}
 
-	if (*do_rel_wr)
+	if (do_rel_wr) {
 		mmc_apply_rel_rw(brq, card, req);
+		brq->data.flags |= MMC_DATA_REL_WR;
+	}
 
 	/*
 	 * Data tag is used only during writing meta data to speed
 	 * up write and any subsequent read of this meta data
 	 */
-	*do_data_tag = card->ext_csd.data_tag_unit_size &&
-		       (req->cmd_flags & REQ_META) &&
-		       (rq_data_dir(req) == WRITE) &&
-		       ((brq->data.blocks * brq->data.blksz) >=
-			card->ext_csd.data_tag_unit_size);
+	do_data_tag = card->ext_csd.data_tag_unit_size &&
+		      (req->cmd_flags & REQ_META) &&
+		      (rq_data_dir(req) == WRITE) &&
+		      ((brq->data.blocks * brq->data.blksz) >=
+		       card->ext_csd.data_tag_unit_size);
+
+	if (do_data_tag)
+		brq->data.flags |= MMC_DATA_DAT_TAG;
 
 	mmc_set_data_timeout(&brq->data, card);
 
@@ -1581,6 +1598,12 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
 	mqrq->areq.mrq = &brq->mrq;
 
 	mmc_queue_bounce_pre(mqrq);
+
+	if (do_rel_wr_p)
+		*do_rel_wr_p = do_rel_wr;
+
+	if (do_data_tag_p)
+		*do_data_tag_p = do_data_tag;
 }
 
 static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
Signature · 1 line
1.9.1
author maintainer
#9 lore raw

PATCH v3 9/11 mmc: block: Add CQE support

In reply to Adrian Hunter

Add CQE support to the block driver, including:
- optionally using DCMD for flush requests
- manually issuing discard requests
- issuing read / write requests to the CQE
- supporting block-layer timeouts
- handling recovery
- supporting re-tuning

---
 drivers/mmc/core/block.c | 195 ++++++++++++++++++++++++++++++++-
 drivers/mmc/core/block.h |   7 ++
 drivers/mmc/core/queue.c | 273 ++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/mmc/core/queue.h |  42 +++++++-
 4 files changed, 510 insertions(+), 7 deletions(-)
drivers/mmc/core/block.c +194 -1
index cde5dd205e2b..900936693ba5 100644
@@ -109,6 +109,7 @@ struct mmc_blk_data {
 #define MMC_BLK_WRITE		BIT(1)
 #define MMC_BLK_DISCARD		BIT(2)
 #define MMC_BLK_SECDISCARD	BIT(3)
+#define MMC_BLK_CQE_RECOVERY	BIT(4)
 
 	/*
 	 * Only set in main mmc_blk_data associated
@@ -1606,6 +1607,198 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
 		*do_data_tag_p = do_data_tag;
 }
 
+#define MMC_CQE_RETRIES 2
+
+void mmc_blk_cqe_complete_rq(struct request *req)
+{
+	struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req);
+	struct mmc_request *mrq = &mqrq->brq.mrq;
+	struct request_queue *q = req->q;
+	struct mmc_queue *mq = q->queuedata;
+	struct mmc_host *host = mq->card->host;
+	unsigned long flags;
+	bool put_card;
+	int err;
+
+	mmc_cqe_post_req(host, mrq);
+
+	spin_lock_irqsave(q->queue_lock, flags);
+
+	mq->cqe_in_flight[mmc_cqe_issue_type(host, req)] -= 1;
+
+	put_card = mmc_cqe_tot_in_flight(mq) == 0;
+
+	if (mrq->cmd && mrq->cmd->error)
+		err = mrq->cmd->error;
+	else if (mrq->data && mrq->data->error)
+		err = mrq->data->error;
+	else
+		err = 0;
+
+	if (err) {
+		if (mqrq->retries++ < MMC_CQE_RETRIES)
+			blk_requeue_request(q, req);
+		else
+			__blk_end_request_all(req, -EIO);
+	} else if (mrq->data) {
+		if (__blk_end_request(req, 0, mrq->data->bytes_xfered))
+			blk_requeue_request(q, req);
+	} else {
+		__blk_end_request_all(req, 0);
+	}
+
+	mmc_cqe_kick_queue(mq);
+
+	spin_unlock_irqrestore(q->queue_lock, flags);
+
+	if (put_card)
+		mmc_put_card(mq->card);
+}
+
+void mmc_blk_cqe_recovery(struct mmc_queue *mq)
+{
+	struct mmc_card *card = mq->card;
+	struct mmc_host *host = card->host;
+	int err;
+
+	mmc_get_card(card);
+
+	pr_debug("%s: CQE recovery start\n", mmc_hostname(host));
+
+	mq->cqe_in_recovery = true;
+
+	err = mmc_cqe_recovery(host);
+	if (err)
+		mmc_blk_reset(mq->blkdata, host, MMC_BLK_CQE_RECOVERY);
+	else
+		mmc_blk_reset_success(mq->blkdata, MMC_BLK_CQE_RECOVERY);
+
+	mq->cqe_in_recovery = false;
+
+	pr_debug("%s: CQE recovery done\n", mmc_hostname(host));
+
+	mmc_put_card(card);
+}
+
+static void mmc_blk_cqe_req_done(struct mmc_request *mrq)
+{
+	struct mmc_queue_req *mqrq = container_of(mrq, struct mmc_queue_req,
+						  brq.mrq);
+	struct request *req = mmc_queue_req_to_req(mqrq);
+	struct request_queue *q = req->q;
+	struct mmc_queue *mq = q->queuedata;
+
+	/*
+	 * Block layer timeouts race with completions which means the normal
+	 * completion path cannot be used during recovery.
+	 */
+	if (mq->cqe_in_recovery)
+		mmc_blk_cqe_complete_rq(req);
+	else
+		blk_complete_request(req);
+}
+
+static int mmc_blk_cqe_start_req(struct mmc_host *host, struct mmc_request *mrq)
+{
+	mrq->done = mmc_blk_cqe_req_done;
+	return mmc_cqe_start_req(host, mrq);
+}
+
+static struct mmc_request *mmc_blk_cqe_prep_dcmd(struct mmc_queue_req *mqrq,
+						 struct request *req)
+{
+	struct mmc_blk_request *brq = &mqrq->brq;
+
+	memset(brq, 0, sizeof(*brq));
+
+	brq->mrq.cmd = &brq->cmd;
+	brq->mrq.tag = req->tag;
+
+	return &brq->mrq;
+}
+
+static int mmc_blk_cqe_issue_flush(struct mmc_queue *mq, struct request *req)
+{
+	struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req);
+	struct mmc_request *mrq = mmc_blk_cqe_prep_dcmd(mqrq, req);
+
+	mrq->cmd->opcode = MMC_SWITCH;
+	mrq->cmd->arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
+			(EXT_CSD_FLUSH_CACHE << 16) |
+			(1 << 8) |
+			EXT_CSD_CMD_SET_NORMAL;
+	mrq->cmd->flags = MMC_CMD_AC | MMC_RSP_R1B;
+
+	return mmc_blk_cqe_start_req(mq->card->host, mrq);
+}
+
+static int mmc_blk_cqe_issue_rw_rq(struct mmc_queue *mq, struct request *req)
+{
+	struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req);
+
+	mmc_blk_data_prep(mq, mqrq, 0, NULL, NULL);
+
+	return mmc_blk_cqe_start_req(mq->card->host, &mqrq->brq.mrq);
+}
+
+enum mmc_issued mmc_blk_cqe_issue_rq(struct mmc_queue *mq, struct request *req)
+{
+	struct mmc_blk_data *md = mq->blkdata;
+	struct mmc_card *card = md->queue.card;
+	struct mmc_host *host = card->host;
+	int ret;
+
+	ret = mmc_blk_part_switch(card, md);
+	if (ret)
+		return MMC_REQ_FAILED_TO_START;
+
+	switch (mmc_cqe_issue_type(host, req)) {
+	case MMC_ISSUE_SYNC:
+		ret = host->cqe_ops->cqe_wait_for_idle(host);
+		if (ret)
+			return MMC_REQ_BUSY;
+		switch (req_op(req)) {
+		case REQ_OP_DRV_IN:
+		case REQ_OP_DRV_OUT:
+			mmc_blk_issue_drv_op(mq, req);
+			break;
+		case REQ_OP_DISCARD:
+			mmc_blk_issue_discard_rq(mq, req);
+			break;
+		case REQ_OP_SECURE_ERASE:
+			mmc_blk_issue_secdiscard_rq(mq, req);
+			break;
+		case REQ_OP_FLUSH:
+			mmc_blk_issue_flush(mq, req);
+			break;
+		default:
+			WARN_ON_ONCE(1);
+			return MMC_REQ_FAILED_TO_START;
+		}
+		return MMC_REQ_FINISHED;
+	case MMC_ISSUE_DCMD:
+	case MMC_ISSUE_ASYNC:
+		switch (req_op(req)) {
+		case REQ_OP_FLUSH:
+			ret = mmc_blk_cqe_issue_flush(mq, req);
+			break;
+		case REQ_OP_READ:
+		case REQ_OP_WRITE:
+			ret = mmc_blk_cqe_issue_rw_rq(mq, req);
+			break;
+		default:
+			WARN_ON_ONCE(1);
+			ret = -EINVAL;
+		}
+		if (!ret)
+			return MMC_REQ_STARTED;
+		return ret == -EBUSY ? MMC_REQ_BUSY : MMC_REQ_FAILED_TO_START;
+	default:
+		WARN_ON_ONCE(1);
+		return MMC_REQ_FAILED_TO_START;
+	}
+}
+
 static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
 			       struct mmc_card *card,
 			       int disable_multi,
@@ -2029,7 +2222,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	INIT_LIST_HEAD(&md->part);
 	md->usage = 1;
 
-	ret = mmc_init_queue(&md->queue, card, &md->lock, subname);
+	ret = mmc_init_queue(&md->queue, card, &md->lock, subname, area_type);
 	if (ret)
 		goto err_putdisk;
 
drivers/mmc/core/block.h +7 -0
index 860ca7c8df86..d7b3d7008b00 100644
@@ -6,4 +6,11 @@
 
 void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req);
 
+enum mmc_issued;
+
+enum mmc_issued mmc_blk_cqe_issue_rq(struct mmc_queue *mq,
+				     struct request *req);
+void mmc_blk_cqe_complete_rq(struct request *rq);
+void mmc_blk_cqe_recovery(struct mmc_queue *mq);
+
 #endif
drivers/mmc/core/queue.c +268 -5

311 lines not on this page · raw message

drivers/mmc/core/queue.h +41 -1

67 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#10 lore raw

PATCH v3 10/11 mmc: cqhci: support for command queue enabled host

In reply to Adrian Hunter

From: Venkat Gopalakrishnan <[email protected]>

This patch adds CMDQ support for command-queue compatible hosts.

Command queue is added in eMMC-5.1 specification. This enables the controller to process upto 32 requests at a time.

Adrian Hunter contributed renaming to cqhci, recovery, suspend and resume, cqhci_off, cqhci_wait_for_idle, and external timeout handling.

---
 drivers/mmc/host/Kconfig  |   13 +
 drivers/mmc/host/Makefile |    1 +
 drivers/mmc/host/cqhci.c  | 1146 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/cqhci.h  |  240 ++++++++++
 4 files changed, 1400 insertions(+)
 create mode 100644 drivers/mmc/host/cqhci.c
 create mode 100644 drivers/mmc/host/cqhci.h
drivers/mmc/host/Kconfig +13 -0
index 5755b69f2f72..eb6f71a3594e 100644
@@ -815,6 +815,19 @@ config MMC_SUNXI
 	  This selects support for the SD/MMC Host Controller on
 	  Allwinner sunxi SoCs.
 
+config MMC_CQHCI
+	tristate "Command Queue Host Controller Interface support"
+	depends on HAS_DMA
+	help
+	  This selects the Command Queue Host Controller Interface (CQHCI)
+	  support present in host controllers of Qualcomm Technologies, Inc
+	  amongst others.
+	  This controller supports eMMC devices with command queue support.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_TOSHIBA_PCI
 	tristate "Toshiba Type A SD/MMC Card Interface Driver"
 	depends on PCI
drivers/mmc/host/Makefile +1 -0
index 4d4547116311..01f9ba8b688b 100644
@@ -82,6 +82,7 @@ obj-$(CONFIG_MMC_SDHCI_MSM)		+= sdhci-msm.o
 obj-$(CONFIG_MMC_SDHCI_ST)		+= sdhci-st.o
 obj-$(CONFIG_MMC_SDHCI_MICROCHIP_PIC32)	+= sdhci-pic32.o
 obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
+obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
 	CFLAGS-cb710-mmc	+= -DDEBUG
drivers/mmc/host/cqhci.c new file +1146 -0

1,146 lines not on this page · raw message

drivers/mmc/host/cqhci.h new file +240 -0

240 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#11 lore raw

PATCH v3 11/11 mmc: sdhci-pci: Add CQHCI support for Intel GLK

In reply to Adrian Hunter

Add CQHCI initialization and implement CQHCI operations for Intel GLK.

---
 drivers/mmc/host/Kconfig          |   1 +
 drivers/mmc/host/sdhci-pci-core.c | 153 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 153 insertions(+), 1 deletion(-)
drivers/mmc/host/Kconfig +1 -0
index eb6f71a3594e..84e89d60da91 100644
@@ -72,6 +72,7 @@ config MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
 config MMC_SDHCI_PCI
 	tristate "SDHCI support on PCI bus"
 	depends on MMC_SDHCI && PCI
+	select MMC_CQHCI
 	help
 	  This selects the PCI Secure Digital Host Controller Interface.
 	  Most controllers found today are PCI devices.
drivers/mmc/host/sdhci-pci-core.c +152 -1

201 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#12 lore raw
In reply to Adrian Hunter
Quoted 6 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

Is there any chance of this being queued for v4.13?

I really don't see any advantage to delaying these patches. It just increases the difficulty of the inevitable backport, something Haibo Chen is now experiencing. The new code in the core is pretty small and self-contained, so it is easy to see that there is little impact to anything outside cmdq.

Tested-by on the v3 series
#13 lore raw
In reply to Adrian Hunter

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan. Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

But at least currently feels free to add:

Thanks.

[1]:

[    2.859981] Synopsys Designware Multimedia Card Interface Driver
[    2.924875] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.994768] mmc0: CQHCI version 5.10
[    3.053787] mmc0: SDHCI controller on fe330000.sdhci [fe330000.sdhci] using ADMA
[    3.073534] ledtrig-cpu: registered to indicate activity on CPUs
[    3.079239] usbcore: registered new interface driver usbhid
[    3.080183] usbhid: USB HID core driver
[    3.094221] NET: Registered protocol family 17
[    3.095069] 9pnet: Installing 9P2000 support
[    3.095710] Key type dns_resolver registered
[    3.098371] registered taskstats version 1
[    3.155130] hctosys: unable to open rtc device (rtc0)
[    3.166186] mmc0: Command Queue Engine enabled
[    3.168514] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    3.188861] mmcblk0: mmc0:0001 AJNB4R 14.6 GiB
[    3.200381] mmcblk0boot0: mmc0:0001 AJNB4R partition 1 4.00 MiB
[    3.200702] ALSA device list:
[    3.200747]   No soundcards found.
[    3.204146] ttyS2 - failed to request DMA
[    3.212363] mmcblk0boot1: mmc0:0001 AJNB4R partition 2 4.00 MiB
[    3.221031] mmcblk0rpmb: mmc0:0001 AJNB4R partition 3 4.00 MiB
[    3.277636]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    3.522777] EXT4-fs (mmcblk0p7): recovery complete
[    3.523907] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data mode. Opts: (null)
[    3.524699] VFS: Mounted root (ext4 filesystem) on device 179:7.
Quoted 72 lines

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority. Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

  drivers/mmc/core/block.c          |  240 +++++++-
  drivers/mmc/core/block.h          |    7 +
  drivers/mmc/core/bus.c            |    7 +
  drivers/mmc/core/core.c           |  156 ++++-
  drivers/mmc/core/host.c           |    6 +
  drivers/mmc/core/host.h           |    1 +
  drivers/mmc/core/mmc.c            |   30 +-
  drivers/mmc/core/queue.c          |  273 ++++++++-
  drivers/mmc/core/queue.h          |   42 +-
  drivers/mmc/host/Kconfig          |   14 +
  drivers/mmc/host/Makefile         |    1 +
  drivers/mmc/host/cqhci.c          | 1146 +++++++++++++++++++++++++++++++++++++
  drivers/mmc/host/cqhci.h          |  240 ++++++++
  drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
  include/linux/mmc/core.h          |   18 +-
  include/linux/mmc/host.h          |   24 +
  include/trace/events/mmc.h        |   36 +-
  17 files changed, 2354 insertions(+), 40 deletions(-)

create mode 100644 drivers/mmc/host/cqhci.c
create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
Quoted 35 lines

-----Original Message-----
From: Shawn Lin [mailto:[email protected]]
Sent: Wednesday, July 19, 2017 11:42 AM
To: Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Bough Chen <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak <[email protected]>; Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; David Griego <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan. Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

Quoted 8 lines

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

But at least currently feels free to add:

Hi Shawn,

Do you enable Runtime PM for cqhci? On my side, once enable cqhci runtime PM, always get timeout issue, I'm debug this issue these days. If not add runtime PM support for cqhci, everything work fine including DCMD.

Haibo Chen

Quoted 106 lines

Thanks.

[1]:

[    2.859981] Synopsys Designware Multimedia Card Interface Driver
[    2.924875] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.994768] mmc0: CQHCI version 5.10
[    3.053787] mmc0: SDHCI controller on fe330000.sdhci [fe330000.sdhci]
using ADMA
[    3.073534] ledtrig-cpu: registered to indicate activity on CPUs
[    3.079239] usbcore: registered new interface driver usbhid
[    3.080183] usbhid: USB HID core driver
[    3.094221] NET: Registered protocol family 17
[    3.095069] 9pnet: Installing 9P2000 support
[    3.095710] Key type dns_resolver registered
[    3.098371] registered taskstats version 1
[    3.155130] hctosys: unable to open rtc device (rtc0)
[    3.166186] mmc0: Command Queue Engine enabled
[    3.168514] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    3.188861] mmcblk0: mmc0:0001 AJNB4R 14.6 GiB
[    3.200381] mmcblk0boot0: mmc0:0001 AJNB4R partition 1 4.00 MiB
[    3.200702] ALSA device list:
[    3.200747]   No soundcards found.
[    3.204146] ttyS2 - failed to request DMA
[    3.212363] mmcblk0boot1: mmc0:0001 AJNB4R partition 2 4.00 MiB
[    3.221031] mmcblk0rpmb: mmc0:0001 AJNB4R partition 3 4.00 MiB
[    3.277636]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    3.522777] EXT4-fs (mmcblk0p7): recovery complete
[    3.523907] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data
mode. Opts: (null)
[    3.524699] VFS: Mounted root (ext4 filesystem) on device 179:7.
Quoted 41 lines

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority. Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

Quoted 12 lines
  drivers/mmc/core/block.c          |  240 +++++++-
  drivers/mmc/core/block.h          |    7 +
  drivers/mmc/core/bus.c            |    7 +
  drivers/mmc/core/core.c           |  156 ++++-
  drivers/mmc/core/host.c           |    6 +
  drivers/mmc/core/host.h           |    1 +
  drivers/mmc/core/mmc.c            |   30 +-
  drivers/mmc/core/queue.c          |  273 ++++++++-
  drivers/mmc/core/queue.h          |   42 +-
  drivers/mmc/host/Kconfig          |   14 +
  drivers/mmc/host/Makefile         |    1 +
  drivers/mmc/host/cqhci.c          | 1146

+++++++++++++++++++++++++++++++++++++

Quoted 19 lines
  drivers/mmc/host/cqhci.h          |  240 ++++++++
  drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
  include/linux/mmc/core.h          |   18 +-
  include/linux/mmc/host.h          |   24 +
  include/trace/events/mmc.h        |   36 +-
  17 files changed, 2354 insertions(+), 40 deletions(-)

create mode 100644 drivers/mmc/host/cqhci.c
create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Hi Bough,

Quoted 39 lines · Bough Chen
Quoted 39 lines

-----Original Message-----
From: Shawn Lin [mailto:[email protected]]
Sent: Wednesday, July 19, 2017 11:42 AM
To: Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Bough Chen <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak <[email protected]>; Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; David Griego <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan. Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

Quoted 8 lines
Quoted 4 lines

But at least currently feels free to add:

Hi Shawn,

Do you enable Runtime PM for cqhci? On my side, once enable cqhci runtime PM, always get timeout issue, I'm debug this issue these days. If not add runtime PM support for cqhci, everything work fine including DCMD.

Aha, no!

I said "I need more test" which should include runtime PM. As you could see sdhci-of-arsan still lacks proper runtime PM support, so I will try to hack it locally and re-test cqe then.

Thanks.

Quoted 116 lines

Haibo Chen

Quoted 86 lines

Thanks.

[1]:

[    2.859981] Synopsys Designware Multimedia Card Interface Driver
[    2.924875] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.994768] mmc0: CQHCI version 5.10
[    3.053787] mmc0: SDHCI controller on fe330000.sdhci [fe330000.sdhci]
using ADMA
[    3.073534] ledtrig-cpu: registered to indicate activity on CPUs
[    3.079239] usbcore: registered new interface driver usbhid
[    3.080183] usbhid: USB HID core driver
[    3.094221] NET: Registered protocol family 17
[    3.095069] 9pnet: Installing 9P2000 support
[    3.095710] Key type dns_resolver registered
[    3.098371] registered taskstats version 1
[    3.155130] hctosys: unable to open rtc device (rtc0)
[    3.166186] mmc0: Command Queue Engine enabled
[    3.168514] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    3.188861] mmcblk0: mmc0:0001 AJNB4R 14.6 GiB
[    3.200381] mmcblk0boot0: mmc0:0001 AJNB4R partition 1 4.00 MiB
[    3.200702] ALSA device list:
[    3.200747]   No soundcards found.
[    3.204146] ttyS2 - failed to request DMA
[    3.212363] mmcblk0boot1: mmc0:0001 AJNB4R partition 2 4.00 MiB
[    3.221031] mmcblk0rpmb: mmc0:0001 AJNB4R partition 3 4.00 MiB
[    3.277636]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    3.522777] EXT4-fs (mmcblk0p7): recovery complete
[    3.523907] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data
mode. Opts: (null)
[    3.524699] VFS: Mounted root (ext4 filesystem) on device 179:7.
Quoted 41 lines

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority. Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

Quoted 12 lines
   drivers/mmc/core/block.c          |  240 +++++++-
   drivers/mmc/core/block.h          |    7 +
   drivers/mmc/core/bus.c            |    7 +
   drivers/mmc/core/core.c           |  156 ++++-
   drivers/mmc/core/host.c           |    6 +
   drivers/mmc/core/host.h           |    1 +
   drivers/mmc/core/mmc.c            |   30 +-
   drivers/mmc/core/queue.c          |  273 ++++++++-
   drivers/mmc/core/queue.h          |   42 +-
   drivers/mmc/host/Kconfig          |   14 +
   drivers/mmc/host/Makefile         |    1 +
   drivers/mmc/host/cqhci.c          | 1146
Quoted 20 lines

+++++++++++++++++++++++++++++++++++++

Quoted 19 lines
   drivers/mmc/host/cqhci.h          |  240 ++++++++
   drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
   include/linux/mmc/core.h          |   18 +-
   include/linux/mmc/host.h          |   24 +
   include/trace/events/mmc.h        |   36 +-
   17 files changed, 2354 insertions(+), 40 deletions(-)

create mode 100644 drivers/mmc/host/cqhci.c
create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

Hi Bough,

Quoted 48 lines · Shawn Lin

Hi Bough,

Quoted 45 lines · Bough Chen
Quoted 35 lines

-----Original Message-----
From: Shawn Lin [mailto:[email protected]]
Sent: Wednesday, July 19, 2017 11:42 AM
To: Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Bough Chen <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak <[email protected]>; Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; David Griego <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan. Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

Quoted 8 lines

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

But at least currently feels free to add:

Hi Shawn,

Quoted 9 lines
Quoted 2 lines

Do you enable Runtime PM for cqhci? On my side, once enable cqhci runtime PM, always get timeout issue, I'm debug this issue these days. If not add runtime PM support for cqhci, everything work fine including DCMD.

Aha, no!

I said "I need more test" which should include runtime PM. As you could see sdhci-of-arsan still lacks proper runtime PM support, so I will try to hack it locally and re-test cqe then.

Well, I add runtime PM support for sdhci-of-arasan locally and re-test CQE again. All thing work well as expected for two hours!

Quoted 121 lines

Thanks.

Quoted 115 lines

Haibo Chen

Quoted 106 lines

Thanks.

[1]:

[    2.859981] Synopsys Designware Multimedia Card Interface Driver
[    2.924875] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.994768] mmc0: CQHCI version 5.10
[    3.053787] mmc0: SDHCI controller on fe330000.sdhci [fe330000.sdhci]
using ADMA
[    3.073534] ledtrig-cpu: registered to indicate activity on CPUs
[    3.079239] usbcore: registered new interface driver usbhid
[    3.080183] usbhid: USB HID core driver
[    3.094221] NET: Registered protocol family 17
[    3.095069] 9pnet: Installing 9P2000 support
[    3.095710] Key type dns_resolver registered
[    3.098371] registered taskstats version 1
[    3.155130] hctosys: unable to open rtc device (rtc0)
[    3.166186] mmc0: Command Queue Engine enabled
[    3.168514] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    3.188861] mmcblk0: mmc0:0001 AJNB4R 14.6 GiB
[    3.200381] mmcblk0boot0: mmc0:0001 AJNB4R partition 1 4.00 MiB
[    3.200702] ALSA device list:
[    3.200747]   No soundcards found.
[    3.204146] ttyS2 - failed to request DMA
[    3.212363] mmcblk0boot1: mmc0:0001 AJNB4R partition 2 4.00 MiB
[    3.221031] mmcblk0rpmb: mmc0:0001 AJNB4R partition 3 4.00 MiB
[    3.277636]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    3.522777] EXT4-fs (mmcblk0p7): recovery complete
[    3.523907] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data
mode. Opts: (null)
[    3.524699] VFS: Mounted root (ext4 filesystem) on device 179:7.
Quoted 41 lines

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority.
Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

Quoted 12 lines
   drivers/mmc/core/block.c          |  240 +++++++-
   drivers/mmc/core/block.h          |    7 +
   drivers/mmc/core/bus.c            |    7 +
   drivers/mmc/core/core.c           |  156 ++++-
   drivers/mmc/core/host.c           |    6 +
   drivers/mmc/core/host.h           |    1 +
   drivers/mmc/core/mmc.c            |   30 +-
   drivers/mmc/core/queue.c          |  273 ++++++++-
   drivers/mmc/core/queue.h          |   42 +-
   drivers/mmc/host/Kconfig          |   14 +
   drivers/mmc/host/Makefile         |    1 +
   drivers/mmc/host/cqhci.c          | 1146

+++++++++++++++++++++++++++++++++++++

Quoted 19 lines
   drivers/mmc/host/cqhci.h          |  240 ++++++++
   drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
   include/linux/mmc/core.h          |   18 +-
   include/linux/mmc/host.h          |   24 +
   include/trace/events/mmc.h        |   36 +-
   17 files changed, 2354 insertions(+), 40 deletions(-)

create mode 100644 drivers/mmc/host/cqhci.c
create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-mmc"
in the body of a message to [email protected] More majordomo
info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tested-by
#17 lore raw
Quoted 79 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Shawn Lin
Sent: Wednesday, July 19, 2017 4:43 PM
To: Bough Chen <[email protected]>; Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak <[email protected]>; Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Bough,

Quoted 12 lines · Shawn Lin

Hi Bough,

Quoted 9 lines · Bough Chen
Quoted 9 lines

-----Original Message-----
From: Shawn Lin [mailto:[email protected]]
Sent: Wednesday, July 19, 2017 11:42 AM
To: Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Bough Chen <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak

<[email protected]>;

Quoted 46 lines
Quoted 34 lines
Quoted 34 lines

Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; David Griego <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan.
Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

But at least currently feels free to add:

Quoted 9 lines
Quoted 2 lines

Hi Shawn,

Do you enable Runtime PM for cqhci? On my side, once enable cqhci runtime PM, always get timeout issue, I'm debug this issue these days. If not add runtime PM support for cqhci, everything work fine including DCMD.

Aha, no!

Quoted 9 lines
Quoted 4 lines

I said "I need more test" which should include runtime PM. As you could see sdhci-of-arsan still lacks proper runtime PM support, so I will try to hack it locally and re-test cqe then.

Well, I add runtime PM support for sdhci-of-arasan locally and re-test CQE again. All thing work well as expected for two hours!

Hi Adrian,

After debug, I find the root cause of the runtime PM issue for imx8, it is our IC limitation, when we do
__cqhci_disable(), clear CQHCI_ENABLE of register CQHCI_CFG, it will impact the sdhci register 0x48, disable DMA and disable block count. When I restore these bits, cqhci runtime suspend/resume works well.

So now I'd like to add:

[    1.311132] sdhci: Secure Digital Host Controller Interface driver
[    1.317324] sdhci: Copyright(c) Pierre Ossman
[    1.322082] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.328626] mmc0: CQHCI version 5.10
[    1.375351] mmc0: SDHCI controller on 5b010000.usdhc [5b010000.usdhc] using ADMA
[    1.391558] galcore 80000000.imx8_gpu_ss: bound 53100000.gpu (ops gpu_ops)
[    1.398450] Galcore version 6.2.2.93313
[    1.477485] ledtrig-cpu: registered to indicate activity on CPUs
 [    1.477984] mmc0: Command Queue Engine enabled
[    1.478008] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    1.478585] mmcblk0: mmc0:0001 032G34 29.1 GiB
[    1.478741] mmcblk0boot0: mmc0:0001 032G34 partition 1 8.00 MiB
[    1.478892] mmcblk0boot1: mmc0:0001 032G34 partition 2 8.00 MiB
[    1.479039] mmcblk0rpmb: mmc0:0001 032G34 partition 3 4.00 MiB
Quoted 127 lines
Quoted 23 lines

Thanks.

Quoted 20 lines

Haibo Chen

Quoted 19 lines

Thanks.

[1]:

[    2.859981] Synopsys Designware Multimedia Card Interface Driver
[    2.924875] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.994768] mmc0: CQHCI version 5.10
[    3.053787] mmc0: SDHCI controller on fe330000.sdhci [fe330000.sdhci]
using ADMA
[    3.073534] ledtrig-cpu: registered to indicate activity on CPUs
[    3.079239] usbcore: registered new interface driver usbhid
[    3.080183] usbhid: USB HID core driver
[    3.094221] NET: Registered protocol family 17
[    3.095069] 9pnet: Installing 9P2000 support
[    3.095710] Key type dns_resolver registered
[    3.098371] registered taskstats version 1
[    3.155130] hctosys: unable to open rtc device (rtc0)
[    3.166186] mmc0: Command Queue Engine enabled
[    3.168514] mmc0: new HS400 Enhanced strobe MMC card at address

0001

Quoted 88 lines
Quoted 88 lines
Quoted 87 lines
[    3.188861] mmcblk0: mmc0:0001 AJNB4R 14.6 GiB
[    3.200381] mmcblk0boot0: mmc0:0001 AJNB4R partition 1 4.00 MiB
[    3.200702] ALSA device list:
[    3.200747]   No soundcards found.
[    3.204146] ttyS2 - failed to request DMA
[    3.212363] mmcblk0boot1: mmc0:0001 AJNB4R partition 2 4.00 MiB
[    3.221031] mmcblk0rpmb: mmc0:0001 AJNB4R partition 3 4.00 MiB
[    3.277636]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    3.522777] EXT4-fs (mmcblk0p7): recovery complete
[    3.523907] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data
mode. Opts: (null)
[    3.524699] VFS: Mounted root (ext4 filesystem) on device 179:7.
Quoted 41 lines

Is there any chance of this being queued for v4.13?

Changes since V2:
Dropped patches that have been applied. Re-based
Added "mmc: sdhci-pci: Add CQHCI support for Intel GLK"

Changes since V1:

"Share mmc request array between partitions" is dependent on changes in "Introduce queue semantics", so added that and block fixes:

Added "Fix is_waiting_last_req set incorrectly" Added "Fix cmd error reset failure path" Added "Use local var for mqrq_cur" Added "Introduce queue semantics"

Changes since RFC:

Re-based on next.
Added comment about command queue priority.
Added some acks and reviews.

Adrian Hunter (10):
mmc: core: Add mmc_retune_hold_now()
mmc: core: Add members to mmc_request and mmc_data for CQE's
mmc: host: Add CQE interface
mmc: core: Turn off CQE before sending commands
mmc: core: Add support for handling CQE requests
mmc: mmc: Enable Command Queuing
mmc: mmc: Enable CQE's
mmc: block: Prepare CQE data
mmc: block: Add CQE support
mmc: sdhci-pci: Add CQHCI support for Intel GLK

Venkat Gopalakrishnan (1):
mmc: cqhci: support for command queue enabled host

Quoted 12 lines
   drivers/mmc/core/block.c          |  240 +++++++-
   drivers/mmc/core/block.h          |    7 +
   drivers/mmc/core/bus.c            |    7 +
   drivers/mmc/core/core.c           |  156 ++++-
   drivers/mmc/core/host.c           |    6 +
   drivers/mmc/core/host.h           |    1 +
   drivers/mmc/core/mmc.c            |   30 +-
   drivers/mmc/core/queue.c          |  273 ++++++++-
   drivers/mmc/core/queue.h          |   42 +-
   drivers/mmc/host/Kconfig          |   14 +
   drivers/mmc/host/Makefile         |    1 +
   drivers/mmc/host/cqhci.c          | 1146

+++++++++++++++++++++++++++++++++++++

Quoted 19 lines
   drivers/mmc/host/cqhci.h          |  240 ++++++++
   drivers/mmc/host/sdhci-pci-core.c |  153 ++++-
   include/linux/mmc/core.h          |   18 +-
   include/linux/mmc/host.h          |   24 +
   include/trace/events/mmc.h        |   36 +-
   17 files changed, 2354 insertions(+), 40 deletions(-)

create mode 100644 drivers/mmc/host/cqhci.c
create mode 100644 drivers/mmc/host/cqhci.h

Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 10 lines
Quoted 7 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html

author maintainer
#18 lore raw
Quoted 98 lines · Bough Chen
Quoted 79 lines

-----Original Message-----
From: [email protected] [mailto:linux-mmc- [email protected]] On Behalf Of Shawn Lin
Sent: Wednesday, July 19, 2017 4:43 PM
To: Bough Chen <[email protected]>; Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak <[email protected]>; Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Bough,

Quoted 12 lines · Shawn Lin

Hi Bough,

Quoted 9 lines · Bough Chen
Quoted 9 lines

-----Original Message-----
From: Shawn Lin [mailto:[email protected]]
Sent: Wednesday, July 19, 2017 11:42 AM
To: Adrian Hunter <[email protected]>; Ulf Hansson <[email protected]>
Cc: [email protected]; linux-mmc <[email protected]>; Bough Chen <[email protected]>; Alex Lemberg <[email protected]>; Mateusz Nowak

<[email protected]>;

Quoted 46 lines
Quoted 34 lines
Quoted 34 lines

Yuliy Izrailov <[email protected]>; Jaehoon Chung <[email protected]>; Dong Aisheng <[email protected]>; Das Asutosh <[email protected]>; Zhangfei Gao <[email protected]>; Dorfman Konstantin <[email protected]>; David Griego <[email protected]>; Sahitya Tummala <[email protected]>; Harjani Ritesh <[email protected]>; Venu Byravarasu <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: [PATCH V3 00/11] mmc: Add Command Queue support

Hi Adrian,

Quoted 5 lines · Adrian Hunter

Hi

Here is V3 of the hardware command queue patches without the software command queue patches.

I can now boot my board with v4.13 finally this morning[1] and apply this patchset and add my private patch for supporting CQE for sdhci-of-arasan.
Great to see it works and I don't see any regression until now. I need more test but I would appreciate it if Ulf can pick all these up into linux-next that folks can help to test and not need to manually apply them. And it will be easy for me to submit patch for sdhci-of-arasan to support CQE later.

I haven't have time to review all these, but I will do it next week. And I will also try to run more iozone/fio to see how much it gains when enabling CQE, comparing to non-CQE support.

But at least currently feels free to add:

Quoted 9 lines
Quoted 2 lines

Hi Shawn,

Do you enable Runtime PM for cqhci? On my side, once enable cqhci runtime PM, always get timeout issue, I'm debug this issue these days. If not add runtime PM support for cqhci, everything work fine including DCMD.

Aha, no!

Quoted 9 lines
Quoted 4 lines

I said "I need more test" which should include runtime PM. As you could see sdhci-of-arsan still lacks proper runtime PM support, so I will try to hack it locally and re-test cqe then.

Well, I add runtime PM support for sdhci-of-arasan locally and re-test CQE again. All thing work well as expected for two hours!

Hi Adrian,

After debug, I find the root cause of the runtime PM issue for imx8, it is our IC limitation, when we do
__cqhci_disable(), clear CQHCI_ENABLE of register CQHCI_CFG, it will impact the sdhci register 0x48, disable DMA and disable block count. When I restore these bits, cqhci runtime suspend/resume works well.

So now I'd like to add:

Quoted 16 lines
[    1.311132] sdhci: Secure Digital Host Controller Interface driver
[    1.317324] sdhci: Copyright(c) Pierre Ossman
[    1.322082] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.328626] mmc0: CQHCI version 5.10
[    1.375351] mmc0: SDHCI controller on 5b010000.usdhc [5b010000.usdhc] using ADMA
[    1.391558] galcore 80000000.imx8_gpu_ss: bound 53100000.gpu (ops gpu_ops)
[    1.398450] Galcore version 6.2.2.93313
[    1.477485] ledtrig-cpu: registered to indicate activity on CPUs
 [    1.477984] mmc0: Command Queue Engine enabled
[    1.478008] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    1.478585] mmcblk0: mmc0:0001 032G34 29.1 GiB
[    1.478741] mmcblk0boot0: mmc0:0001 032G34 partition 1 8.00 MiB
[    1.478892] mmcblk0boot1: mmc0:0001 032G34 partition 2 8.00 MiB
[    1.479039] mmcblk0rpmb: mmc0:0001 032G34 partition 3 4.00 MiB

I had to send V4 with 2 small changes:
Adjusted ...blk_end_request...() for new block status codes Fixed CQHCI transaction descriptor for "no DCMD" case