Skip to contentSkip to conversation

MMC: Add MMC host software CQHCI interface

PATCH New Gray Jia 1 participant 1 message Sep 27, 2020

Subsystems (3)
lore
Share & tools
lore

Gray Jia

author
#0 lore raw

PATCH 1/1 MMC: Add MMC host software CQHCI interface

Some emmc hosts may not support cqhci hardware, but cmds can be sent
during data transmission.
In this case, using the traditional host send class11 cmds to manage
device cmdq(eMMC device after spec5.0) can gain the significant performance improvement. We have done experiments on the mtk platform(mt6761).
The performance shows that :
--benchmark(android apk: androbench speed: MB/s)
sequential_read sequential_write random_read random_write
w/ swcmdq 272 142 62 35
w/o swcmdq 270 142 25 34

Perhaps it can be called software cqhci infterface. And the source code
relies on the management of three 32-bits bitmaps for task management :
tasks to be set(cmd44/45),
tasks to be execute(cmd46/47),
tasks to be poll ready(cmd13 with qsr request).

---
 MAINTAINERS                 |   5 +
 drivers/mmc/core/queue.h    | 118 +---------
 drivers/mmc/host/Kconfig    |  11 +
 drivers/mmc/host/Makefile   |   1 +
 drivers/mmc/host/mtk-sd.c   | 307 ++++++++++++++++++++----
 drivers/mmc/host/sw-cqhci.c | 450 ++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sw-cqhci.h |  69 ++++++
 include/linux/mmc/host.h    |   1 +
 include/linux/mmc/queue.h   | 115 +++++++++
 9 files changed, 915 insertions(+), 162 deletions(-)
 create mode 100644 drivers/mmc/host/sw-cqhci.c
 create mode 100644 drivers/mmc/host/sw-cqhci.h
 create mode 100644 include/linux/mmc/queue.h
MAINTAINERS +5 -0
index deaafb617361..1f7856b1b002 100644
@@ -6401,6 +6401,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/mmc/host/cqhci*
 
+EMMC SW CMDQ HOST CONTROLLER INTERFACE (CQHCI) DRIVER
+M:	Gray Jia <[email protected]>
+S:	Supported
+F:	drivers/mmc/host/sw-cqhci.*
+
 EMULEX 10Gbps iSCSI - OneConnect DRIVER
 M:	Subbu Seetharaman <[email protected]>
 M:	Ketan Mukadam <[email protected]>
drivers/mmc/core/queue.h +7 -111

130 lines not on this page · raw message

drivers/mmc/host/Kconfig +11 -0
index 9c89a5b780e8..e0f59d675cf1 100644
@@ -977,6 +977,17 @@ config MMC_CQHCI
 
 	  If unsure, say N.
 
+config MMC_SW_CQHCI
+	tristate "Sofeware Command Queue Host Controller Interface support"
+	help
+	  Some mmc host maybe not have CQHCI hardware.
+	  This selects the Softeware Command Queue Host Controller Interface
+	  , which will get better performance but will consume more CPU time.
+
+	  If you want, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_HSQ
 	tristate "MMC Host Software Queue support"
 	help
drivers/mmc/host/Makefile +1 -0
index 4d5bcb0144a0..98e39853056b 100644
@@ -103,6 +103,7 @@ obj-$(CONFIG_MMC_SDHCI_BRCMSTB)		+= sdhci-brcmstb.o
 obj-$(CONFIG_MMC_SDHCI_OMAP)		+= sdhci-omap.o
 obj-$(CONFIG_MMC_SDHCI_SPRD)		+= sdhci-sprd.o
 obj-$(CONFIG_MMC_CQHCI)			+= cqhci.o
+obj-$(CONFIG_MMC_SW_CQHCI)		+= sw-cqhci.o
 obj-$(CONFIG_MMC_HSQ)			+= mmc_hsq.o
 
 ifeq ($(CONFIG_CB710_DEBUG),y)
drivers/mmc/host/mtk-sd.c +256 -51

462 lines not on this page · raw message

drivers/mmc/host/sw-cqhci.c new file +450 -0

450 lines not on this page · raw message

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

69 lines not on this page · raw message

include/linux/mmc/host.h +1 -0
index c5b6e97cb21a..aa02bd4ca4ee 100644
@@ -601,5 +601,6 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
 
 int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
 int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
+int mmc_send_status(struct mmc_card *card, u32 *status);
 
 #endif /* LINUX_MMC_HOST_H */
include/linux/mmc/queue.h new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.18.0