Re: [PATCH] mtd_dataflash use command allocated on stack

Haavard Skinnemoen
2008-06-26T19:55:25Z

Sorry about the late response...I'm currently getting up to speed with
various mailing lists.

On Wed, 23 Apr 2008 08:00:34 +0400
"Vitja Makarov" <vitja.makarov@gmail.com> wrote:

> If you are asking about could spi DMA from stack, I think so, as
> spi_sync() is called before ret, but there still are cache issues,
> dataflash or better spi driver should call invalidate/flush for the
> given address if needed, I moved it to spi_bfin code, and that seems
> to work for me wo modifyng original dataflash driver.

NO! DMA from stack is NOT safe!

The problem isn't missing cache flushing -- any driver that uses DMA
must do that anyway -- but that the flushed lines get sucked right back
in when the function returns.

Also note that DMA from stack may work _sometimes_, but you never know
when the buffer happens to share a cache line with some return
address...

Haavard