Re: Fixed address device-shared kernel memory

Richard B. Johnson (root@chaos.analogic.com)
Wed, 22 Sep 1999 18:08:36 -0400 (EDT)


On Thu, 23 Sep 1999, Jens Axboe wrote:

> On Wed, Sep 22 1999, Richard B. Johnson wrote:
> > ptr = phys_to_vert(0xcc000);
> >
> > ... which is a shared memory window in kernel space.
> >
> > This works for about 20 seconds. Then (it appears as though)
> > the kernel unmaps this virtual address, resulting in
> > data observed at this address to not be the data from the
> > shared-memory device.
> >
> > The problem with the disappearing mapping seems to correspond
> > with the wakeup of kswapd or kflushd.
> >
> > I looked through kernel drivers and didn't get a clue as
> > to how to prevent this. Many drivers, which use shared memory,
> > don't even use the phys_to_vert macro. If I try that, the
> > result is a panic with Unable to handle kernel paging request
> > of 0x000cc000. So, the physical to virual mapping is obviously
> > required in a kernel module.
> >
> > So, the question is; "How do I prevent the kernel from unmapping
> > the physical-to-virtual translated pages?"
> >
> > Was I supposed to call do_mmap(); and later do_munmap(); in
> > the kernel driver?
>
> You can't just access the memory directly, you have to remap
> it first.
>

Yep ioremap() does it. Thanks.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/