From: Wolfram Sang <wsa@the-dreams.de>
To: Vignesh R <vigneshr@ti.com>
Cc: "David Laight" <David.Laight@ACULAB.COM>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Felipe Balbi" <balbi@kernel.org>,
"Peter Chen" <peter.chen@nxp.com>,
"Roger Quadros" <rogerq@ti.com>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Mathias Nyman" <mathias.nyman@linux.intel.com>,
"Javier Martinez Canillas" <javier@osg.samsung.com>,
"Baoyou Xie" <baoyou.xie@linaro.org>,
"Sekhar Nori" <nsekhar@ti.com>,
"William wu" <wulf@rock-chips.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Chris Bainbridge" <chris.bainbridge@gmail.com>,
"Wolfram Sang" <wsa-dev@sang-engineering.com>,
"Krzysztof Opasiak" <k.opasiak@samsung.com>,
"Felix Hädicke" <felixhaedicke@web.de>,
"Colin Ian King" <colin.king@canonical.com>,
"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
"clemens@ladisch.de" <clemens@ladisch.de>,
"maksim.salau@gmail.com" <maksim.salau@gmail.com>
Subject: Re: RE: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity
Date: Wed, 31 May 2017 17:50:35 +0200 [thread overview]
Message-ID: <20170531155034.GB2399@katana> (raw)
In-Reply-To: <3619ab73-b9f0-89b8-a8e8-b6600a0bf73d@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
> > 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!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-05-31 15:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 0:56 [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Florian Fainelli
2017-04-26 0:56 ` [PATCH v3 1/2] usb: core: Check URB setup_packet and transfer_buffer sanity Florian Fainelli
2017-04-26 0:56 ` [PATCH v3 2/2] usb: udc: core: Error if req->buf is either from vmalloc or stack Florian Fainelli
2017-05-05 21:08 ` [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Florian Fainelli
2017-05-28 16:03 ` Wolfram Sang
2017-05-31 11:04 ` David Laight
2017-05-31 11:55 ` Vignesh R
2017-05-31 15:50 ` Wolfram Sang [this message]
2017-05-31 19:23 ` Wolfram Sang
2017-05-31 11:56 ` Vignesh R
2017-05-31 15:12 ` Wolfram Sang
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=20170531155034.GB2399@katana \
--to=wsa@the-dreams.de \
--cc=David.Laight@ACULAB.COM \
--cc=arnd@arndb.de \
--cc=balbi@kernel.org \
--cc=baoyou.xie@linaro.org \
--cc=chris.bainbridge@gmail.com \
--cc=clemens@ladisch.de \
--cc=colin.king@canonical.com \
--cc=f.fainelli@gmail.com \
--cc=felixhaedicke@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=javier@osg.samsung.com \
--cc=k.opasiak@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maksim.salau@gmail.com \
--cc=mathias.nyman@linux.intel.com \
--cc=nsekhar@ti.com \
--cc=peter.chen@nxp.com \
--cc=rogerq@ti.com \
--cc=stern@rowland.harvard.edu \
--cc=vigneshr@ti.com \
--cc=wsa-dev@sang-engineering.com \
--cc=wulf@rock-chips.com \
/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