debuggers.hg

changeset 22296:90a64629f7c0

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>
author Ian Campbell <ian.campbell@citrix.com>
date Mon Oct 18 17:15:26 2010 +0100 (2010-10-18)
parents 835b06768104
children d923bf8456ad
files tools/libxc/xc_dom_x86.c tools/libxc/xc_domain.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_dom_x86.c	Mon Oct 18 17:14:07 2010 +0100
     1.2 +++ b/tools/libxc/xc_dom_x86.c	Mon Oct 18 17:15:26 2010 +0100
     1.3 @@ -815,31 +815,26 @@ int arch_setup_bootlate(struct xc_dom_im
     1.4      else
     1.5      {
     1.6          /* paravirtualized guest with auto-translation */
     1.7 -        struct xen_add_to_physmap xatp;
     1.8          int i;
     1.9  
    1.10          /* Map shared info frame into guest physmap. */
    1.11 -        xatp.domid = dom->guest_domid;
    1.12 -        xatp.space = XENMAPSPACE_shared_info;
    1.13 -        xatp.idx = 0;
    1.14 -        xatp.gpfn = dom->shared_info_pfn;
    1.15 -        rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
    1.16 +        rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
    1.17 +                                      XENMAPSPACE_shared_info,
    1.18 +                                      0, dom->shared_info_pfn);
    1.19          if ( rc != 0 )
    1.20          {
    1.21              xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, "%s: mapping"
    1.22                           " shared_info failed (pfn=0x%" PRIpfn ", rc=%d)",
    1.23 -                         __FUNCTION__, xatp.gpfn, rc);
    1.24 +                         __FUNCTION__, dom->shared_info_pfn, rc);
    1.25              return rc;
    1.26          }
    1.27  
    1.28          /* Map grant table frames into guest physmap. */
    1.29          for ( i = 0; ; i++ )
    1.30          {
    1.31 -            xatp.domid = dom->guest_domid;
    1.32 -            xatp.space = XENMAPSPACE_grant_table;
    1.33 -            xatp.idx = i;
    1.34 -            xatp.gpfn = dom->total_pages + i;
    1.35 -            rc = xc_memory_op(dom->xch, XENMEM_add_to_physmap, &xatp);
    1.36 +            rc = xc_domain_add_to_physmap(dom->xch, dom->guest_domid,
    1.37 +                                          XENMAPSPACE_grant_table,
    1.38 +                                          i, dom->total_pages + i);
    1.39              if ( rc != 0 )
    1.40              {
    1.41                  if ( (i > 0) && (errno == EINVAL) )
    1.42 @@ -849,7 +844,7 @@ int arch_setup_bootlate(struct xc_dom_im
    1.43                  }
    1.44                  xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
    1.45                               "%s: mapping grant tables failed " "(pfn=0x%"
    1.46 -                             PRIpfn ", rc=%d)", __FUNCTION__, xatp.gpfn, rc);
    1.47 +                             PRIpfn ", rc=%d)", __FUNCTION__, dom->total_pages + i, rc);
    1.48                  return rc;
    1.49              }
    1.50          }
     2.1 --- a/tools/libxc/xc_domain.c	Mon Oct 18 17:14:07 2010 +0100
     2.2 +++ b/tools/libxc/xc_domain.c	Mon Oct 18 17:15:26 2010 +0100
     2.3 @@ -682,6 +682,21 @@ int xc_domain_decrease_reservation_exact
     2.4      return err;
     2.5  }
     2.6  
     2.7 +int xc_domain_add_to_physmap(xc_interface *xch,
     2.8 +                             uint32_t domid,
     2.9 +                             unsigned int space,
    2.10 +                             unsigned long idx,
    2.11 +                             xen_pfn_t gpfn)
    2.12 +{
    2.13 +    struct xen_add_to_physmap xatp = {
    2.14 +        .domid = domid,
    2.15 +        .space = space,
    2.16 +        .idx = idx,
    2.17 +        .gpfn = gpfn,
    2.18 +    };
    2.19 +    return xc_memory_op(xch, XENMEM_add_to_physmap, &xatp);
    2.20 +}
    2.21 +
    2.22  int xc_domain_populate_physmap(xc_interface *xch,
    2.23                                 uint32_t domid,
    2.24                                 unsigned long nr_extents,
     3.1 --- a/tools/libxc/xenctrl.h	Mon Oct 18 17:14:07 2010 +0100
     3.2 +++ b/tools/libxc/xenctrl.h	Mon Oct 18 17:15:26 2010 +0100
     3.3 @@ -811,6 +811,12 @@ int xc_domain_decrease_reservation_exact
     3.4                                           unsigned int extent_order,
     3.5                                           xen_pfn_t *extent_start);
     3.6  
     3.7 +int xc_domain_add_to_physmap(xc_interface *xch,
     3.8 +                             uint32_t domid,
     3.9 +                             unsigned int space,
    3.10 +                             unsigned long idx,
    3.11 +                             xen_pfn_t gpfn);
    3.12 +
    3.13  int xc_domain_populate_physmap(xc_interface *xch,
    3.14                                 uint32_t domid,
    3.15                                 unsigned long nr_extents,