[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [PATCH 6 of 6] [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap()
1 files changed, 32 insertions(+), 5 deletions(-) tools/libxc/powerpc64/xc_linux_build.c | 37 +++++++++++++++++++++++++++----- # HG changeset patch # User Ryan Harper <ryanh@xxxxxxxxxx> # Date 1172103252 21600 # Node ID 4a00d1da032210b39d80bdfff4d5f4b63c94d802 # Parent 82803360d949f547abfd7601177ecd836e492e36 [PATCH] tools/libxc: change ppc xc_linux_build to use populate_physmap() Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx> diff -r 82803360d949 -r 4a00d1da0322 tools/libxc/powerpc64/xc_linux_build.c --- a/tools/libxc/powerpc64/xc_linux_build.c Wed Feb 21 18:14:12 2007 -0600 +++ b/tools/libxc/powerpc64/xc_linux_build.c Wed Feb 21 18:14:12 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |