From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] mtd: devices: m25p80: Make sure the buffer passed in op is DMA-able
Date: Tue, 18 Sep 2018 11:18:07 +0200 [thread overview]
Message-ID: <20180918111807.2ee5ccb8@bbrezillon> (raw)
In-Reply-To: <8e5e8113-b091-6d3e-50d4-3e70e9372016@linux.intel.com>
On Tue, 18 Sep 2018 10:59:17 +0300
Jarkko Nikula <jarkko.nikula@linux.intel.com> wrote:
> On 09/17/2018 05:31 PM, Boris Brezillon wrote:
> > As documented in spi-mem.h, spi_mem_op->data.buf.{in,out} must be
> > DMA-able, and commit 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx()
> > API") failed to follow this rule as buffers passed to
> > ->{read,write}_reg() are usually placed on the stack.
> >
> > Fix that by allocating a scratch buffer and copying the data around.
> >
> > Fixes: 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx() API")
> > Reported-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > ---
> > Note that the ->{read,write}() path is still buggy since nothing
> > guarantees that buffers passed by the MTD layer to the SPI NOR layer
> > are DMA-able, but this is a long-standing issue which we'll have to
> > address at the spi-nor level (this layer can choose the bounce buffer
> > size based on nor->page_size).
> >
> > Changes in v2:
> > - Copy the data from scratchbuf in the ->read_reg() path
> > ---
> > drivers/mtd/devices/m25p80.c | 26 +++++++++++++++++++++++---
> > 1 file changed, 23 insertions(+), 3 deletions(-)
> >
> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Queued to mtd/master. Thanks for testing and reviewing the patch.
Regards,
Boris
prev parent reply other threads:[~2018-09-18 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 14:31 [PATCH v2] mtd: devices: m25p80: Make sure the buffer passed in op is DMA-able Boris Brezillon
2018-09-18 7:59 ` Jarkko Nikula
2018-09-18 9:18 ` Boris Brezillon [this message]
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=20180918111807.2ee5ccb8@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox