Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654379

Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity

From Wolfram Sang <wsa@the-dreams.de>
Newsgroups linux.kernel
Subject Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity
Date 2017-05-31 18:00 +0200
Message-ID <tNecq-6Ly-23@gated-at.bofh.it> (permalink)
References <tAjtf-3t4-7@gated-at.bofh.it> <tDSE9-77p-7@gated-at.bofh.it> <tM8Vr-4dv-7@gated-at.bofh.it> <tN9FL-3Xv-1@gated-at.bofh.it> <tNas9-4h3-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

> > Possibly more useful would be a variant of (IIRC) dma_map_for_device()
> > that will allocate a suitable bounce buffer for non-dma memory.
> > I think it can already do so for memory that is outside the address
> > range that the device can address (eg for a 32bit PCIe master in 64bit
> > system).
> > 
> 
> Such generic DMA API would be greatly useful!
> 
> I tried adding bounce buffers support to handle vmalloc'd buffers in
> MTD/SPI subsystem. But, there was a need felt for generic DMA API that
> can allocate bounce buffer for non-dma'able buffers that all drivers can
> make use of[1][2]

Yes, I see this DMA API would make sense for subsystems like SPI, MTD or
USB. For I2C, I don't think it makes a lot of sense because DMA is
rarely used there. Most hardware doesn't even have DMA support and if
so, the drivers apply a threshold (say 8 bytes) because most I2C
transfers are smaller and setting up DMA for that simply doesn't pay
off. And we are still talking of a mostly 100 or 400 kHz bus here.

So, I'd prefer a lightweight helper function telling if DMA is
possible/feasible for a given I2C message. If so, do it. If not, falling
back to PIO might be good enough for now. We can implement bounce buffer
support in the above helper function later. I don't really want to
enforce DMA capable buffers for I2C transactions when DMA is so rarely
needed there.

So, if I2C is a bit different, then it might simply make sense to keep
the function local for I2C now? This seems like a sensible start to me
meanwhile.

Thanks to all for the helpful input here!

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Wolfram Sang <wsa@the-dreams.de> - 2017-05-28 18:10 +0200
  RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity David Laight <David.Laight@ACULAB.COM> - 2017-05-31 13:10 +0200
    Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Vignesh R <vigneshr@ti.com> - 2017-05-31 14:00 +0200
      Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Wolfram Sang <wsa@the-dreams.de> - 2017-05-31 18:00 +0200
        Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Wolfram Sang <wsa@the-dreams.de> - 2017-05-31 21:30 +0200
  Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Vignesh R <vigneshr@ti.com> - 2017-05-31 14:00 +0200
    Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Wolfram Sang <wsa@the-dreams.de> - 2017-05-31 17:20 +0200

csiph-web