public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
@ 2024-09-24 21:01 Guenter Roeck
  2024-09-26  7:35 ` Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Guenter Roeck @ 2024-09-24 21:01 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Paul Walmsley, Samuel Holland, linux-mmc, linux-kernel,
	linux-riscv, Guenter Roeck, Christoph Hellwig, Robin Murphy

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.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/mmc/core/queue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index d0b3ca8a11f0..4d6844261912 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
  2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
@ 2024-09-26  7:35 ` Christoph Hellwig
  2024-09-26 15:56 ` Robin Murphy
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2024-09-26  7:35 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Ulf Hansson, Paul Walmsley, Samuel Holland, linux-mmc,
	linux-kernel, linux-riscv, Christoph Hellwig, Robin Murphy

On Tue, Sep 24, 2024 at 02:01:23PM -0700, Guenter Roeck wrote:
> 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.

Technicall this looks fine, although it would be nice avoid the overly
long line.

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
  2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
  2024-09-26  7:35 ` Christoph Hellwig
@ 2024-09-26 15:56 ` Robin Murphy
  2024-10-01 14:51 ` Geert Uytterhoeven
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Robin Murphy @ 2024-09-26 15:56 UTC (permalink / raw)
  To: Guenter Roeck, Ulf Hansson
  Cc: Paul Walmsley, Samuel Holland, linux-mmc, linux-kernel,
	linux-riscv, Christoph Hellwig

On 24/09/2024 10:01 pm, Guenter Roeck wrote:
> 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.

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.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Avoid the backtrace by only calling dma_set_max_seg_size() if DMA is
> supported.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/mmc/core/queue.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index d0b3ca8a11f0..4d6844261912 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -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);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
  2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
  2024-09-26  7:35 ` Christoph Hellwig
  2024-09-26 15:56 ` Robin Murphy
@ 2024-10-01 14:51 ` Geert Uytterhoeven
  2024-10-02 23:36 ` Ulf Hansson
  2024-11-12 22:53 ` patchwork-bot+linux-riscv
  4 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2024-10-01 14:51 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Ulf Hansson, Paul Walmsley, Samuel Holland, linux-mmc,
	linux-kernel, linux-riscv, Christoph Hellwig, Robin Murphy

On Tue, Sep 24, 2024 at 11:01 PM Guenter Roeck <linux@roeck-us.net> wrote:
> 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.

Thanks, seeing the same with mmc_spi on SiPeed MAIX BiT.

> Avoid the backtrace by only calling dma_set_max_seg_size() if DMA is
> supported.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
  2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
                   ` (2 preceding siblings ...)
  2024-10-01 14:51 ` Geert Uytterhoeven
@ 2024-10-02 23:36 ` Ulf Hansson
  2024-11-12 22:53 ` patchwork-bot+linux-riscv
  4 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2024-10-02 23:36 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Paul Walmsley, Samuel Holland, linux-mmc, linux-kernel,
	linux-riscv, Christoph Hellwig, Robin Murphy

On Tue, 24 Sept 2024 at 23:01, Guenter Roeck <linux@roeck-us.net> wrote:
>
> 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.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied for fixes, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/core/queue.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index d0b3ca8a11f0..4d6844261912 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported
  2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
                   ` (3 preceding siblings ...)
  2024-10-02 23:36 ` Ulf Hansson
@ 2024-11-12 22:53 ` patchwork-bot+linux-riscv
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-11-12 22:53 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-riscv, ulf.hansson, paul.walmsley, samuel.holland,
	linux-mmc, linux-kernel, hch, robin.murphy

Hello:

This patch was applied to riscv/linux.git (fixes)
by Ulf Hansson <ulf.hansson@linaro.org>:

On Tue, 24 Sep 2024 14:01:23 -0700 you wrote:
> 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-12 22:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 21:01 [PATCH] mmc: core: Only set maximum DMA segment size if DMA is supported Guenter Roeck
2024-09-26  7:35 ` Christoph Hellwig
2024-09-26 15:56 ` Robin Murphy
2024-10-01 14:51 ` Geert Uytterhoeven
2024-10-02 23:36 ` Ulf Hansson
2024-11-12 22:53 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox