I am doing a memmap in kernel command line to reserve RAM fro my module use. Essentially I have a physical address, and I need to get a kernel virtual address. This is on a x86_64 system. How can I do that? I was thinking of using kmap but then I have to map several pages for extended periods of time. My main problem with that approach is that I get several virtual addresses for different pages. something like v1 = kmap(pfn_to_page(x1)), v2 = kmap(pfn_to_page(x2)) and so on. My reserved RAM is actually physically contiguous, but having so many virtual pointers is a pain.

Would phys_to_virt work for a 64 bit kernel?