Re: [PATCH 0/3] mtd: spi-nor: fix DMA-unsafe buffer issue between MTD and SPI
From: Mark Brown
Date: Wed Jan 03 2018 - 06:49:57 EST
On Wed, Dec 27, 2017 at 08:15:11PM +0000, Trent Piepho wrote:
> A random collection of spi master drivers will accept DMA-unsafe
> buffers in some way. In some cases a framework like spi-nor provides
> the fixup to spi-nor master drivers (none so far) and in other cases
> (atmel-quadspi), the spi-nor master driver has its own fixes.
Everything really should be DMA safe. The thing with skimping on the
DMA safety is that things generally won't explode every single time but
they might explode.
> What exactly is caught as DMA unsafe and what is not will of course
> vary greatly from driver to driver. Some drivers will catch highmem
> memory while other drivers will only detect vmalloc memory. Some will
> only catch an unsafe buffer if a specific SoC known to the driver to
> have an aliasing cache is enabled. Some will check buffers that arrive
> via the spi_flash_read interface but not via generic spi transfers,
> while others will check all spi transfer buffers.
As I keep saying here the real fix would be to have a simple API that we
could use to tell if we're dealing with something DMA safe. Right now
it's a mess because you need to pass that information around through
every layer that references memory which is a pain.
Attachment:
signature.asc
Description: PGP signature