All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: linux-mtd@lists.infradead.org
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	peda@axentia.se, nicolas.ferre@microchip.com,
	alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com,
	bbrezillon@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: atmel: Unmap streaming DMA mappings
Date: Fri, 29 Jul 2022 12:59:55 +0200	[thread overview]
Message-ID: <2099405.mp5hVA6q5l@ada> (raw)
In-Reply-To: <20220728074014.145406-1-tudor.ambarus@microchip.com>

Hello Tudor,

Am Donnerstag, 28. Juli 2022, 09:40:14 CEST schrieb Tudor Ambarus:
> Every dma_map_single() call should have its dma_unmap_single() counterpart,
> because the DMA address space is a shared resource and one could render the
> machine unusable by consuming all DMA addresses.
> 
> Cc: stable@vger.kernel.org
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/nand/raw/atmel/nand-controller.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c
> b/drivers/mtd/nand/raw/atmel/nand-controller.c index
> 6ef14442c71a..330d2dafdd2d 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struct
> atmel_nand_controller *nc,
> 
>  	dma_async_issue_pending(nc->dmac);
>  	wait_for_completion(&finished);
> +	dma_unmap_single(nc->dev, buf_dma, len, dir);
> 
>  	return 0;

Acked-by: Alexander Dahl <ada@thorsis.com>

After studying 
https://www.kernel.org/doc/html/latest/core-api/dma-api-howto.html
this seems like the correct thing to do to me.

I was made aware of this patch in IRC, after discussing a strange lzo 
decompression and/or page reading error with Richard after upgrading from 
kernel v5.2.21-rt13 to v5.15.49-rt47.

Now testing this on top of 5.15.49-rt47 on two boards, both with Microchip 
sama5d27c 128MiB SiP and Spansion S34ML02G1 raw nand flash. Will report later.

Thanks and greets
Alex




______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Dahl <ada@thorsis.com>
To: linux-mtd@lists.infradead.org
Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org,
	vigneshr@ti.com, Tudor Ambarus <tudor.ambarus@microchip.com>,
	richard@nod.at, bbrezillon@kernel.org, stable@vger.kernel.org,
	claudiu.beznea@microchip.com, miquel.raynal@bootlin.com,
	peda@axentia.se, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mtd: rawnand: atmel: Unmap streaming DMA mappings
Date: Fri, 29 Jul 2022 12:59:55 +0200	[thread overview]
Message-ID: <2099405.mp5hVA6q5l@ada> (raw)
In-Reply-To: <20220728074014.145406-1-tudor.ambarus@microchip.com>

Hello Tudor,

Am Donnerstag, 28. Juli 2022, 09:40:14 CEST schrieb Tudor Ambarus:
> Every dma_map_single() call should have its dma_unmap_single() counterpart,
> because the DMA address space is a shared resource and one could render the
> machine unusable by consuming all DMA addresses.
> 
> Cc: stable@vger.kernel.org
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/nand/raw/atmel/nand-controller.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c
> b/drivers/mtd/nand/raw/atmel/nand-controller.c index
> 6ef14442c71a..330d2dafdd2d 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struct
> atmel_nand_controller *nc,
> 
>  	dma_async_issue_pending(nc->dmac);
>  	wait_for_completion(&finished);
> +	dma_unmap_single(nc->dev, buf_dma, len, dir);
> 
>  	return 0;

Acked-by: Alexander Dahl <ada@thorsis.com>

After studying 
https://www.kernel.org/doc/html/latest/core-api/dma-api-howto.html
this seems like the correct thing to do to me.

I was made aware of this patch in IRC, after discussing a strange lzo 
decompression and/or page reading error with Richard after upgrading from 
kernel v5.2.21-rt13 to v5.15.49-rt47.

Now testing this on top of 5.15.49-rt47 on two boards, both with Microchip 
sama5d27c 128MiB SiP and Spansion S34ML02G1 raw nand flash. Will report later.

