Skip to contentSkip to conversation

__va() vs phys_to_virt()

DISCUSSION Hollis Blanchard 4 participants 6 messages Mar 18, 2005 – Mar 22, 2005

lore
Share & tools
lore
#0 lore raw

Can someone explain where it's appropriate to use __va() and where phys_to_virt() should be used instead? Or are they truly synonymous, and we should phase out one or the other?

Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
#1 lore raw

I thought they are the same. phys_to_virt() essentially calls __va().

Xin

Quoted 9 lines · Hollis Blanchard

Can someone explain where it's appropriate to use __va() and where phys_to_virt() should be used instead? Or are they truly synonymous, and we should phase out one or the other?

--
Hollis Blanchard
IBM Linux Technology Center

Quoted 10 lines

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xen-devel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#2 lore raw
Quoted 1 line · Xin Zhao

I thought they are the same. phys_to_virt() essentially calls __va().

They are implemented the same on x86, but that does not imply they mean the same thing.

Quoted 19 lines · Hollis Blanchard
Quoted 18 lines

Can someone explain where it's appropriate to use __va() and where phys_to_virt() should be used instead? Or are they truly synonymous, and we should phase out one or the other?

--
Hollis Blanchard
IBM Linux Technology Center

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xen-devel

Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
#3 lore raw
Quoted 5 lines · Hollis Blanchard
Quoted 1 line · Xin Zhao

I thought they are the same. phys_to_virt() essentially calls __va().

They are implemented the same on x86, but that does not imply they mean the same thing.

A quick grep shows that most platforms implement __va and phys_to_virt the same way, as addr + PAGE_OFFSET. But alpha seems to do phys_to_virt a little differently. There may be others though, it was only a quick scan.

Jesse

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#4 lore raw
Quoted 10 lines · Jesse Barnes
Quoted 5 lines · Hollis Blanchard
Quoted 1 line · Xin Zhao

I thought they are the same. phys_to_virt() essentially calls __va().

They are implemented the same on x86, but that does not imply they mean the same thing.

A quick grep shows that most platforms implement __va and phys_to_virt the same way, as addr + PAGE_OFFSET. But alpha seems to do phys_to_virt a little differently. There may be others though, it was only a quick scan.

I should clarify that I'm not talking about Linux, but rather the Xen core. Linux's use is obviously related, as Xen was a copy-and-paste job, but I'm asking specifically how/if the meanings of these functions differ in Xen.

Signature · 9 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
#5 lore raw
In reply to Hollis Blanchard
Quoted 3 lines · Hollis Blanchard

Can someone explain where it's appropriate to use __va() and where phys_to_virt() should be used instead? Or are they truly synonymous, and we should phase out one or the other?

One minor thing on some Linux arches is that virt_to_phys() is volatile, __pa() is just a macro, so they have different optimization rules.

-- Dave

-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click