On 1/30/2013 3:44 PM, Jason Gunthorpe wrote:
On Wed, Jan 30, 2013 at 03:36:48PM -0600, Steve Wise wrote:
I wonder, then, what the correct service is to get the cpu physical
address from a kernel virtual address returned from
dma_alloc_coherent()? I think this is correct as-is, since I think
dma_alloc_coherent() falls under the "directly mapped" addresses in
the virt_to_phys() prototype comment.
DMA-API.txt says:
This routine allocates a region of <size> bytes of consistent memory.
It also returns a <dma_handle> which may be cast to an unsigned
integer the same width as the bus and used as the physical address
base of the region.
So instead of virt_to_phys you should use dma_addr??
I don't think so. The result of virt_to_phys() is used in
remap_pfn_range() to map this memory into user space... The dma_addr is
give to HW for DMA operations.
I think the note about 'directly mapped' refers to things the arch
setups during early boot, not dma_alloc stuff.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html