(sent this to the devel list by mistake too - sorry)
I'm trying to simulate some hardware with a driver
which maps a region of kernel memory (allocated with
kmalloc) to user space.
The user is called mmap which gives him direct access
to some register space.
This works well on a real Linux box but when I try
to simulate the register region with kernel memory,
the writes from user space do not go into the kmalloc'ed
Here are the pointers:
0x271f0000 is returned from kmalloc
0x1f1f0000 is the above after a virt_to_phys
0x404e9000 is the user's virtual address
I use remap_page_range with:
0x404e9000, 0x1f1f0000, 65536, 0x39
The user writes to some offset in this region
(using his virtual address). Reads back the value,
all is good.
The kernel tries to read the value using the
virtual address (offset from 0x271f0000) and gets
back zeros. I've also tried look at the phys addr
(offset from 0x1f1f0000) and that too is zeros.
Here's the /proc/*/map output:
404e9000-404f9000 rw-s 1f1f0000 00:07 394 /dev/foo
Any help appreciated.