mmc: core: Only set maximum DMA segment size if DMA is supported
Subsystems (2)
PATCH 1/1 mmc: core: Only set maximum DMA segment size if DMA is supported
Since upstream commit 334304ac2bac ("dma-mapping: don't return errors from dma_set_max_seg_size") calling dma_set_max_seg_size() on a device not supporting DMA results in a warning traceback. This is seen when booting the sifive_u machine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly sets dma_mask to NULL.
Avoid the backtrace by only calling dma_set_max_seg_size() if DMA is supported.
--- drivers/mmc/core/queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/queue.c +2 -1
@@ -388,7 +388,8 @@ static struct gendisk *mmc_alloc_disk(struct mmc_queue *mq,blk_queue_rq_timeout (mq->queue,60 *HZ ); -dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue)); +if (mmc_dev (host)->dma_parms) +dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue));INIT_WORK (&mq->recovery_work, mmc_mq_recovery_handler);INIT_WORK (&mq->complete_work, mmc_blk_mq_complete_work);
Signature · 1 line
2.45.2
Quoted 8 lines · Guenter Roeck
Since upstream commit
334304ac2bac("dma-mapping: don't return errors fromdma_set_max_seg_size") callingdma_set_max_seg_size()on a device not supporting DMA results in a warning traceback. This is seen when booting thesifive_umachine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly setsdma_maskto NULL.Avoid the backtrace by only calling
dma_set_max_seg_size()if DMA is supported.
Technicall this looks fine, although it would be nice avoid the overly long line.
Quoted 5 lines · Guenter Roeck
Since upstream commit
334304ac2bac("dma-mapping: don't return errors fromdma_set_max_seg_size") callingdma_set_max_seg_size()on a device not supporting DMA results in a warning traceback. This is seen when booting thesifive_umachine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly setsdma_maskto NULL.
Hmm, that driver probably shouldn't be doing that, but either way it's not actually relevant to this check - what's significant is that when the MMC host device is an "mmc-spi-slot" instance, its mmc_dev() ends up being the SPI *device* itself, not the grandparent SPI controller.
Thus the patch itself is appropriate on the basis that MMC hosts may exist on non-DMA-capable buses, so the subsystem needs to consider that.
Quoted 25 lines
Avoid the backtrace by only calling
dma_set_max_seg_size()if DMA is supported.Cc Christoph Hellwig <[email protected]>Cc Robin Murphy <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/mmc/core/queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/core/queue.c +2
-1@@ -388,7 +388,8 @@ static struct gendisk *mmc_alloc_disk(struct mmc_queue *mq,blk_queue_rq_timeout (mq->queue,60 *HZ ); -dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue)); +if (mmc_dev (host)->dma_parms) +dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue));INIT_WORK (&mq->recovery_work, mmc_mq_recovery_handler);INIT_WORK (&mq->complete_work, mmc_blk_mq_complete_work);
Quoted 5 lines · Guenter Roeck
Since upstream commit
334304ac2bac("dma-mapping: don't return errors fromdma_set_max_seg_size") callingdma_set_max_seg_size()on a device not supporting DMA results in a warning traceback. This is seen when booting thesifive_umachine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly setsdma_maskto NULL.
Thanks, seeing the same with mmc_spi on SiPeed MAIX BiT.
Quoted 7 lines
Avoid the backtrace by only calling
dma_set_max_seg_size()if DMA is supported.Cc Christoph Hellwig <[email protected]>Cc Robin Murphy <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 7 lines · Guenter Roeck
Since upstream commit
334304ac2bac("dma-mapping: don't return errors fromdma_set_max_seg_size") callingdma_set_max_seg_size()on a device not supporting DMA results in a warning traceback. This is seen when booting thesifive_umachine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly setsdma_maskto NULL.
Quoted 7 lines
Avoid the backtrace by only calling
dma_set_max_seg_size()if DMA is supported.Cc Christoph Hellwig <[email protected]>Cc Robin Murphy <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Applied for fixes, thanks!
Kind regards
Uffe
Quoted 21 lines
--- drivers/mmc/core/queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/mmc/core/queue.c +2
-2@@ -388,7 +388,8 @@ static struct gendisk *mmc_alloc_disk(struct mmc_queue *mq,blk_queue_rq_timeout (mq->queue,60 *HZ ); -dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue)); +if (mmc_dev (host)->dma_parms) +dma_set_max_seg_size (mmc_dev (host),queue_max_segment_size (mq->queue));INIT_WORK (&mq->recovery_work, mmc_mq_recovery_handler);INIT_WORK (&mq->complete_work, mmc_blk_mq_complete_work); --2.45.2
This patch was applied to riscv/linux.git (fixes) by Ulf Hansson <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (fixes)
by Ulf Hansson <[email protected]>:
Quoted 10 lines · On Tue, 24 Sep 2024 14:01:23 -0700 you wrote:
Since upstream commit
334304ac2bac("dma-mapping: don't return errors fromdma_set_max_seg_size") callingdma_set_max_seg_size()on a device not supporting DMA results in a warning traceback. This is seen when booting thesifive_umachine from SD. The underlying SPI controller (sifive,spi0 compatible) explicitly setsdma_maskto NULL.Avoid the backtrace by only calling
dma_set_max_seg_size()if DMA is supported.[...]
Here is the summary with links:
- mmc: core: Only set maximum DMA segment size if DMA is supported
https://git.kernel.org/riscv/c/c26339faed11
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html