From: Aurelien Jarno <aurelien@aurel32.net>
To: William Qiu <william.qiu@starfivetech.com>,
linux-riscv@lists.infradead.org (open list:RISC-V MISC SOC
SUPPORT), Jaehoon Chung <jh80.chung@samsung.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Sam Protsenko <semen.protsenko@linaro.org>,
linux-mmc@vger.kernel.org (open list:SYNOPSYS DESIGNWARE
MMC/SD/SDIO DRIVER), linux-kernel@vger.kernel.org (open list)
Cc: Aurelien Jarno <aurelien@aurel32.net>, Ron Economos <re@w6rz.net>,
Jing Luo <jing@jing.rocks>,
stable@vger.kernel.org
Subject: [PATCH] mmc: dw_mmc: take SWIOTLB memory size limitation into account
Date: Sun, 20 Oct 2024 16:29:31 +0200 [thread overview]
Message-ID: <20241020142931.138277-1-aurelien@aurel32.net> (raw)
The Synopsys DesignWare mmc controller on the JH7110 SoC
(dw_mmc-starfive.c driver) is using a 32-bit IDMAC address bus width,
and thus requires the use of SWIOTLB.
The commit 8396c793ffdf ("mmc: dw_mmc: Fix IDMAC operation with pages
bigger than 4K") increased the max_seq_size, even for 4K pages, causing
"swiotlb buffer is full" to happen because swiotlb can only handle a
memory size up to 256kB only.
Fix the issue, by making sure the dw_mmc driver doesn't use segments
bigger than what SWIOTLB can handle.
Reported-by: Ron Economos <re@w6rz.net>
Reported-by: Jing Luo <jing@jing.rocks>
Fixes: 8396c793ffdf ("mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K")
Cc: stable@vger.kernel.org
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
drivers/mmc/host/dw_mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 41e451235f637..dc0d6201f7b73 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2958,7 +2958,8 @@ static int dw_mci_init_slot(struct dw_mci *host)
mmc->max_segs = host->ring_size;
mmc->max_blk_size = 65535;
mmc->max_req_size = DW_MCI_DESC_DATA_LENGTH * host->ring_size;
- mmc->max_seg_size = mmc->max_req_size;
+ mmc->max_seg_size =
+ min_t(size_t, mmc->max_req_size, dma_max_mapping_size(host->dev));
mmc->max_blk_count = mmc->max_req_size / 512;
} else if (host->use_dma == TRANS_MODE_EDMAC) {
mmc->max_segs = 64;
--
2.45.2
next reply other threads:[~2024-10-20 14:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 14:29 Aurelien Jarno [this message]
2024-10-21 6:07 ` Anand Moon
2024-10-21 15:26 ` Jing Luo
2024-10-22 12:42 ` Ulf Hansson
2024-10-27 12:16 ` Emil Renner Berthing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241020142931.138277-1-aurelien@aurel32.net \
--to=aurelien@aurel32.net \
--cc=jh80.chung@samsung.com \
--cc=jing@jing.rocks \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=re@w6rz.net \
--cc=semen.protsenko@linaro.org \
--cc=stable@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=william.qiu@starfivetech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®