mmc: sdhci-of-dwmshc: Add software queue support

Add newly added software queue support to improve random performance.
Testing condition: rk3588-evb1 32GB eMMC, CPU & DRAM fixed frequency

Random read test:

fio -filename=/dev/block/mmcblk0 -direct=1 -iodepth 20 -thread -rw=randread \
-ioengine=psync -bs=4k -size=1G -numjobs=20 -runtime=40 -group_reporting \
-name=rand_100read_4k

Random write test:

fio -filename=/data/fio.bin -direct=1 -iodepth 20 -thread -rw=randwrite \
-ioengine=psync -bs=4k -size=1G -numjobs=20 -runtime=40 -group_reporting \
-name=rand_100write_4k

======================================================================
|     -       |  W/O patch  | With patch applied|  improve percentage |
| random read | 45624KB/s   | 62542KB/s         |   +37%              |
| random write| 22548KB/s   | 27977KB/s         |   +24%              |
======================================================================

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I81dca2e9c45d1a1596ef810328f32c9a2779683c
This commit is contained in:
Shawn Lin
2022-11-08 11:40:45 +08:00
committed by Tao Huang
parent 1fda99416a
commit b0086261b6
2 changed files with 29 additions and 1 deletions

View File

@@ -207,6 +207,7 @@ config MMC_SDHCI_OF_DWCMSHC
depends on MMC_SDHCI_PLTFM
depends on OF
depends on COMMON_CLK
select MMC_HSQ
help
This selects Synopsys DesignWare Cores Mobile Storage Controller
support.

View File

@@ -20,6 +20,7 @@
#include <linux/sizes.h>
#include "sdhci-pltfm.h"
#include "mmc_hsq.h"
#define SDHCI_DWCMSHC_ARG2_STUFF GENMASK(31, 16)
@@ -331,6 +332,14 @@ static void rockchip_sdhci_reset(struct sdhci_host *host, u8 mask)
sdhci_reset(host, mask);
}
static void sdhci_dwcmshc_request_done(struct sdhci_host *host, struct mmc_request *mrq)
{
if (mmc_hsq_finalize_request(host->mmc, mrq))
return;
mmc_request_done(host->mmc, mrq);
}
static const struct sdhci_ops sdhci_dwcmshc_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
@@ -347,6 +356,7 @@ static const struct sdhci_ops sdhci_dwcmshc_rk_ops = {
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
.reset = rockchip_sdhci_reset,
.adma_write_desc = dwcmshc_adma_write_desc,
.request_done = sdhci_dwcmshc_request_done,
};
static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = {
@@ -441,6 +451,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
struct sdhci_host *host;
struct dwcmshc_priv *priv;
const struct dwcmshc_driver_data *drv_data;
struct mmc_hsq *hsq;
int err;
u32 extra;
@@ -494,6 +505,16 @@ static int dwcmshc_probe(struct platform_device *pdev)
host->mmc_host_ops.request = dwcmshc_request;
host->mmc_host_ops.hs400_enhanced_strobe = dwcmshc_hs400_enhanced_strobe;
hsq = devm_kzalloc(&pdev->dev, sizeof(*hsq), GFP_KERNEL);
if (!hsq) {
err = -ENOMEM;
goto err_clk;
}
err = mmc_hsq_init(hsq, host->mmc);
if (err)
goto err_clk;
err = sdhci_add_host(host);
if (err)
goto err_clk;
@@ -550,6 +571,8 @@ static int dwcmshc_suspend(struct device *dev)
struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
int ret;
mmc_hsq_suspend(host->mmc);
ret = sdhci_suspend_host(host);
if (ret)
return ret;
@@ -583,7 +606,11 @@ static int dwcmshc_resume(struct device *dev)
if (ret)
return ret;
return sdhci_resume_host(host);
ret = sdhci_resume_host(host);
if (ret)
return ret;
return mmc_hsq_resume(host->mmc);
}
static int dwcmshc_runtime_suspend(struct device *dev)