You don't need ioremap()
if you're using remap_pfn_range()
. ioremap()
maps a physical address into a kernel virtual address. remap_pfn_range()
maps physical addresses directly to user space. Just pass your physical address (downshifted by PAGE_SHIFT to produce a pfn) directly to remap_pfn_range()
. Your questions in order:
- kernel virtual address
- kmalloc returns kernel virtual, but guarantees contiguous memory See question 116343
- you could do this if you call
virt_to_phys()
first, to convert kernel virtual address to physical. But skip a step if you don't actually need kernel access to this memory range
- physical address, downshifted by PAGE_SHIFT to produce a pfn