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-changelog

[Xen-changelog] [xen-unstable] [IA64] IA64 counter part of the change 12

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] IA64 counter part of the change 12204:e6fdb32b786c of xen-unstable.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 15 Nov 2006 00:40:27 +0000
Delivery-date: Tue, 14 Nov 2006 16:41:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 5c5af79e7272c81e5a01dc0519ed7f0ac9581f6b
# Parent  93d7d002540836ab177feb406bbd64d0d0eb1308
[IA64] IA64 counter part of the change 12204:e6fdb32b786c of xen-unstable.hg

Remove xc_ia64_get_pfn_list() from setup_guest() in xc_linux_build.c,
use xc_domain_populate_physmap() and xc_domain_translate_gpfn_list().

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux_build.c |   76 ++++++++++++++++++-------------------------
 xen/arch/ia64/xen/dom0_ops.c |    2 -
 xen/arch/ia64/xen/dom_fw.c   |   13 +++----
 xen/arch/ia64/xen/domain.c   |   15 --------
 4 files changed, 39 insertions(+), 67 deletions(-)

diff -r 93d7d0025408 -r 5c5af79e7272 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Fri Nov 10 11:14:26 2006 -0700
+++ b/tools/libxc/xc_linux_build.c      Fri Nov 10 11:14:32 2006 -0700
@@ -496,6 +496,26 @@ static int setup_guest(int xc_handle,
     if ( rc != 0 )
         goto error_out;
 
+    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
+    {
+        PERROR("Could not allocate memory");
+        goto error_out;
+    }
+    for ( i = 0; i < nr_pages; i++ )
+        page_array[i] = i;
+    if ( xc_domain_memory_populate_physmap(xc_handle, dom, nr_pages,
+                                           0, 0, page_array) )
+    {
+        PERROR("Could not allocate memory for PV guest.\n");
+        goto error_out;
+    }
+    if ( xc_domain_translate_gpfn_list(xc_handle, dom, nr_pages,
+                                       page_array, page_array) )
+    {
+        PERROR("Could not translate addresses of PV guest.\n");
+        goto error_out;
+    }
+
     dsi.v_start    = round_pgdown(dsi.v_start);
     vinitrd_start  = round_pgup(dsi.v_end);
     start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
@@ -511,23 +531,10 @@ static int setup_guest(int xc_handle,
     if ( xc_domctl(xc_handle, &domctl) )
         goto error_out;
 
-    if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
-    {
-        PERROR("Could not allocate memory");
-        goto error_out;
-    }
-
     start_page = dsi.v_start >> PAGE_SHIFT;
-    if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
-                              start_page, nr_pages) != nr_pages )
-    {
-        PERROR("Could not get the page frame list");
-        goto error_out;
-    }
-
     /* in order to get initrd->len, we need to load initrd image at first */
     if ( load_initrd(xc_handle, dom, initrd,
-                     vinitrd_start - dsi.v_start, page_array) )
+                     vinitrd_start - dsi.v_start, page_array + start_page) )
         goto error_out;
 
     vinitrd_end    = vinitrd_start + initrd->len;
@@ -535,18 +542,9 @@ static int setup_guest(int xc_handle,
     pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT;
     if ( pgnr > nr_pages )
     {
-        free(page_array);
-        if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL )
-        {
-            PERROR("Could not reallocate memory");
-            goto error_out;
-        }
-        if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
-                                  start_page, pgnr) != pgnr )
-        {
-                PERROR("Could not get the page frame list");
-                goto error_out;
-        }
+        PERROR("too small memory is specified. "
+               "At least %ld kb is necessary.\n",
+               pgnr << (PAGE_SHIFT - 10));
     }
 
     IPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n"
@@ -558,31 +556,21 @@ static int setup_guest(int xc_handle,
            _p(dsi.v_start),     _p(v_end));
     IPRINTF(" ENTRY ADDRESS: %p\n", _p(dsi.v_kernentry));
 
