Patch "mmc: sdhci: Avoid swiotlb buffer being full" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
mmc: sdhci: Avoid swiotlb buffer being full
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mmc-sdhci-avoid-swiotlb-buffer-being-full.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
250dcd11466e06df64b92520e2c56bdae453581bMon Sep 17 00:00:00 2001
From: Ulf Hansson <[email protected]>
Date: Mon, 27 Nov 2017 11:28:50 +0100
Subject: mmc: sdhci: Avoid swiotlb buffer being full
From: Ulf Hansson <[email protected]>
commit 250dcd11466e06df64b92520e2c56bdae453581b upstream.
The commit de3ee99b097d ("mmc: Delete bounce buffer handling") deletes the bounce buffer handling, but also causes the max_req_size for sdhci to be increased, in case when max_segs == 1. This causes errors for sdhci-pci Ricoh variant, about the swiotlb buffer to become full.
Fix the issue, by taking IO_TLB_SEGSIZE and IO_TLB_SHIFT into account when deciding the max_req_size for sdhci.
--- drivers/mmc/host/sdhci.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/mmc/host/sdhci.c +18 -10
@@ -21,6 +21,7 @@#include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/scatterlist.h> +#include <linux/swiotlb.h> #include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> #include <linux/of.h>
@@ -3651,22 +3652,29 @@ int sdhci_setup_host(struct sdhci_host *spin_lock_init (&host->lock);/* +* Maximum number of sectors in one transfer. Limited by SDMA boundary +* size (512KiB). Note some tuning modes impose a 4MiB limit, but this +* is less anyway. +*/ + mmc->max_req_size =524288 ; + +/* * Maximum number of segments. Depends on if the hardware * can do scatter/gather or not. */ -if (host->flags &SDHCI_USE_ADMA ) +if (host->flags &SDHCI_USE_ADMA ) { mmc->max_segs =SDHCI_MAX_SEGS ; -else if (host->flags &SDHCI_USE_SDMA ) + }else if (host->flags &SDHCI_USE_SDMA ) { mmc->max_segs =1 ; -else /* PIO */ +if (swiotlb_max_segment ()) { +unsigned int max_req_size = (1 <<IO_TLB_SHIFT ) * +IO_TLB_SEGSIZE ; + mmc->max_req_size =min (mmc->max_req_size, + max_req_size); + } + }else {/* PIO */ mmc->max_segs =SDHCI_MAX_SEGS ; - -/* -* Maximum number of sectors in one transfer. Limited by SDMA boundary -* size (512KiB). Note some tuning modes impose a 4MiB limit, but this -* is less anyway. -*/ - mmc->max_req_size =524288 ; + }/* * Maximum segment size. Could be one segment with the maximum number
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/mmc-block-check-return-value-of-blk_get_request.patch queue-4.14/mmc-block-fix-missing-blk_put_request.patch queue-4.14/mmc-block-ensure-that-debugfs-files-are-removed.patch queue-4.14/mmc-core-do-not-leave-the-block-driver-in-a-suspended-state.patch queue-4.14/mmc-core-prepend-0x-to-ocr-entry-in-sysfs.patch queue-4.14/mmc-sdhci-avoid-swiotlb-buffer-being-full.patch queue-4.14/mmc-core-prepend-0x-to-pre_eol_info-entry-in-sysfs.patch