Discussion about iopa()

Timur Tabi timur at freescale.com
Fri Feb 9 00:41:58 EST 2007


Li Yang-r58472 wrote:

> Do you think we should remove iopa?

It's not used very much any more.  If you do a grep of the code, I think 
only some legacy drivers use it.

As long as ioremap'd memory is both physically and virtually contiguous, 
I think iopa() is unnecessary.

> 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.  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.

Walking the page table is slower than using pointer math, so you want to 
avoid iopa() if you can.

I think in general, the driver that calls ioremap() should store the 
physical address along with the virtual address of the base pointer.



More information about the Linuxppc-dev mailing list