Hi all, I have some confusion about the purpose of the two functions. map_pages_to_xen is to map machine page range in Xen virtual address space. mfn_to_virt() is to convert between machine frame number and xen-heap virtual address. So what is the difference? When I need to map some machine pages to Xen space, which function should I use? Thanks, -- Xinxin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Jan Beulich
2013-Feb-26 08:33 UTC
Re: The different between map_pages_to_xen and mfn_to_virt
>>> On 25.02.13 at 21:41, Xinxin Jin <xinxinjin89@gmail.com> wrote: > I have some confusion about the purpose of the two functions. > map_pages_to_xen is to map machine page range in Xen virtual address space. > mfn_to_virt() is to convert between machine frame number and xen-heap > virtual address. So what is the difference? When I need to map some machine > pages to Xen space, which function should I use? Thanks,You describe the difference yourself - one function establishes a mapping, while the other only does a translation assuming that the 1:1 mapping for the given MFN was already established (at boot time, or during memory hotplug processing). Jan
Tim Deegan
2013-Feb-26 09:52 UTC
Re: The different between map_pages_to_xen and mfn_to_virt
At 08:33 +0000 on 26 Feb (1361867621), Jan Beulich wrote:> >>> On 25.02.13 at 21:41, Xinxin Jin <xinxinjin89@gmail.com> wrote: > > I have some confusion about the purpose of the two functions. > > map_pages_to_xen is to map machine page range in Xen virtual address space. > > mfn_to_virt() is to convert between machine frame number and xen-heap > > virtual address. So what is the difference? When I need to map some machine > > pages to Xen space, which function should I use? Thanks, > > You describe the difference yourself - one function establishes a > mapping, while the other only does a translation assuming that > the 1:1 mapping for the given MFN was already established (at > boot time, or during memory hotplug processing).Also, if the pages you''re trying to map are ordinary RAM, you should use map_domain_page() to map them and unmap_domain_page() when you''re done. Tim.