-   Linux - Kernel (
-   -   KMAP Physical Page to Kernel Virtual Address: unable to handle kernel paging request (

kickuindajunk 08-13-2010 01:50 PM

KMAP Physical Page to Kernel Virtual Address: unable to handle kernel paging request
Hello everyone,

I have seemed to come across some strange behavior and was hoping to either get a solution or explanation for what I am seeing.

Using kernel, I compiled two slightly different 32-bit builds. One build is PAE enabled, one is not. This is the only difference between the two. On my PAE enabled build I can map a physical frame number to a kernel virtual address by using: page = pfn_to_page(phypageaddr); va = kmap(page); Using "va" I can read the contents successfully. However, if I try the same for the non-PAE build I get an error: "unable to handle kernel paging request." The PDE = 00000000.

The memory I am accessing is mapped just below the 2 gb boundary and this is marked as BIOS reserved in the bios memory map. I can successfully map lower memory (e.g. 0xe0000) which is also BIOS reserved without an issue.

At this point I am very stumped on the issue I am having given such a minimal change. I don't believe PAE should effect such a request.

Any help, insight, or direction for solving such a problem would be greatly appreciated. Or suggest a better way to map a physical address area to virtual memory.



nini09 08-13-2010 02:38 PM

Try remap_pfn_range function. Usually, remap_pfn_range is used to map a physical address to virtual address.

kickuindajunk 08-13-2010 04:17 PM

hey nini09

thanks for the suggestion. unfortunately, it looks like remap_pfn_range is used to map kernel physical memory to userspace. The virtual address returned I believe isn't a kernel virtual address. I simply want to read physical memory in a kernel module, not from userspace.

If you believe I can still use remap_pfn_range, how are you suggest populating the vma struct which contains mm_struct which I believe is not available to a kernel module.



nini09 08-16-2010 02:22 PM

What type address do you access, bus or RAM?

kickuindajunk 08-17-2010 04:52 AM

Ram. Plus I am positive of the contents at the memory location

nini09 08-17-2010 03:18 PM

Walk through __get_free_pages function.

kickuindajunk 08-21-2010 12:17 PM

Thanks nini09 for the suggestion. Have indeed walked through function. The problem is that page_address is returning a valid va when the page table entry is not mapped.

Either way it seems like a bug. I am doing something very straight forward and the paging request can't be handled. All I want to do is map some physical memory to a virtual KERNEL address. Using existing kernel memory functions fail. This only happens for higher range memory locations (above 0x7FB00000).

I gave up on the issue and decided to stick with PAE.

All times are GMT -5. The time now is 01:03 AM.