All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match
@ 2018-04-04 17:00 Wolfram Sang
  2018-04-05  7:02 ` Ulf Hansson
  2018-04-06 14:07 ` Yoshihiro Shimoda
  0 siblings, 2 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-04-04 17:00 UTC (permalink / raw)
  To: linux-mmc, Yoshihiro Shimoda; +Cc: linux-renesas-soc, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

If we detect an incompatible scatterlist, we should fall back to PIO,
too.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

I found this while working on the RX DMA issue. I don't see a reason why we
shouldn't fall back in this case as well. But maybe I am missing something.

Shimoda-san: what do you think?

 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 380570a26a09..561e90755a3b 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -161,11 +161,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 	enum dma_data_direction dir;
 	int ret;
 
-	/* This DMAC cannot handle if sg_len is not 1 */
-	WARN_ON(host->sg_len > 1);
-
-	/* This DMAC cannot handle if buffer is not 8-bytes alignment */
-	if (!IS_ALIGNED(sg->offset, 8))
+	if (WARN_ON(host->sg_len > 1) || !IS_ALIGNED(sg->offset, 8))
 		goto force_pio;
 
 	if (data->flags & MMC_DATA_READ) {
-- 
2.11.0

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

* Re: [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match
  2018-04-04 17:00 [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match Wolfram Sang
@ 2018-04-05  7:02 ` Ulf Hansson
  2018-04-05 16:21   ` Wolfram Sang
  2018-04-06 14:07 ` Yoshihiro Shimoda
  1 sibling, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2018-04-05  7:02 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Yoshihiro Shimoda, Linux-Renesas, Wolfram Sang

On 4 April 2018 at 19:00, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> If we detect an incompatible scatterlist, we should fall back to PIO,
> too.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> I found this while working on the RX DMA issue. I don't see a reason why we
> shouldn't fall back in this case as well. But maybe I am missing something.
>
> Shimoda-san: what do you think?
>
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index 380570a26a09..561e90755a3b 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -161,11 +161,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
>         enum dma_data_direction dir;
>         int ret;
>
> -       /* This DMAC cannot handle if sg_len is not 1 */
> -       WARN_ON(host->sg_len > 1);
> -
> -       /* This DMAC cannot handle if buffer is not 8-bytes alignment */
> -       if (!IS_ALIGNED(sg->offset, 8))
> +       if (WARN_ON(host->sg_len > 1) || !IS_ALIGNED(sg->offset, 8))

The WARN_ON becomes a bit misleading being a part of the if statement,
as it should never happen when the driver has set ->max_segs = 1.

For the alignment check, and the moving to PIO, this certainly makes
sense to me.

>                 goto force_pio;
>
>         if (data->flags & MMC_DATA_READ) {

Kind regards
Uffe

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

* Re: [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match
  2018-04-05  7:02 ` Ulf Hansson
@ 2018-04-05 16:21   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-04-05 16:21 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Yoshihiro Shimoda, Linux-Renesas, Wolfram Sang

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]


> > -       /* This DMAC cannot handle if sg_len is not 1 */
> > -       WARN_ON(host->sg_len > 1);
> > -
> > -       /* This DMAC cannot handle if buffer is not 8-bytes alignment */
> > -       if (!IS_ALIGNED(sg->offset, 8))
> > +       if (WARN_ON(host->sg_len > 1) || !IS_ALIGNED(sg->offset, 8))
> 
> The WARN_ON becomes a bit misleading being a part of the if statement,
> as it should never happen when the driver has set ->max_segs = 1.

Uh, yeah, right. So, we could simply drop the WARN_ON?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* RE: [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match
  2018-04-04 17:00 [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match Wolfram Sang
  2018-04-05  7:02 ` Ulf Hansson
@ 2018-04-06 14:07 ` Yoshihiro Shimoda
  1 sibling, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2018-04-06 14:07 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Wolfram Sang

Hi Wolfram-san,

Thank you for the patch!

> From: Wolfram Sang, Sent: Thursday, April 5, 2018 2:01 AM
> 
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> If we detect an incompatible scatterlist, we should fall back to PIO,
> too.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> I found this while working on the RX DMA issue. I don't see a reason why we
> shouldn't fall back in this case as well. But maybe I am missing something.
> 
> Shimoda-san: what do you think?
> 
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index 380570a26a09..561e90755a3b 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -161,11 +161,7 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
>  	enum dma_data_direction dir;
>  	int ret;
> 
> -	/* This DMAC cannot handle if sg_len is not 1 */

I would like to keep this comment.

> -	WARN_ON(host->sg_len > 1);
> -
> -	/* This DMAC cannot handle if buffer is not 8-bytes alignment */
> -	if (!IS_ALIGNED(sg->offset, 8))
> +	if (WARN_ON(host->sg_len > 1) || !IS_ALIGNED(sg->offset, 8))

As Ulf-san said on other thread about this WARN_ON(),
I think dropping the WARN_ON() is better.

Best regards,
Yoshihiro Shimoda

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

end of thread, other threads:[~2018-04-06 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 17:00 [RFC PATCH] mmc: renesas_sdhi_internal_dmac: fall back to PIO if scatterlist doesn't match Wolfram Sang
2018-04-05  7:02 ` Ulf Hansson
2018-04-05 16:21   ` Wolfram Sang
2018-04-06 14:07 ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.