Skip to contentSkip to conversation

Revert "mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K"

PATCH In review Aurelien Jarno 2 participants 2 messages Nov 10, 2024 – Nov 12, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K"

The commit 8396c793ffdf ("mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K") increased the max_req_size, even for 4K pages, causing various issues:
- Panic booting the kernel/rootfs from an SD card on Rockchip RK3566
- Panic booting the kernel/rootfs from an SD card on StarFive JH7100
- "swiotlb buffer is full" and data corruption on StarFive JH7110

At this stage no fix have been found, so it's probably better to just revert the change.

This reverts commit 8396c793ffdf28bb8aee7cfe0891080f8cab7890.

---
 drivers/mmc/host/dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I have posted a patch to fix the issue, but unfortunately it only fixes the JH7110 case:
https://lore.kernel.org/linux-mmc/[email protected]/

drivers/mmc/host/dw_mmc.c +2 -2
index 41e451235f637..e9f6e4e622901 100644
@@ -2957,8 +2957,8 @@ static int dw_mci_init_slot(struct dw_mci *host)
 	if (host->use_dma == TRANS_MODE_IDMAC) {
 		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 = 0x1000;
+		mmc->max_req_size = mmc->max_seg_size * host->ring_size;
 		mmc->max_blk_count = mmc->max_req_size / 512;
 	} else if (host->use_dma == TRANS_MODE_EDMAC) {
 		mmc->max_segs = 64;
Signature · 1 line
2.45.2
#1 lore raw
Quoted 11 lines · Aurelien Jarno

The commit 8396c793ffdf ("mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K") increased the max_req_size, even for 4K pages, causing various issues:
- Panic booting the kernel/rootfs from an SD card on Rockchip RK3566
- Panic booting the kernel/rootfs from an SD card on StarFive JH7100
- "swiotlb buffer is full" and data corruption on StarFive JH7110

At this stage no fix have been found, so it's probably better to just revert the change.

Quoted 8 lines

This reverts commit 8396c793ffdf28bb8aee7cfe0891080f8cab7890.

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 26 lines
---
 drivers/mmc/host/dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

I have posted a patch to fix the issue, but unfortunately it only fixes the JH7110 case:
https://lore.kernel.org/linux-mmc/[email protected]/

drivers/mmc/host/dw_mmc.c +2 -3
index 41e451235f637..e9f6e4e622901 100644
@@ -2957,8 +2957,8 @@ static int dw_mci_init_slot(struct dw_mci *host)
        if (host->use_dma == TRANS_MODE_IDMAC) {
                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 = 0x1000;
+               mmc->max_req_size = mmc->max_seg_size * host->ring_size;
                mmc->max_blk_count = mmc->max_req_size / 512;
        } else if (host->use_dma == TRANS_MODE_EDMAC) {
                mmc->max_segs = 64;
--

2.45.2