]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: queue: Fix bigger segments usage
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Thu, 12 Sep 2019 04:13:55 +0000 (13:13 +0900)
committerChristoph Hellwig <hch@lst.de>
Thu, 12 Sep 2019 12:14:09 +0000 (13:14 +0100)
The commit 38c38cb73223 ("mmc: queue: use bigger segments if DMA MAP
layer can merge the segments") always enables the bugger segments
if DMA MAP layer can merge the segments, but some controllers (SDHCI)
have strictly limitation about the segments size, and then the commit
breaks on the controllers.

To fix the issue, this patch adds a new flag MMC_CAP2_MERGE_CAPABLE
into the struct mmc_host and the bigger segments usage is disabled
as default.

Reported-by: Thierry Reding <treding@nvidia.com>
Fixes: 38c38cb73223 ("mmc: queue: use bigger segments if DMA MAP layer can merge the segments")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/mmc/core/queue.c
include/linux/mmc/host.h

index 1e29b305767e6e50c0a9d40099f0a34deacf6d02..9edc08685e86d157141f98b2238eec79d47d3fc0 100644 (file)
@@ -399,6 +399,11 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
        init_waitqueue_head(&mq->wait);
 }
 
+static inline bool mmc_merge_capable(struct mmc_host *host)
+{
+       return host->caps2 & MMC_CAP2_MERGE_CAPABLE;
+}
+
 /* Set queue depth to get a reasonable value for q->nr_requests */
 #define MMC_QUEUE_DEPTH 64
 
@@ -441,7 +446,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card)
         * the host->can_dma_map_merge should be set before to get max_segs
         * from mmc_get_max_segments().
         */
-       if (host->max_segs < MMC_DMA_MAP_MERGE_SEGMENTS &&
+       if (mmc_merge_capable(host) &&
+           host->max_segs < MMC_DMA_MAP_MERGE_SEGMENTS &&
            dma_get_merge_boundary(mmc_dev(host)))
                host->can_dma_map_merge = 1;
        else
index c5662b3e64dbbd5c96adf777134079cee209519d..3becb28210f38ca88e1ca2f306a9d356780886cb 100644 (file)
@@ -367,6 +367,7 @@ struct mmc_host {
 #define MMC_CAP2_CQE           (1 << 23)       /* Has eMMC command queue engine */
 #define MMC_CAP2_CQE_DCMD      (1 << 24)       /* CQE can issue a direct command */
 #define MMC_CAP2_AVOID_3_3V    (1 << 25)       /* Host must negotiate down from 3.3V */
+#define MMC_CAP2_MERGE_CAPABLE (1 << 26)       /* Host can merge a segment over the segment size */
 
        int                     fixed_drv_type; /* fixed driver type for non-removable media */