Thanks and greets
Alex




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Dahl <ada@thorsis.com>
To: linux-mtd@lists.infradead.org
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	peda@axentia.se, nicolas.ferre@microchip.com,
	alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com,
	bbrezillon@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: atmel: Unmap streaming DMA mappings
Date: Fri, 29 Jul 2022 12:59:55 +0200	[thread overview]
Message-ID: <2099405.mp5hVA6q5l@ada> (raw)
In-Reply-To: <20220728074014.145406-1-tudor.ambarus@microchip.com>

Hello Tudor,

Am Donnerstag, 28. Juli 2022, 09:40:14 CEST schrieb Tudor Ambarus:
> Every dma_map_single() call should have its dma_unmap_single() counterpart,
> because the DMA address space is a shared resource and one could render the
> machine unusable by consuming all DMA addresses.
> 
> Cc: stable@vger.kernel.org
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/nand/raw/atmel/nand-controller.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c
> b/drivers/mtd/nand/raw/atmel/nand-controller.c index
> 6ef14442c71a..330d2dafdd2d 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -405,6 +405,7 @@ static int atmel_nand_dma_transfer(struct
> atmel_nand_controller *nc,
> 
>  	dma_async_issue_pending(nc->dmac);
>  	wait_for_completion(&finished);
> +	dma_unmap_single(nc->dev, buf_dma, len, dir);
> 
>  	return 0;

Acked-by: Alexander Dahl <ada@thorsis.com>

After studying 
https://www.kernel.org/doc/html/latest/core-api/dma-api-howto.html
this seems like the correct thing to do to me.

I was made aware of this patch in IRC, after discussing a strange lzo 
decompression and/or page reading error with Richard after upgrading from 
kernel v5.2.21-rt13 to v5.15.49-rt47.

Now testing this on top of 5.15.49-rt47 on two boards, both with Microchip 
sama5d27c 128MiB SiP and Spansion S34ML02G1 raw nand flash. Will report later.

Thanks and greets
Alex




  reply	other threads:[~2022-07-29 11:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  7:40 [PATCH] mtd: rawnand: atmel: Unmap streaming DMA mappings Tudor Ambarus
2022-07-28  7:40 ` Tudor Ambarus
2022-07-28  7:40 ` Tudor Ambarus
2022-07-29 10:59 ` Alexander Dahl [this message]
2022-07-29 10:59   ` Alexander Dahl
2022-07-29 10:59   ` Alexander Dahl
2022-08-09  6:28   ` Alexander Dahl
2022-08-09  6:28     ` Alexander Dahl
2022-08-09  6:28     ` Alexander Dahl
2022-08-02 11:03 ` Tudor.Ambarus
2022-08-02 11:03   ` Tudor.Ambarus
2022-08-02 11:03   ` Tudor.Ambarus
2022-08-16  9:09 ` Boris Brezillon
2022-08-16  9:09   ` Boris Brezillon
2022-08-16  9:09   ` Boris Brezillon
2022-08-17  9:28 ` Thorsten Leemhuis
2022-08-17  9:28   ` Thorsten Leemhuis
2022-08-17  9:28   ` Thorsten Leemhuis
2022-08-21 14:45   ` Peter Rosin
2022-08-21 14:45     ` Peter Rosin
2022-08-21 14:45     ` Peter Rosin
2022-09-07  9:06 ` Tudor.Ambarus
2022-09-07  9:06   ` Tudor.Ambarus
2022-09-07  9:06   ` Tudor.Ambarus
2022-09-19 15:29   ` Miquel Raynal
2022-09-19 15:29     ` Miquel Raynal
2022-09-19 15:29     ` Miquel Raynal
2022-09-20  8:10 ` Miquel Raynal
2022-09-20  8:10   ` Miquel Raynal
2022-09-20  8:10   ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2099405.mp5hVA6q5l@ada \
    --to=ada@thorsis.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=claudiu.beznea@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=peda@axentia.se \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.