linux-mips
[Top] [All Lists]

Re: [PATCH] mips: Add dma_mmap_coherent()

To: tsbogend@alpha.franken.de (Thomas Bogendoerfer)
Subject: Re: [PATCH] mips: Add dma_mmap_coherent()
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 22 Aug 2008 08:07:44 +0200
Cc: ralf@linux-mips.org, James Bottomley <James.Bottomley@HansenPartnership.com>, linux-mips@linux-mips.org, Parisc List <linux-parisc@vger.kernel.org>
In-reply-to: <20080821214118.GA12516@alpha.franken.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <s5hk5eezcfe.wl%tiwai@suse.de> <1219249633.3258.18.camel@localhost.localdomain> <s5hzln7vd9d.wl%tiwai@suse.de> <1219255088.3258.45.camel@localhost.localdomain> <s5hr68ivfer.wl%tiwai@suse.de> <1219326912.3265.2.camel@localhost.localdomain> <s5hhc9enyqa.wl%tiwai@suse.de> <s5hfxoynyn4.wl%tiwai@suse.de> <20080821214118.GA12516@alpha.franken.de>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (Sanjō) APEL/10.6 Emacs/22.2 (x86_64-suse-linux-gnu) MULE/5.0 (SAKAKI)
At Thu, 21 Aug 2008 23:41:18 +0200,
Thomas Bogendoerfer wrote:
> 
> On Thu, Aug 21, 2008 at 06:03:43PM +0200, Takashi Iwai wrote:
> > > Thanks for clarification.
> > > How about the revised patch below (for PARISC)?
> 
> the PARISC part will not work for 735 systems, because the CPU can't
> map memory uncached, iirc. 
> 
> > ... and the below is for MIPS.
> 
> for most MIPS system you need the same trick as for PARISC and use 
> uncached memory. But there are systems, which can't use uncached
> memory. 
> 
> One of the is SGI IP28, which needs to be switched to a special
> slower mode for uncached accesses, which we avoid completly in the
> kernel right now and I don't think making the switch to slow mode
> possible in user space is a good idea.
> 
> SGI Origin 200/2000, SGI Onyx and some Challenge Systems have a
> different problem:
> 
> "Uncached Memory Access in SGI Origin 2000 and in Challenge and Onyx Series
> 
>     Access to uncached memory is not supported in these systems, in which
>     cache coherency is maintained by the hardware, even under access from
>     CPUs and concurrent DMA.  There is never a need (and no approved way)
>     to access uncached memory in these systems."
> 
> That's from the IRIX Device Driver guide.
> 
> Right now I can't think of a solutin, which works on every MIPS system.

Thanks for detailed information.
I don't think that this must work for *every* platform, too, and it's
not expected from the driver.  The systems without uncached memory
access can simply return an error from  dma_mmap_coherent() call, so
that the driver can disable the mmap.  That'd be enough.

The current problem is that such an architecture / platform specific
thing isn't exposed at all.  If the driver suppose that mmap would
work as if normal pages, then it results in a crash.
The dma_mmap_coherent() can hide ugliness inside the arch code, and
also can give you an error if unmappable, at least.

Now, how to handle these exceptions: a question comes into my mind
again -- how does the framebuffer handle these as well?
Any pointer appreciated.


Thanks!

Takashi

<Prev in Thread] Current Thread [Next in Thread>