From: David Brownell <david-b@pacbell.net>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: James.bottomley@steeleye.com, linux-kernel@vger.kernel.org,
manfred@colorfullife.com
Subject: Re: [RFT][PATCH] generic device DMA implementation
Date: Mon, 30 Dec 2002 15:23:59 -0800 [thread overview]
Message-ID: <3E10D58F.6010105@pacbell.net> (raw)
In-Reply-To: 200212282219.OAA02384@adam.yggdrasil.com
Adam J. Richter wrote:
> Odd number of ">" = David Brownell
> Even number of ">>" = Adam Richter
Toggle that one more time ... ;)
>
> On the other hand, it might be a convenient shorthand be able to
> say dma_malloc(usb_device,....) instead of
> dma_malloc(usb_device->controller, ...). It's just that the number of
> callers is small enough so that I don't think that the resulting code
> shrink would make up for the size of the extra wrapper routines. So,
Since about 2.5.32 that API has been
void *usb_buffer_alloc(usb_device *, size, mem_flags, dma_addr_t *)
Sure -- when dma_alloc() is available, we should be able to make it
inline completely. Done correctly it should be an object code shrink.
> struct device {
> ....
> struct dma_device *dma_dev;
> }
>
> device.dma_dev would point back to the device in the case of PCI,
> ISA and other memory mapped devices, and it would point to the host
> controller for USB devices, the SCSI host adapter for SCSI devices, etc.
With 'dma_device' being pretty much the 'whatsit' I mentioned: some state
(from platforms that need it, like u64 dma_mask and maybe a list of pci
pools to use with dma_malloc), plus methods basically like James' signatures
from 'struct bus_dma_ops'.
Yes, that'd be something that might be the platform implementation (often
pci, if it doesn't vanish like on x86), something customized (choose dma
paths on the fly) or just BUG() out.
> BUG() is generally the optimal way to fail due to programmer
> error, as opposed to program error. You want to catch the bug as
> early as possible.
I can agree to that in scenarios like relying on DMA ops with hardware
known not to support them. If it ever happens, there's deep confusion.
But not in the case of generic dma "map this buffer" operations failing
because of issues like temporary resource starvation; or almost any
other temporary allocation failure that appears after the system booted.
>>Please look at the 2.5.53 tree with my "usbcore dma updates (and doc)"
>>patch, which Greg has now merged and submitted to Linus.
>
> This looks great. Notice that you're only doing DMA
> operations on usb_device->controller, which is a memory-mapped device
> (typically PCI).
Actually it isn't necessarily ... some host controllers talk I/O space
using FIFOs for commands and data, rather than memory mapping registers,
shared memory request schedules, and DMAing to/from the kernel buffers.
Linux would want a small tweak to support those controllers; maybe it'd
be as simple as testing whethere there's a dma_whatsit object pointer.
The usb_buffer_*map*() calls could now be inlined, but I thought I'd rather
only leave one copy of all the "don't go through null pointer" checking.
If we ever reduce such checking in USB, those routines would all be
good candidates for turning into inlined calls to dma_*() calls.
- Dave
next prev parent reply other threads:[~2002-12-30 23:09 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-28 22:19 [RFT][PATCH] generic device DMA implementation Adam J. Richter
2002-12-30 23:23 ` David Brownell [this message]
2002-12-30 23:42 ` [2.5.52] NFS works with 2.4.20, not with Win2K/SFU Scott Robert Ladd
2002-12-31 2:42 ` J Sloan
2002-12-31 4:32 ` Scott Robert Ladd
-- strict thread matches above, loose matches on Subject: below --
2002-12-28 20:11 [RFT][PATCH] generic device DMA implementation Adam J. Richter
2002-12-28 15:41 Adam J. Richter
2002-12-28 16:59 ` David Brownell
2002-12-28 3:39 Adam J. Richter
2002-12-30 0:45 ` Alan Cox
2002-12-28 2:48 Adam J. Richter
2002-12-28 15:05 ` David Brownell
2002-12-27 22:57 Manfred Spraul
2002-12-27 23:55 ` James Bottomley
2002-12-28 0:20 ` Manfred Spraul
2002-12-28 16:26 ` James Bottomley
2002-12-28 17:54 ` Manfred Spraul
2002-12-28 18:13 ` James Bottomley
2002-12-28 18:25 ` Manfred Spraul
2002-12-28 18:40 ` James Bottomley
2002-12-28 20:05 ` Manfred Spraul
2002-12-27 20:21 David Brownell
2002-12-27 21:40 ` James Bottomley
2002-12-28 1:29 ` David Brownell
2002-12-28 16:18 ` James Bottomley
2002-12-28 18:16 ` David Brownell
2002-12-28 1:56 ` David Brownell
2002-12-28 16:13 ` James Bottomley
2002-12-28 17:41 ` David Brownell
2002-12-27 21:47 ` James Bottomley
2002-12-28 2:28 ` David Brownell
2002-12-18 3:01 James Bottomley
2002-12-18 3:13 ` David Mosberger
2002-12-28 18:14 ` Russell King
2002-12-28 18:19 ` James Bottomley
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=3E10D58F.6010105@pacbell.net \
--to=david-b@pacbell.net \
--cc=James.bottomley@steeleye.com \
--cc=adam@yggdrasil.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.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;
as well as URLs for NNTP newsgroup(s).