Discussion about iopa()

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Feb 9 08:26:05 EST 2007


> Do you think we should remove iopa?

I'm really not fan of it. We might keep it for now to not break
everything that uses it, but I'd rather avoid new things using it
directly.

> The information is often not so obvious.  The most case of using iopa is
> that we allocate memory from MURAM using rheap, and then get the
> physical address of it.

Then provide specific MURAM functions that return a dma_addr_t in
addition to the virtual address and have your driver keep track of that.
It's more efficient than walking the page tables all the time anyway.

Remember that if you have CONFIG_HIGHMEM, you can potentially have to
create TLB entries for accessing the PTEs used by iopa to resolve the
address. It's really not efficient.

>   We can calculate phy_addr by using:  virt_addr
> - virt_muram_base + phy_muram_base, but it is not as straightforward as
> just using the page table, let alone we need to keep track of
> virt_muram_base and phy_muram_base.

Using the page table is much less efficient. As I said, I'd rather see
you having a set of alloc/free functions for your MURAM that return the
dma_addr_t as well as the virtual address (like dma_alloc_coherent does)
and have your drivers using these keep track of the dma_addr_t.

Ben.





More information about the Linuxppc-dev mailing list