Subject: Re: mmap'ing framebuffer memory in MI drivers...
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Eduardo E. Horvath <>
List: tech-kern
Date: 03/03/1999 11:57:00
On Tue, 2 Mar 1999, Jonathan Stone wrote:

> we still have a design flaw in mmap()'ing outboard memory into
> userspace for MI drivers.
> Look at, eg., syu/dev/tc/sfb.c The driver (*d_mmap)() entrypoint needs
> to return a physical address.  The extant code kludges around this by
> defining a `machine_btop()' which does the appropriate munging to get
> the right return-type for a physical address.
> But this still isnt really enough. MI drivers may, in principle, need
> or want to set MD flags in the address -- for
> uncached/write-trhough-write-back, &c, mappings
> But there's no MI way to do this: some ports use low_order bits as
> flags, some use high-order bits, and there's not even a standard
> namespace of MI flags.

Yes, I noted this when I split vm_offset_t into paddr_t and vaddr_t.  One
solution would be to define a paddr_t with all the extra fields to define
whether it's cacheable, etc.  


> But what I'd *really*_ like to do is to be able to set a bit saying
> ``this PA is part of a contiguous physical region of 4Mbytes'', so
> that the MD code can set up one giant TLB mapping for the whole
> region.
> This makes a noticeable difference to software blittign on mips3,
> since you use one TLB entry for the whole framebuffer instead of one
> per physical page.  That'd need an extra flag and a `region size'
> argument. Should it be a different hook ( degenerating to a single
> normal page-op on machines which dont support big pages) or a separate
> hook?

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.

[N.B. It would be really nice if pmap_enter() recieved a list of pages and
could use large TLB entries if they were appropriate.  But this opens a
whole other kettle of fish and requires large changes to the VM system.]

Eduardo Horvath
	"I need to find a pithy new quote." -- me