aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-18 17:15:26 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-18 17:15:26 +0100
commit9d316132c2957a49a0cbceced11566dce835d83a (patch)
tree39da545b74d0301e1e0e864701d0f6de252b0f5a /tools
parent9bf9eada0dad47460fbecd632b944424a3255664 (diff)
downloadxen-9d316132c2957a49a0cbceced11566dce835d83a.tar.gz
xen-9d316132c2957a49a0cbceced11566dce835d83a.tar.bz2
xen-9d316132c2957a49a0cbceced11566dce835d83a.zip
libxc: add xc_domain_add_to_physmap to wrap XENMEM_add_to_physmap
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxc/xc_dom_x86.c21
-rw-r--r--tools/libxc/xc_domain.c15
-rw-r--r--tools/libxc/xenctrl.h6
3 files changed, 29 insertions, 13 deletions
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 060e147c7f..0cf1687718 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -815,31 +815,26 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
else
{
/* paravirtualized guest with auto-translation */
- struct xen_add_to_physmap xatp;
int i;
/* Map shared info frame into guest physmap. */
- xatp.domid = dom->guest_domid;
- xatp.space = XENMAPSPACE_shared_info;
- xatp.idx = 0;
- xatp.gpfn = dom->shared_info_pfn;
- rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
+ rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
+ XENMAPSPACE_shared_info,
+ 0, dom->shared_info_pfn);
if ( rc != 0 )
{
xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, "%s: mapping"
" shared_info failed (pfn=0x%" PRIpfn ", rc=%d)",
- __FUNCTION__, xatp.gpfn, rc);
+ __FUNCTION__, dom->shared_info_pfn, rc);
return rc;
}
/* Map grant table frames into guest physmap. */
for ( i = 0; ; i++ )
{
- xatp.domid = dom->guest_domid;
- xatp.space = XENMAPSPACE_grant_table;
- xatp.idx = i;
- xatp.gpfn = dom->total_pages + i;
- rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
+ rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
+ XENMAPSPACE_grant_table,
+ i, dom->total_pages + i);
if ( rc != 0 )
{
if ( (i > 0) && (errno == EINVAL) )
@@ -849,7 +844,7 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
}
xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
"%s: mapping grant tables failed " "(pfn=0x%"
- PRIpfn ", rc=%d)", __FUNCTION__, xatp.gpfn, rc);
+ PRIpfn ", rc=%d)", __FUNCTION__, dom->total_pages + i, rc);
return rc;
}
}
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 3ec2981a6c..fb31852062 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -682,6 +682,21 @@ int xc_domain_decrease_reservation_exact(xc_interface *xch,
return err;
}
+int xc_domain_add_to_physmap(xc_interface *xch,
+ uint32_t domid,
+ unsigned int space,
+ unsigned long idx,
+ xen_pfn_t gpfn)
+{
+ struct xen_add_to_physmap xatp = {
+ .domid = domid,
+ .space = space,
+ .idx = idx,
+ .gpfn = gpfn,
+ };
+ return xc_memory_op(xch, XENMEM_add_to_physmap, &xatp);
+}
+
int xc_domain_populate_physmap(xc_interface *xch,
uint32_t domid,
unsigned long nr_extents,
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 852bbcc8e2..a720705a72 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -811,6 +811,12 @@ int xc_domain_decrease_reservation_exact(xc_interface *xch,
unsigned int extent_order,
xen_pfn_t *extent_start);
+int xc_domain_add_to_physmap(xc_interface *xch,
+ uint32_t domid,
+ unsigned int space,
+ unsigned long idx,
+ xen_pfn_t gpfn);
+
int xc_domain_populate_physmap(xc_interface *xch,
uint32_t domid,
unsigned long nr_extents,