On Thu, Mar 02, 2017 at 03:29:21PM +0100, Boris Brezillon wrote: > Vignesh R <vigneshr@xxxxxx> wrote: > > Or SPI core can be extended in a way similar to this RFC. That is, SPI > > master driver will set a flag to request SPI core to use of bounce > > buffer for vmalloc'd buffers. And spi_map_buf() just uses bounce buffer > > in case buf does not belong to kmalloc region based on the flag. > That's a better approach IMHO. Note that the decision should not only I don't understand how the driver is supposed to tell if it might need a bounce buffer due to where the memory is allocated and the caches used by the particular system it is used on? The suggestion to pass via scatterlists seems a bit more likely to work but even then I'm not clear that drivers doing PIO would play well. > be based on the buffer type, but also on the transfer length and/or > whether the controller supports transferring non physically contiguous > buffers. The reason most drivers only look at the transfer length when deciding that they can DMA is that most controllers are paired with DMA controllers that are sensibly implemented, the only factor they're selecting on is the copybreak for performance.
Attachment:
signature.asc
Description: PGP signature