Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: syssrc



On Thu, 18 May 2000, Frank van der Linden wrote:

> On Thu, May 18, 2000 at 05:15:14PM +0200, Paul Kranenburg wrote:
> > > Modified Files:
> > >   syssrc/sys/dev/ic: hme.c
> > > 
> > > Log Message:
> > > rearrange the order of bus_dma operations to be more like many other
> > > drivers, at the suggestion of fvdl.  also, use bus_dmamap_load() not
> > > load_raw().
> > 
> > You're headed for trouble with this change. According to bus_dma(9),
> > memory allocated with bus_dmamem_alloc() should be loaded with
> > bus_dmamap_load_raw().
> 
> Not really.. there seems to be some confusion on this.
> 
> If you want to feed memory allocated with bus_dmamem_alloc, that has
> not been mapped, directly into a dmamap, you indeed need to use load_raw.
> The problem is, that several platforms do not implement this.
> 
> However, if you map the memory allocated by bus_dmamem_alloc through
> bus_dmamem_map, then you can use the va obtained through this call
> to load the memory into a dmamap using bus_dmamap_load. This is
> what most drivers do. See, for example, ahc_createdmamem in aic7xxx.c.
> 
> Since hme.c was already using bus_dmamem_map, it was easiest to
> just re-arrange the bus_dma code in hme.c to match other drivers,
> avoiding load_raw.
>  
> > The sparc and sparc64 implementations depend on this, since both the
> > `alignment' and `boundary' argument to bus_dmamem_alloc() cannot be
> > dealt with until actual DMA resources are allocated. Those values
> > are saved in the segments returned for later use in bus_dmamap_load_raw().
> 
> If the sparc and sparc64 bus_dma implementations *only* allow DMA memory
> allocated by bus_dmamem_alloc to be loaded into a DMA map through
> bus_dmamap_load_raw (i.e., the indirect way via bus_dmamem_map is not
> possible), then these implementations need to be fixed.

This is getting annoying.

bus_dmamap_load() can be used to load just about anything on
sparc64.  The memory does not need to be allocated by
bus_dmamem_alloc() and, until recently, has not been.

bus_dmamap_load() is less efficient than bus_dmamap_load_raw() since it
needs to do a reverse VA->PA translation, allocate a new DVMA address
space, and then remap the pages into the IOMMUs, whereas 
bus_dmamap_load_raw() skips the VA->PA translations.

Now I'm not certain I aggree that bus_dmamem_alloc() and
bus_dmamem_map() are really necessary in this case, but since we're using
those operations we should also be useing bus_dmamap_load_raw() instead of
bus_dmamap_load() now I've gone to all the trouble to implement it.

Eduardo Horvath                            





Home | Main Index | Thread Index | Old Index