From dfff38316c1284c30c68d02cc424bad0562cf253 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 10 Jan 2025 16:33:13 +0000 Subject: [PATCH] mmc: bcm2835-sdhost Observe SWIOTLB memory limit Make sure the sdhost driver doesn't use requests bigger than SWIOTLB can handle. Copied from [1]. Link: https://github.com/raspberrypi/linux/issues/6589 Signed-off-by: Phil Elwell [1] d4dd9bccf485 ("mmc: bcm2835: Take SWIOTLB memory size limitation into account") --- drivers/mmc/host/bcm2835-sdhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c index 8e95a9df2f8812..b8fb5d5625a254 100644 --- a/drivers/mmc/host/bcm2835-sdhost.c +++ b/drivers/mmc/host/bcm2835-sdhost.c @@ -1971,7 +1971,7 @@ int bcm2835_sdhost_add_host(struct platform_device *pdev) } mmc->max_segs = 128; - mmc->max_req_size = 524288; + mmc->max_req_size = min_t(size_t, 524288, dma_max_mapping_size(&pdev->dev)); mmc->max_seg_size = mmc->max_req_size; mmc->max_blk_size = 512; mmc->max_blk_count = 65535;