Subject: Re: CVS commit: syssrc
To: Matthew Jacob <mjacob@feral.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 02/24/2001 17:41:32
On Sat, Feb 24, 2001 at 04:14:36PM -0800, Matthew Jacob wrote:

 > I think the problem here is that there's no ordering requirement stated that
 > says that bus_dmamap_load[_raw] has to occur after bus_dmamem_map. I can see
 > that this would work okay if this was required.

Nono... if you're using dmamap_load_raw, by definition you are not loading
memory that is mapped into the kernel address space.  In that case, there
is, by definition, no cache coherency issue.  (You still have to use
dmamap_sync, tho, since there might be bounce buffers involved.)

 > There's also nothing that can be use to give a hint to bus_dmamem_alloc that
 > it should make an allocation such that a subsequent bus_dmamem_map with
 > BUS_DMA_COHERENT would succeed sensibly
 > 
 > That is, unless you count the page-size allocation rule for bus_dmamem_alloc
 > to be a sufficient guard. I don't- you assume that all you need to do is to
 > rip a cpu mapping away from a page to guarantee you can make a piece of memory
 > sync-able. This may not be a reasonable efficient mechanism. It'd be better to
 > be able to tell bus_dmamem_alloc what you want the memory for to begin with.

This all falls into the "DMA safe memory" category, which is that
bus_dmamem_alloc() allocates.  If a piece of memory cannot be made
coherent (either by a COHERENT mapping or by synchrnoization), then
it should not be returned by bus_dmamem_alloc().

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>