Subject: Re: mmap'ing framebuffer memory in MI drivers...
To: Chris G. Demetriou <firstname.lastname@example.org>
From: Eduardo E. Horvath <email@example.com>
Date: 03/04/1999 09:50:30
On 3 Mar 1999, Chris G. Demetriou wrote:
> Jonathan Stone <jonathan@DSG.Stanford.EDU> writes:
> > >I will assert (again) that mapping the device registers is an inherently
> > >bus-specific operation and should be done by the driver through the use of
> > >bus_space*() routines rather than the VM system.
> > Agreed. What I'm saying is that that after a bus_space_mmap() has done
> > its thing, then converting the ``system physical address'' it returns
> > to a (*d_mmap)() entrypoint is an MD operation. if we want MI drivers
> > for mmap'able devices we need an MI hook to do that conversion; end of
> > story.
> Except, it should _not_ return a "system physical address," it should
> return whatever needs to be returned from mmap() for that
> architecture. that's kinda the whole point.
> (there's no reason that _i_ can think of to insert Yet Another MD
> Operation there; it's _already_ an MD operation.)
This is the part I don't understand. Everybody thinks that the driver's
mmap() routine should calculate up some fancy cookie to give to the VM's
mmap() code to pass to pmap_enter(). pmap_enter() would then need some
rather fancy code to figure out that this cookie is not a normal physical
address that the VM layer usually manipulates rather something special,
decypher this cookie, and DTRT.
Why doesn't the VM layer call the driver mmap() routine and let the driver
mmap() routine do the entire operation, possibly using some MD entry point
into the pmap layer where all this special information can be passed in as
separate parameters? O.K., so we need another driver vector for munmap(),
I consider this a good thing since it lets the driver keep track of a use
count on this resource which are necessary to know if the driver is
detachable (if we ever support detach) or allow optimizations in the area
of cache flushes, etc. For example, it lets a video card driver install a
locked large page mapping during the map operation and remove it when the
mapping goes away.
Eduardo Horvath firstname.lastname@example.org
"I need to find a pithy new quote." -- me