Re: PCI DMA to small buffers on cache-incoherent arch

From: David Brownell (david-b@pacbell.net)
Date: Wed Jun 12 2002 - 14:13:08 EST


> Let's go back to the beginning of this discussion since I think we're
> losing sight of the original problem.

I think actually a couple were unearthed, but you're right to focus.

> In general I certainly support
> the idea of making the DMA mapping stuff device generic instead of
> tied to PCI.

PCI was a good place to start (focus ... :) but clearly it shouldn't
be the only bus architecture with such support. Note that there are
actually two related approaches in the DMA-mapping.txt APIs ... one is
DMA mapping, the other is "consistent memory". Both should be made
generic rather than PCI-specific, not just mapping APIs.

> However, this discussion started when I fixed some problems I was
> having with USB on my IBM PowerPC 440GP system (which is not cache
> coherent).

... which basically led to discussion of options I summarized a while
back as (a) expose the issues to drivers via macros, or (b) expose
them through some other API.

And DaveM wanted to focus on (b) options that involve exposing
consistent memory to drivers as buffers (sized in multiples of
cachelines, where that matters) rather than DMA-mapping them.

Based on the discussion, I think the answer for now is to go with
the (b) variant you had originally started with, using kmalloc for
the buffers. The __dma_buffer style macro didn't seem popular;
though I agree that it's not clear kmalloc() really solves it
today. (Given DaveM's SPARC example, the minimum size value it
returns would need to be 128 bytes ... which clearly isn't so.)

> The current USB driver design seems pretty reasonable: only the HCD
> drivers need to know about DMA mappings, and other USB drivers just
> pass buffer addresses. I don't think you would get much support for
> forcing every driver to handle its own DMA mapping.

Me either. But I suspect that it'd be good to have that as an option;
maybe just add a transfer_dma field to the URB, and have the HCD use
that, instead of creating a mapping, when transfer_buffer is null.
That'd certainly be a better approach for supporting sglist in the
usb-storage code than the alternatives I've heard so far.

> I would like to see both dev_map_xxx etc. and something like
> __dma_buffer go into the kernel. I think they both have their uses.

Got Patch? Actually, I know you do, I shouldn't ask. :)

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:26 EST