lkml.org 
[lkml]   [2004]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] on-chip coherent memory API for DMA
From
Date
On Thu, 2004-07-01 at 09:45, David Brownell wrote:
> Seems unreasonable to me, unless there's also an API to change
> the mode of the dma_alloc_coherent() memory from the normal
> "CPU can read/write as usual" to the exotic "need to use special
> memory accessors". (And another to report what mode the API is
> in at the current moment.)

No. That's why you specify how you'd like the memory to be treated. If
you don't want the memory to be accessible only via IO accessors, then
you specify DMA_MEMORY_MAP and take the failure if the platform can't
handle it.

> And I don't like modal APIs like that, which is why it'd make
> more sense to me to have a new allocator API for this new
> kind of DMA memory. (Which IS for that IBM processor, yes?)

There is no "new" kind of memory. This is currently how *all* I/O
memory is accessed. DMA_MEMORY_MAP is actually the new bit since it
allows I/O memory to be treated as normal memory.

> Alternatively, modify dma_alloc_coherent() to say what kind
> of address it must return. Since this is a "generic" DMA
> API, the caller of dma_alloc_coherent() shouldn't need to be
> guessing how they may actually use the memory returned.
> That new "must guess" requirement will break some code...

There is no "must guess". Either the driver specifies DMA_MEMORY_MAP or
DMA_MEMORY_IO. If you specify DMA_MEMORY_IO then you have to use
accessors for dma_alloc_coherent() memory. If you never wish to bother
with it, simply specify DMA_MEMORY_MAP and take the failure on platforms
which cannot comply.

> So -- you're saying it's not a bug that a __GFP_NOFAIL|__GFP_WAIT
> allocation be able to fail? Curious. I'd have thought the API
> was clear about that. Allocating 128 MB from a 1 MB region must
> of course fail, but allocating one page just needs a wait/wakeup.

It can *only* happen if you specify DMA_MEMORY_EXCLUSIVE; that preempts
the GFP_ flags and the application must be coded with this in mind.
Otherwise it will respect the GFP_ flags.

James


-
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/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.061 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site