Subject: Re: BUS_DMA_CONTROLDATA flag for bus_dma(9)
To: None <cgd@broadcom.com>
From: Eduardo Horvath <eeh@NetBSD.ORG>
List: tech-kern
Date: 08/15/2003 22:45:28
On Fri, Aug 15, 2003 at 03:24:38PM -0700, cgd@broadcom.com wrote:
> At Fri, 15 Aug 2003 22:13:50 +0000 (UTC), "Allen Briggs" wrote:
> > On Fri, Aug 15, 2003 at 09:30:24PM +0000, Eduardo Horvath wrote:
> > > Does this mean we can finally get rid of that BUS_DMA_STREAMING 
> > > flag?
> > 
> > No.  I don't think so.  BUS_DMA_COHERENT is for CPU <-> memory
> > coherency where BUS_DMA_STREAMING is for controlling device <->
> > memory coherency in certain cases that I know about only from
> > the man page.  I don't see how that's changed at all.
> 
> Actually, BUS_DMA_COHERENT involves memory as seen by CPU and devices.
> 
> With BUS_DMA_COHERENT, devices and the CPU must have a coherent view
> of memory.
> 
> Reading the STREAMING description, it sounds like it specifically
> indicates that non-coherence is OK.  I do wonder whether it should be
> considered implied by ! COHERENT.
> 
> it seems like:
> 
> * if using BUS_DMA_COHERENT, BUS_DMA_STREAMING should not ever be
>   honored.
> 
> * i dunno if BUS_DMA_STREAMING should "always" (attempt to) be used
>   for non-COHERENT transfers, but reading the description in the
>   manual page, that might be appropriate.
> 
>   I guess the only question is, how does the software know in some
>   generic sense whether the device fits all of the constraints needed
>   for STREAMING.  Is using STREAMING dangerous in the non-COHERENT
>   case, or in the case where the device accesses things "strangely"?

I'd say that by definition, the STREAMING and COHERENT are mutually 
exclusive.  I really don't see where it makes any difference if the 
cache is on the processor side or on the device side.  It's merely a 
question of whether any caches on that particular memory are enabled 
or disabled.

I can't think of any situation where STREAMING could be dangerous 
that wouldn't also require COHERENT for proper functioning on at 
least some machines.

Eduardo