* Difference between vmalloc_to_pfn and virt_to_pfn
@ 2011-06-28 17:32 Srujan Kotikela
2011-06-29 8:35 ` Tim Deegan
0 siblings, 1 reply; 2+ messages in thread
From: Srujan Kotikela @ 2011-06-28 17:32 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 797 bytes --]
Hi,
I was trying to convert a virtual adrress in a HVM guest to the MFN.
I tried using *vmalloc_to_pfn(virt_address)* and then passed the resulting
pfn to VMM through a hypercall. Inside the VMM I tried calling
gfn_to_mfn(pfn) with pfn receieved from hypercall. This function always gave
me INVALID_MFN error (~0UL).
When I replaced the vmalloc_to_pfn with *virt_to_pfn(virt_address)* I am
getting some MFN value returned by gfn_to_mfn. Just to make sure, I passed
the value to gmfn_to_mfn and I am getting the same value as returned by
gfn_to_mfn.
Now my questions:
1. What is the difference between vmalloc_to_pfn and virt_to_pfn (apart from
the fact that one is linux kernel function and the other is xen function) ?
2. Is there a way to verify/conform whether the MFN is correct ?
_SDK
[-- Attachment #1.2: Type: text/html, Size: 867 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Difference between vmalloc_to_pfn and virt_to_pfn
2011-06-28 17:32 Difference between vmalloc_to_pfn and virt_to_pfn Srujan Kotikela
@ 2011-06-29 8:35 ` Tim Deegan
0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2011-06-29 8:35 UTC (permalink / raw)
To: Srujan Kotikela; +Cc: xen-devel
Hi,
At 12:32 -0500 on 28 Jun (1309264366), Srujan Kotikela wrote:
> I was trying to convert a virtual adrress in a HVM guest to the MFN.
If you just want to access the memory, hvm_copy_{to,from}_guest_virt
should do it. If not, you should be able to use bits of it to do the
translation you need.
> I tried using *vmalloc_to_pfn(virt_address)* and then passed the resulting
> pfn to VMM through a hypercall. Inside the VMM I tried calling
> gfn_to_mfn(pfn) with pfn receieved from hypercall. This function always gave
> me INVALID_MFN error (~0UL).
>
> When I replaced the vmalloc_to_pfn with *virt_to_pfn(virt_address)* I am
> getting some MFN value returned by gfn_to_mfn. Just to make sure, I passed
> the value to gmfn_to_mfn and I am getting the same value as returned by
> gfn_to_mfn.
gmfn_to_mfn is a simple wrapper around gfn_to_mfn, so they usually
give the same answer, even if it's not the one you want.
> Now my questions:
>
> 1. What is the difference between vmalloc_to_pfn and virt_to_pfn (apart from
> the fact that one is linux kernel function and the other is xen function) ?
I don't know about the linux functions, but the xen one virt_to_mfn (not
virt_to_pfn) translates _xen_ virtual addresses to MFNs so it's no use
for a HVM guest virtual address.
> 2. Is there a way to verify/conform whether the MFN is correct ?
The surest way is to map it and check the contents.
Tim.
--
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-29 8:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-28 17:32 Difference between vmalloc_to_pfn and virt_to_pfn Srujan Kotikela
2011-06-29 8:35 ` Tim Deegan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.