-    (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
-                           &dsi);
-
-    /* Now need to retrieve machine pfn for system pages:
-     *  start_info/store/console
-     */
-    pgnr = 3;
-    if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array,
-                              nr_pages - 3, pgnr) != pgnr )
-    {
-        PERROR("Could not get page frame for xenstore");
-        goto error_out;
-    }
-
-    *store_mfn = page_array[1];
-    *console_mfn = page_array[2];
+    (load_funcs.loadimage)(image, image_size, xc_handle, dom,
+                           page_array + start_page, &dsi);
+
+    *store_mfn = page_array[nr_pages - 2];
+    *console_mfn = page_array[nr_pages - 1];
     IPRINTF("start_info: 0x%lx at 0x%lx, "
            "store_mfn: 0x%lx at 0x%lx, "
            "console_mfn: 0x%lx at 0x%lx\n",
-           page_array[0], nr_pages - 3,
+           page_array[nr_pages - 3], nr_pages - 3,
            *store_mfn,    nr_pages - 2,
            *console_mfn,  nr_pages - 1);
 
     start_info = xc_map_foreign_range(
-        xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, page_array[0]);
+        xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
+        page_array[nr_pages - 3]);
     memset(start_info, 0, sizeof(*start_info));
     rc = xc_version(xc_handle, XENVER_version, NULL);
     sprintf(start_info->magic, "xen-%i.%i-ia64", rc >> 16, rc & (0xFFFF));
diff -r 93d7d0025408 -r 5c5af79e7272 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Fri Nov 10 11:14:26 2006 -0700
+++ b/xen/arch/ia64/xen/dom0_ops.c      Fri Nov 10 11:14:32 2006 -0700
@@ -24,7 +24,6 @@
 #include <xen/errno.h>
 #include <xen/nodemask.h>
 
-void build_physmap_table(struct domain *d);
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
 
 extern unsigned long total_pages;
@@ -117,7 +116,6 @@ long arch_do_domctl(xen_domctl_t *op, XE
                 vmx_setup_platform(d);
             }
             else {
-                build_physmap_table(d);
                 dom_fw_setup(d, ds->bp, ds->maxmem);
                 if (ds->xsi_va)
                     d->arch.shared_info_va = ds->xsi_va;
diff -r 93d7d0025408 -r 5c5af79e7272 xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Fri Nov 10 11:14:26 2006 -0700
+++ b/xen/arch/ia64/xen/dom_fw.c        Fri Nov 10 11:14:32 2006 -0700
@@ -55,9 +55,9 @@ extern unsigned long running_on_sim;
                tables->func_ptrs[pfn++] = 0;                           \
        } while (0)
 
-// allocate a page for fw
-// build_physmap_table() which is called by new_thread()
-// does for domU.
+/* allocate a page for fw
+ * guest_setup() @ libxc/xc_linux_build.c does for domU
+ */
 static inline void
 assign_new_domain_page_if_dom0(struct domain *d, unsigned long mpaddr)
 {
@@ -634,9 +634,10 @@ complete_dom0_memmap(struct domain *d,
        sort(tables->efi_memmap, num_mds, sizeof(efi_memory_desc_t),
             efi_mdt_cmp, NULL);
 
-       // dom0 doesn't need build_physmap_table()
-       // see arch_set_info_guest()
-       // instead we allocate pages manually.
+       /* setup_guest() @ libxc/xc_linux_build() arranges memory for domU.
+        * however no one arranges memory for dom0,
+        * instead we allocate pages manually.
+        */
        for (i = 0; i < num_mds; i++) {
                md = &tables->efi_memmap[i];
                if (md->phys_addr > maxmem)
diff -r 93d7d0025408 -r 5c5af79e7272 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Fri Nov 10 11:14:26 2006 -0700
+++ b/xen/arch/ia64/xen/domain.c        Fri Nov 10 11:14:32 2006 -0700
@@ -628,21 +628,6 @@ void domain_relinquish_resources(struct 
            xfree(d->arch.sal_data);
 }
 
-void build_physmap_table(struct domain *d)
-{
-       struct list_head *list_ent = d->page_list.next;
-       unsigned long mfn, i = 0;
-
-       while(list_ent != &d->page_list) {
-           mfn = page_to_mfn(list_entry(
-               list_ent, struct page_info, list));
-           assign_domain_page(d, i << PAGE_SHIFT, mfn << PAGE_SHIFT);
-
-           i++;
-           list_ent = mfn_to_page(mfn)->list.next;
-       }
-}
-
 unsigned long
 domain_set_shared_info_va (unsigned long va)
 {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] IA64 counter part of the change 12204:e6fdb32b786c of xen-unstable.hg, Xen patchbot-unstable <=