public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: "Chen Gong-B11801" <G.Chen@freescale.com>
Cc: linux-mtd@lists.infradead.org,
	David Woodhouse <David.Woodhouse@intel.com>
Subject: Re: goofy mtd m25p80 patches in GIT ...
Date: Mon, 20 Oct 2008 01:21:00 -0700	[thread overview]
Message-ID: <200810200121.00744.david-b@pacbell.net> (raw)
In-Reply-To: <C3C4D3116BA1F84989E53FCF1F505187166DAE@zch01exm21.fsl.freescale.net>

On Monday 20 October 2008, Chen Gong-B11801 wrote:
> 
> > 
> > Second:
> > 
> >  
> > http://git.kernel.org/?p=linux/kernel/git/dwmw2/mtd-2.6.git;a=
> > commitdiff;h=75d0ee2202b5740e94e913d8a52f91c6557c4c81
> > 
> > That's just plain wrong ... the original code is correct, but the
> > patch changed it to be incorrect.  (DMA from the stack is never
> > legal.)
> > 
> > Just revert this one entirely.
>  
> I know spi_write_then_read is different from spi_write, but here n_rx & rxbuf are
> both NULL, which means no real read operation are executed. Would you please
> give me more explanation for potential hazard ?

Documentation/DMA-mapping.txt, in the "What memory is DMA'able?"
section (the first one after overview) lists several hazards.
I won't elaborate on that text, but it also states explicitly
that DMA from stacks is not allowed (para 4, sentence one).

Note that the spi_write_then_read() is documented as always
copying its (small) data buffers, while spi_write() just
passes it down to the spi_master driver ... which requires
DMA-safe memory, as described in "What memory is DMA'able?".

Have a look at the implementation of spi_write_then_read(),
in drivers/spi/spi.c ... one of the main reasons for that
routine is to make some of the common cases easier to work
with, by masking those DMA issues.

- Dave

  reply	other threads:[~2008-10-20  8:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-19 22:35 goofy mtd m25p80 patches in GIT David Brownell
2008-10-20  7:32 ` Chen Gong-B11801
2008-10-20  8:21   ` David Brownell [this message]
2008-10-20  7:40 ` David Woodhouse
2008-10-20  7:42   ` Chen Gong-B11801
2008-10-20  7:44     ` David Woodhouse
2008-10-20  7:56       ` Chen Gong-B11801
2008-10-20  8:02         ` David Woodhouse
2008-10-20  8:16           ` Chen Gong-B11801
2008-10-20  8:30             ` David Brownell
2008-10-20  8:37               ` Chen Gong-B11801
2008-10-20  8:24           ` David Brownell
2008-10-20  8:04   ` David Brownell
2008-10-20  8:12     ` David Woodhouse

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=200810200121.00744.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=David.Woodhouse@intel.com \
    --cc=G.Chen@freescale.com \
    --cc=linux-mtd@lists.infradead.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