Subject: Re: Cache Attributes for memory mapped pages
To: Kyle Unice <kyle@midnighttech.com>
From: Andrey Petrov <petrov@netbsd.org>
List: tech-kern
Date: 06/21/2003 21:07:29
On Fri, Jun 20, 2003 at 10:53:09AM -0600, Kyle Unice wrote:
> We use mmap to get a virtual address for a physical address. It is not
> clear how to set the access attributes in the page table (cacheing,
> buffering, etc) for the page table entries that the kernel develops.
>
>
>
> If the kernel is using virtual address X for a physical address Y, then
> an application wants a virtual address Z for Y and calls mmap to
> establish the mapping, a new page table entry is developed for the
> mapping but it is unclear to me how the caching, buffering attributes
> are choosen for that mapping. I assumed it was the drivers mmap routine
> that would set it but that is not the case.
>
>
>
> Could the application ask for virtual address X for Y when it calls
> mmap? That would make the kernel and application share the same mapping
> attributes for Y.
>
>
>
> When the kernel boots it assigns caching and buffering attributes to the
> SDRAM banks and to the memory mapped registers of several devices. What
> I want to know is how can the application get those same attributes so
> the application can read device registers correctly.
>
Device driver's mmap routine does actual work in a case of device registers
and so it's driver's responsibility to set those cache attributes properly.
I don't know how application can control it, but assuming driver does
it correctly it might be not needed.
Andrey