public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* zap_page_range in a module
@ 2001-12-14 21:26 Sottek, Matthew J
  2001-12-14 22:30 ` Benjamin LaHaise
  0 siblings, 1 reply; 7+ messages in thread
From: Sottek, Matthew J @ 2001-12-14 21:26 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'


  I have a driver memory mapping issue that I'm unsure how to
handle. Basically I've written a i810 framebuffer driver that uses
only stolen memory modes (Mostly for embedded customers). This driver
currently can only work when compiled into the kernel because I need 
zap_page_rage(). Is there an acceptable way for me to get equivalent
functionality in a module so that this will be more useful to the
general public?

Some backup info:
The "stolen memory" is the 1mb that the bios takes from the system
before OS load. The i810 maps this in 64k banks to 0xa0000. I can
use any video modes <1MB in size by accessing the memory via these
64k banks and swapping banks when needed.

For the fb driver I allow memory mapping of a 1MB area on the fb device
file and install a zero_page fault handler. When a page is faulted I
map the 64k region that contains the page the client needs with
remap_page_range() and switch the memory bank. I then need to drop
any old 64k ranges so that I will get another zero_page fault when
they are accessed. This way the client see's 1MB linear memory and
I bank flip behind the scenes.

So I'm using zap_page_range() to drop the pages for the "old" memory
bank. This, of course, is not exported to modules. Is there some
existing way to get this functionality in a module? is there any
chance to export zap_page_range()?

please cc this address in replies

 -Matt


^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: zap_page_range in a module
@ 2001-12-15  2:10 Sottek, Matthew J
  2001-12-15  2:31 ` Benjamin LaHaise
  0 siblings, 1 reply; 7+ messages in thread
From: Sottek, Matthew J @ 2001-12-15  2:10 UTC (permalink / raw)
  To: 'Benjamin LaHaise'; +Cc: 'linux-kernel@vger.kernel.org'

>On Fri, Dec 14, 2001 at 01:26:29PM -0800, Sottek, Matthew J wrote:
>> currently can only work when compiled into the kernel because I need 
>> zap_page_rage(). Is there an acceptable way for me to get equivalent
>> functionality in a module so that this will be more useful to the
>> general public?

>The vm does zap_page_range for you if you're implementing an
>mmap operation, 

It only does zap_page_range() when the memory map is being
removed right?

>otherwise vmalloc/vfree/vremap will take care of the details for
>you.  How is your code using zap_page_range?  It really shouldn't be.

I will try to explain in it again in another way.

I have a 64k sliding "window" into a 1MB region. You can only access
64k at a time then you have to switch the "bank" to access the next
64k. Address 0xa0000-0xaffff is the 64k window. The actual 1MB of
memory is above the top of memory and not directly addressable by the
CPU, you have to go through the banks.

My driver implements the mmap file operation and does NOT do a
remap_page_range(). I also install a zero_page fault handler.

The client application then memory maps a 1MB region on the device
file. When the client tries to access the first page, my fault
handler is called and I remap_page_range() the 64k window
and set the hardware such that the first 64k of memory is what
can be viewed through the window.

When the client gets to 64k + 1 my fault handler is triggered again.
At this time I change the window to view the second 64k and do
another remap_page_range() of the window to the second 64k in the
vma.  HERE is the problem. I need to get rid of the area so that
when the client reads from the first page my fault handler is
triggered again. zap_page_range() works, but only from within the
kernel.

This seems like something that would have lots of uses, so I assume
there is a way to do it that I just haven't discovered.
Is there no driver doing something like this to give mutual exclusion
to a memory mapped resource?

-Matt


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-12-18 13:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-14 21:26 zap_page_range in a module Sottek, Matthew J
2001-12-14 22:30 ` Benjamin LaHaise
2001-12-17  9:32   ` Martin Diehl
  -- strict thread matches above, loose matches on Subject: below --
2001-12-15  2:10 Sottek, Matthew J
2001-12-15  2:31 ` Benjamin LaHaise
2001-12-17  9:32   ` Martin Diehl
2001-12-18 13:04     ` Helge Hafting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox