I'm writing a PCI device driver and i need to allocate some memory for DMA, I'm using this function:
void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag);
I pass dma_handle to the device.
The return value of this function is a virtual address i can use in the kernel, the thing is i don't want to save this address for each memory allocation im doing.
Is there a way to translate the physical address dma_handle to an address i can use in the kernel? something like one of these functions/macros:
virt_to_page(kaddr)
page_to_pfn(page)
is there a phy_to_kvirt macro/function or any other way to translate a physical address to kernel virtual address?
thanks