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 5 of 5] [PATCH] tools/libxc: change ppc xc_linux_build t

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH 5 of 5] [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap()
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Thu, 01 Mar 2007 13:39:20 -0500
Delivery-date: Thu, 01 Mar 2007 11:38:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1172777955@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
1 files changed, 32 insertions(+), 5 deletions(-)
tools/libxc/powerpc64/xc_linux_build.c |   37 +++++++++++++++++++++++++++-----


# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Date 1172776732 21600
# Node ID 178a3e6615fbf8dd556a4f8afa87e58bf7bbe575
# Parent  76a5923eaed2cc0f3ea2f9b1ac26c82fd8e7bc2b
[PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap()

Now that ppc has implemented its guest_physmap_{add/remove}_page() domU builder
needs to use populate_physmap() which will call out to the arch hooks.

To use populate_physmap, we still allocate in the same 16MB chunks, but we have
to pass down an array of pfns to tell the hypervisor how to map the newly
allocated mfns.  The extent_array is just such an array.  It is initialized to
the end of the RMA, and we adjust the pfn values in the array based on how many
extents we've allocated.

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>

diff -r 76a5923eaed2 -r 178a3e6615fb tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Thu Mar 01 13:18:52 2007 -0600
+++ b/tools/libxc/powerpc64/xc_linux_build.c    Thu Mar 01 13:18:52 2007 -0600
@@ -166,6 +166,7 @@ int xc_linux_build(int xc_handle,
 {
     struct domain_setup_info dsi;
     xen_pfn_t *page_array = NULL;
+    xen_pfn_t *ext_array = NULL;
     unsigned long nr_pages;
     unsigned long devtree_addr = 0;
     unsigned long kern_addr;
@@ -182,6 +183,8 @@ int xc_linux_build(int xc_handle,
     int rma_log = 26;  /* 64MB RMA */
     int rc = 0;
     int op;
+    int i;
+    int j;
     struct ft_cxt devtree;
 
     DPRINTF("%s\n", __func__);
@@ -219,11 +222,34 @@ int xc_linux_build(int xc_handle,
             (((1 << extent_order) >> 10) * PAGE_SIZE) >> 10);
 
     /* now allocate the remaining memory as large-order allocations */
-    DPRINTF("increase_reservation(%u, %llu, %u)\n", domid, nr_extents, 
extent_order);
-    if (xc_domain_memory_increase_reservation(xc_handle, domid, nr_extents, 
-                                              extent_order, 0, NULL)) {
-        rc = -1;
-        goto out;
+    for ( i = 0; i < nr_extents; i++ ) {
+        /* all extents are of the same size, alloc array once can re-use */
+        if ( ext_array == NULL ) {
+            if ((ext_array = malloc((1<<extent_order)*sizeof(xen_pfn_t))) == 
NULL) {
+                PERROR("Couldn't allocate memory for extent allocation\n");
+                rc = 1;
+                goto out;
+            }
+        }
+
+        /* initialize the extent array with pfn values.  The
+           starting pfn is based on which extent past the RMA
+           we are using.
+           rma_pages is the starting pfn base
+           (i*(1<<extent_order)) will offset into the proper extent */
+        for ( j = 0; j < (1 << extent_order); j++ )
+            ext_array[j] = rma_pages + (i*(1 << extent_order)) + j;
+
+        DPRINTF("populate_physmap(DOM%u, order %u, starting_pfn %llx)\n",
+                domid, extent_order, ext_array[0]);
+
+        if ( xc_domain_memory_populate_physmap(xc_handle, domid, 1, 
extent_order,
+                                               0, ext_array) )
+        {
+            PERROR("Could not allocate extents\n");
+            rc = -1;
+            goto out;
+        }
     }
 
     if (get_rma_page_array(xc_handle, domid, &page_array, rma_pages)) {
@@ -297,5 +323,6 @@ out:
 out:
     free_devtree(&devtree);
     free_page_array(page_array);
+    free_page_array(ext_array);
     return rc;
 }

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