[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [LIBXC] Allocate memory and populate p2m in arch-specific code.



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Date 1174514579 18000
# Node ID ed84ed49bb81e73add5a307e42cf5aeeeac2afd5
# Parent  2734b64255b34cf13be27e17527888b82333ed9d
[LIBXC] Allocate memory and populate p2m in arch-specific code.
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 tools/libxc/xc_dom_boot.c |    8 +-------
 tools/libxc/xc_dom_core.c |    6 +-----
 tools/libxc/xc_dom_ia64.c |   16 ++++++++++++++--
 tools/libxc/xc_dom_x86.c  |   17 +++++++++++++++--
 4 files changed, 31 insertions(+), 16 deletions(-)

diff -r 2734b64255b3 -r ed84ed49bb81 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Wed Mar 21 17:02:59 2007 -0500
+++ b/tools/libxc/xc_dom_boot.c Wed Mar 21 17:02:59 2007 -0500
@@ -133,13 +133,7 @@ int xc_dom_boot_mem_init(struct xc_dom_i
 
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
-    if ( (rc = arch_setup_meminit(dom)) != 0 )
-        return rc;
-
-    /* allocate guest memory */
-    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
-                                           dom->total_pages, 0, 0,
-                                           dom->p2m_host);
+    rc = arch_setup_meminit(dom);
     if ( rc != 0 )
     {
         xc_dom_panic(XC_OUT_OF_MEMORY,
diff -r 2734b64255b3 -r ed84ed49bb81 tools/libxc/xc_dom_core.c
--- a/tools/libxc/xc_dom_core.c Wed Mar 21 17:02:59 2007 -0500
+++ b/tools/libxc/xc_dom_core.c Wed Mar 21 17:02:59 2007 -0500
@@ -639,7 +639,7 @@ int xc_dom_mem_init(struct xc_dom_image 
 int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
 {
     unsigned int page_shift;
-    xen_pfn_t nr_pages, pfn;
+    xen_pfn_t nr_pages;
 
     dom->arch_hooks = xc_dom_find_arch_hooks(dom->guest_type);
     if ( dom->arch_hooks == NULL )
@@ -659,10 +659,6 @@ int xc_dom_mem_init(struct xc_dom_image 
     xc_dom_printf("%s: 0x%" PRIpfn " pages\n",
                   __FUNCTION__, dom->total_pages);
 
-    /* setup initial p2m */
-    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
-    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
-        dom->p2m_host[pfn] = pfn;
     return 0;
 }
 
diff -r 2734b64255b3 -r ed84ed49bb81 tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Wed Mar 21 17:02:59 2007 -0500
+++ b/tools/libxc/xc_dom_ia64.c Wed Mar 21 17:02:59 2007 -0500
@@ -18,6 +18,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "xenctrl.h"
 
 /* ------------------------------------------------------------------------ */
 
@@ -130,8 +131,19 @@ static void __init register_arch_hooks(v
 
 int arch_setup_meminit(struct xc_dom_image *dom)
 {
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
+    xen_pfn_t pfn;
+    int rc;
+
+    /* setup initial p2m */
+    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
+        dom->p2m_host[pfn] = pfn;
+
+    /* allocate guest memory */
+    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+                                           dom->total_pages, 0, 0,
+                                           dom->p2m_host);
+    return rc;
 }
 
 int arch_setup_bootearly(struct xc_dom_image *dom)
diff -r 2734b64255b3 -r ed84ed49bb81 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Wed Mar 21 17:02:59 2007 -0500
+++ b/tools/libxc/xc_dom_x86.c  Wed Mar 21 17:02:59 2007 -0500
@@ -22,6 +22,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "xenctrl.h"
 
 /* ------------------------------------------------------------------------ */
 
@@ -626,14 +627,26 @@ static int x86_shadow(int xc, domid_t do
 
 int arch_setup_meminit(struct xc_dom_image *dom)
 {
-    int rc = 0;
+    int rc;
 
     x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
     if ( xc_dom_feature_translated(dom) )
     {
         dom->shadow_enabled = 1;
         rc = x86_shadow(dom->guest_xc, dom->guest_domid);
-    }
+        if ( rc )
+            return rc;
+    }
+
+    /* setup initial p2m */
+    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
+        dom->p2m_host[pfn] = pfn;
+
+    /* allocate guest memory */
+    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+                                           dom->total_pages, 0, 0,
+                                           dom->p2m_host);
     return rc;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.