diff options
| author | Yoshihiro Shimoda <[email protected]> | 2019-09-12 04:13:55 +0000 |
|---|---|---|
| committer | Christoph Hellwig <[email protected]> | 2019-09-12 12:14:09 +0000 |
| commit | 427b00342c5a3ebcf31fac2ce3b21fb993952816 (patch) | |
| tree | 5b2a6de70bcea202ed9d516e1fc82aef6b4cb0b7 /drivers/mmc/core/queue.c | |
| parent | arm64: use asm-generic/dma-mapping.h (diff) | |
| download | kernel-427b00342c5a3ebcf31fac2ce3b21fb993952816.tar.gz kernel-427b00342c5a3ebcf31fac2ce3b21fb993952816.zip | |
mmc: queue: Fix bigger segments usage
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 <[email protected]>
Fixes: 38c38cb73223 ("mmc: queue: use bigger segments if DMA MAP layer can merge the segments")
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Acked-by: Ulf Hansson <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Diffstat (limited to 'drivers/mmc/core/queue.c')
| -rw-r--r-- | drivers/mmc/core/queue.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 1e29b305767e..9edc08685e86 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -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 |
