ia64/xen-unstable

changeset 14507:ed84ed49bb81

[LIBXC] Allocate memory and populate p2m in arch-specific code.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Wed Mar 21 17:02:59 2007 -0500 (2007-03-21)
parents 2734b64255b3
children 265e257388b5
files tools/libxc/xc_dom_boot.c tools/libxc/xc_dom_core.c tools/libxc/xc_dom_ia64.c tools/libxc/xc_dom_x86.c
line diff
     1.1 --- a/tools/libxc/xc_dom_boot.c	Wed Mar 21 17:02:59 2007 -0500
     1.2 +++ b/tools/libxc/xc_dom_boot.c	Wed Mar 21 17:02:59 2007 -0500
     1.3 @@ -133,13 +133,7 @@ int xc_dom_boot_mem_init(struct xc_dom_i
     1.4  
     1.5      xc_dom_printf("%s: called\n", __FUNCTION__);
     1.6  
     1.7 -    if ( (rc = arch_setup_meminit(dom)) != 0 )
     1.8 -        return rc;
     1.9 -
    1.10 -    /* allocate guest memory */
    1.11 -    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
    1.12 -                                           dom->total_pages, 0, 0,
    1.13 -                                           dom->p2m_host);
    1.14 +    rc = arch_setup_meminit(dom);
    1.15      if ( rc != 0 )
    1.16      {
    1.17          xc_dom_panic(XC_OUT_OF_MEMORY,
     2.1 --- a/tools/libxc/xc_dom_core.c	Wed Mar 21 17:02:59 2007 -0500
     2.2 +++ b/tools/libxc/xc_dom_core.c	Wed Mar 21 17:02:59 2007 -0500
     2.3 @@ -639,7 +639,7 @@ int xc_dom_parse_image(struct xc_dom_ima
     2.4  int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
     2.5  {
     2.6      unsigned int page_shift;
     2.7 -    xen_pfn_t nr_pages, pfn;
     2.8 +    xen_pfn_t nr_pages;
     2.9  
    2.10      dom->arch_hooks = xc_dom_find_arch_hooks(dom->guest_type);
    2.11      if ( dom->arch_hooks == NULL )
    2.12 @@ -659,10 +659,6 @@ int xc_dom_mem_init(struct xc_dom_image 
    2.13      xc_dom_printf("%s: 0x%" PRIpfn " pages\n",
    2.14                    __FUNCTION__, dom->total_pages);
    2.15  
    2.16 -    /* setup initial p2m */
    2.17 -    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
    2.18 -    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
    2.19 -        dom->p2m_host[pfn] = pfn;
    2.20      return 0;
    2.21  }
    2.22  
     3.1 --- a/tools/libxc/xc_dom_ia64.c	Wed Mar 21 17:02:59 2007 -0500
     3.2 +++ b/tools/libxc/xc_dom_ia64.c	Wed Mar 21 17:02:59 2007 -0500
     3.3 @@ -18,6 +18,7 @@
     3.4  
     3.5  #include "xg_private.h"
     3.6  #include "xc_dom.h"
     3.7 +#include "xenctrl.h"
     3.8  
     3.9  /* ------------------------------------------------------------------------ */
    3.10  
    3.11 @@ -130,8 +131,19 @@ static void __init register_arch_hooks(v
    3.12  
    3.13  int arch_setup_meminit(struct xc_dom_image *dom)
    3.14  {
    3.15 -    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
    3.16 -    return 0;
    3.17 +    xen_pfn_t pfn;
    3.18 +    int rc;
    3.19 +
    3.20 +    /* setup initial p2m */
    3.21 +    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
    3.22 +    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
    3.23 +        dom->p2m_host[pfn] = pfn;
    3.24 +
    3.25 +    /* allocate guest memory */
    3.26 +    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
    3.27 +                                           dom->total_pages, 0, 0,
    3.28 +                                           dom->p2m_host);
    3.29 +    return rc;
    3.30  }
    3.31  
    3.32  int arch_setup_bootearly(struct xc_dom_image *dom)
     4.1 --- a/tools/libxc/xc_dom_x86.c	Wed Mar 21 17:02:59 2007 -0500
     4.2 +++ b/tools/libxc/xc_dom_x86.c	Wed Mar 21 17:02:59 2007 -0500
     4.3 @@ -22,6 +22,7 @@
     4.4  
     4.5  #include "xg_private.h"
     4.6  #include "xc_dom.h"
     4.7 +#include "xenctrl.h"
     4.8  
     4.9  /* ------------------------------------------------------------------------ */
    4.10  
    4.11 @@ -626,14 +627,26 @@ static int x86_shadow(int xc, domid_t do
    4.12  
    4.13  int arch_setup_meminit(struct xc_dom_image *dom)
    4.14  {
    4.15 -    int rc = 0;
    4.16 +    int rc;
    4.17  
    4.18      x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
    4.19      if ( xc_dom_feature_translated(dom) )
    4.20      {
    4.21          dom->shadow_enabled = 1;
    4.22          rc = x86_shadow(dom->guest_xc, dom->guest_domid);
    4.23 +        if ( rc )
    4.24 +            return rc;
    4.25      }
    4.26 +
    4.27 +    /* setup initial p2m */
    4.28 +    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
    4.29 +    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
    4.30 +        dom->p2m_host[pfn] = pfn;
    4.31 +
    4.32 +    /* allocate guest memory */
    4.33 +    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
    4.34 +                                           dom->total_pages, 0, 0,
    4.35 +                                           dom->p2m_host);
    4.36      return rc;
    4.37  }
    4.38