|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Difference between vmalloc_to_pfn and virt_to_pfn
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@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|