WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [PATCH 2 of 6] [PATCH] xen: move dom0 memory allocation into co

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH 2 of 6] [PATCH] xen: move dom0 memory allocation into construct_dom0()
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Wed, 21 Feb 2007 18:17:00 -0500
Delivery-date: Wed, 21 Feb 2007 16:16:20 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1172103418@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
2 files changed, 17 insertions(+), 14 deletions(-)
xen/arch/powerpc/domain_build.c |   24 ++++++++++++++++--------
xen/arch/powerpc/setup.c        |    7 +------


# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Date 1172103252 21600
# Node ID 84ec1b4d5cd50cc9d49202eb978a4715c4780e28
# Parent  17815286856eb2b67a64e64f2a0a53a7c5d505e2
[PATCH] xen: move dom0 memory allocation into construct_dom0()
Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>

diff -r 17815286856e -r 84ec1b4d5cd5 xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Wed Feb 21 18:14:12 2007 -0600
+++ b/xen/arch/powerpc/domain_build.c   Wed Feb 21 18:14:12 2007 -0600
@@ -112,9 +112,9 @@ int construct_dom0(struct domain *d,
     struct domain_setup_info dsi;
     ulong dst;
     u64 *ofh_tree;
-    uint rma_nrpages = 1 << d->arch.rma_order;
-    ulong rma_sz = rma_size(d->arch.rma_order);
-    ulong rma = page_to_maddr(d->arch.rma_page);
+    uint rma_nrpages;
+    ulong rma_sz;
+    ulong rma;
     start_info_t *si;
     ulong eomem;
     int am64 = 1;
@@ -131,8 +131,6 @@ int construct_dom0(struct domain *d,
     if (image_len == 0)
         panic("No Dom0 image supplied\n");
 
-    cpu_init_vcpu(v);
-
     memset(&dsi, 0, sizeof(struct domain_setup_info));
     dsi.image_addr = image_start;
     dsi.image_len  = image_len;
@@ -154,9 +152,6 @@ int construct_dom0(struct domain *d,
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    /* By default DOM0 is allocated all available memory. */
-    d->max_pages = ~0U;
-
     /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */
     if (dom0_nrpages == 0) {
         dom0_nrpages = total_pages >> 4;
@@ -164,6 +159,19 @@ int construct_dom0(struct domain *d,
         if (dom0_nrpages < CONFIG_MIN_DOM0_PAGES)
             dom0_nrpages = CONFIG_MIN_DOM0_PAGES;
     }
+
+    /* By default DOM0 is allocated all available memory. */
+    d->max_pages = dom0_nrpages;
+
+    if (0 > allocate_rma(d, cpu_default_rma_order_pages()))
+        panic("Error allocating domain 0 RMA\n");
+
+    /* init vcpu now that RMA has been allocated */
+    cpu_init_vcpu(v);
+
+    rma_nrpages = 1 << d->arch.rma_order;
+    rma_sz = rma_size(d->arch.rma_order);
+    rma = page_to_maddr(d->arch.rma_page);
 
     /* make sure we are at least as big as the RMA */
     if (dom0_nrpages > rma_nrpages)
diff -r 17815286856e -r 84ec1b4d5cd5 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Wed Feb 21 18:14:12 2007 -0600
+++ b/xen/arch/powerpc/setup.c  Wed Feb 21 18:14:12 2007 -0600
@@ -369,13 +369,8 @@ static void __init __start_xen(multiboot
 
     /* Create initial domain 0. */
     dom0 = domain_create(0, 0);
-    if (dom0 == NULL)
+    if ( (dom0 == NULL) || (alloc_vcpu(dom0, 0, 0) == NULL) )
         panic("Error creating domain 0\n");
-    dom0->max_pages = ~0U;
-    if (0 > allocate_rma(dom0, cpu_default_rma_order_pages()))
-        panic("Error allocating domain 0 RMA\n");
-    if (NULL == alloc_vcpu(dom0, 0, 0))
-        panic("Error creating domain 0 vcpu 0\n");
 
     /* The Interrupt Controller will route everything to CPU 0 so we
      * need to make sure Dom0's vVCPU 0 is pinned to the CPU */

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