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

[Xen-changelog] [xen-unstable] [IA64] Fix Vti



# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Node ID d901f2fe8c25c149b4ac945cd202562aa194b857
# Parent  85b9711cb8955d67d65f67dfadf3e3d5eacfb2d8
[IA64] Fix Vti

Use new foreign page mapping interface

Signed-off-by: Xu Anthony <Anthony.xu@xxxxxxxxx>
Signed-off-by: Zhang Xiantao <xiantao.zhang@xxxxxxxxx>
Signed-off-by: Zhang Xin <xing.z.zhang@xxxxxxxxx>
---
 tools/ioemu/vl.c                     |   34 +++++++++++++---------------------
 tools/libxc/ia64/xc_ia64_hvm_build.c |   29 ++++++-----------------------
 2 files changed, 19 insertions(+), 44 deletions(-)

diff -r 85b9711cb895 -r d901f2fe8c25 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Tue Dec 05 13:42:37 2006 -0700
+++ b/tools/ioemu/vl.c  Wed Dec 06 02:34:46 2006 -0700
@@ -6378,6 +6378,10 @@ int main(int argc, char **argv)
     }
 
 #if defined (__ia64__)
+    /* ram_size passed from xend has added on GFW memory,
+       so we must subtract it here */
+    ram_size -= 16 * MEM_M;
+
     if (ram_size > MMIO_START)
         ram_size += 1 * MEM_G; /* skip 3G-4G MMIO, LEGACY_IO_SPACE etc. */
 #endif
@@ -6443,36 +6447,24 @@ int main(int argc, char **argv)
     free(page_array);
 
 #elif defined(__ia64__)
-  
-    if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
-                             IO_PAGE_START >> PAGE_SHIFT, 3) != 3) {
-        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
-        exit(-1);
-    }
 
     shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
                                        PROT_READ|PROT_WRITE,
-                                       page_array[0]);
-
-    fprintf(logfile, "shared page at pfn:%lx, mfn: %016lx\n",
-            IO_PAGE_START >> PAGE_SHIFT, page_array[0]);
+                                       IO_PAGE_START >> PAGE_SHIFT);
 
     buffered_io_page =xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
                                        PROT_READ|PROT_WRITE,
-                                       page_array[2]);
-    fprintf(logfile, "Buffered IO page at pfn:%lx, mfn: %016lx\n",
-            BUFFER_IO_PAGE_START >> PAGE_SHIFT, page_array[2]);
-
-    if (xc_ia64_get_pfn_list(xc_handle, domid,
-                             page_array, 0, nr_pages) != nr_pages) {
-        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
-        exit(-1);
-    }
-
+                                       BUFFER_IO_PAGE_START >> PAGE_SHIFT);
+
+    for (i = 0; i < tmp_nr_pages; i++)
+        page_array[i] = i;
+       
+    /* VTI will not use memory between 3G~4G, so we just pass a legal pfn
+       to make QEMU map continuous virtual memory space */
     if (ram_size > MMIO_START) {       
         for (i = 0 ; i < (MEM_G >> PAGE_SHIFT); i++)
             page_array[(MMIO_START >> PAGE_SHIFT) + i] =
-                page_array[(IO_PAGE_START >> PAGE_SHIFT) + 1];
+                (STORE_PAGE_START >> PAGE_SHIFT); 
     }
 
     phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
diff -r 85b9711cb895 -r d901f2fe8c25 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Tue Dec 05 13:42:37 2006 -0700
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Wed Dec 06 02:34:46 2006 -0700
@@ -13,32 +13,15 @@ xc_ia64_copy_to_domain_pages(int xc_hand
                              unsigned long dst_pfn, int nr_pages)
 {
     // N.B. gva should be page aligned
-
-    xen_pfn_t *page_array = NULL;
     int i;
 
-    page_array = malloc(nr_pages * sizeof(xen_pfn_t));
-    if (page_array == NULL) {
-        PERROR("Could not allocate memory");
-        goto error_out;
-    }
-    if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
-                             dst_pfn, nr_pages) != nr_pages) {
-        PERROR("Could not get the page frame list");
-        goto error_out;
-    }
-
     for (i = 0; i < nr_pages; i++) {
-        if (xc_copy_to_domain_page(xc_handle, domid, page_array[i],
+        if (xc_copy_to_domain_page(xc_handle, domid, dst_pfn + i,
                                    src_page + (i << PAGE_SHIFT)))
-            goto error_out;
-    }
-    free(page_array);
-    return 0;
-
-error_out:
-    free(page_array);
-    return -1;
+            return -1;
+    }
+
+    return 0;
 }
 
 int 
@@ -657,7 +640,7 @@ setup_guest(int xc_handle, uint32_t dom,
     rc = xc_domain_memory_populate_physmap(xc_handle, dom, 3,
                                            0, 0, &pfn_list[nr_pages - 3]);
     if (rc != 0) {
-        PERROR("Could not allocate GFW memory for Vti guest.\n");
+        PERROR("Could not allocate IO page or store page or buffer io 
page.\n");
         goto error_out;
     }
 

_______________________________________________
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®.