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-ia64-devel

[Xen-ia64-devel] [PATCH 6/7] vti save-restore: ia64 hvm builder/save/res

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 6/7] vti save-restore: ia64 hvm builder/save/restore clean up
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Mon, 22 Oct 2007 16:29:50 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Mon, 22 Oct 2007 00:30:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1193021477 -32400
# Node ID 11666b14a1102ad8e8558cf79b4206c0a9a7682a
# Parent  e57d44a3fa2a53c34a6d282c50be2473d19363a2
ia64 hvm builder/save/restore clean up with respect to hvm params.
PATCHNAME: ia64_hvm_builder_clean_up

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r e57d44a3fa2a -r 11666b14a110 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c      Thu Oct 18 16:04:14 2007 +0900
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c      Mon Oct 22 11:51:17 2007 +0900
@@ -893,9 +893,6 @@ setup_guest(int xc_handle, uint32_t dom,
             char *image, unsigned long image_size)
 {
     xen_pfn_t *pfn_list;
-    shared_iopage_t *sp;
-    void *ioreq_buffer_page;
-    void *pio_buffer_page;
     unsigned long dom_memsize = memsize << 20;
     unsigned long nr_pages = memsize << (20 - PAGE_SHIFT);
     unsigned long vcpus;
@@ -905,6 +902,16 @@ setup_guest(int xc_handle, uint32_t dom,
     unsigned long nvram_start = NVRAM_START, nvram_fd = 0; 
     int rc;
     long i;
+    const struct hvm_special_page {
+        int             param;
+        xen_pfn_t       pfn;
+    } special_pages[] = {
+        // pfn-sorted array
+        { HVM_PARAM_IOREQ_PFN,          IO_PAGE_START         >> PAGE_SHIFT},
+        { HVM_PARAM_STORE_PFN,          STORE_PAGE_START      >> PAGE_SHIFT},
+        { HVM_PARAM_BUFIOREQ_PFN,       BUFFER_IO_PAGE_START  >> PAGE_SHIFT}, 
+        { HVM_PARAM_BUFPIOREQ_PFN,      BUFFER_PIO_PAGE_START >> PAGE_SHIFT},
+    };
     DECLARE_DOMCTL;
 
 
@@ -957,18 +964,12 @@ setup_guest(int xc_handle, uint32_t dom,
         goto error_out;
     }
 
-    nr_special_pages = 0;
-    pfn_list[nr_special_pages] = IO_PAGE_START >> PAGE_SHIFT;
-    nr_special_pages++;
-    pfn_list[nr_special_pages] = STORE_PAGE_START >> PAGE_SHIFT;
-    nr_special_pages++;
-    pfn_list[nr_special_pages] = BUFFER_IO_PAGE_START >> PAGE_SHIFT;
-    nr_special_pages++;
-    pfn_list[nr_special_pages] = BUFFER_PIO_PAGE_START >> PAGE_SHIFT;
-
-    memmap_info_pfn = pfn_list[nr_special_pages] + 1;
+    for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++)
+        pfn_list[i] = special_pages[i].pfn;
+
+    nr_special_pages = i;
+    memmap_info_pfn = pfn_list[nr_special_pages - 1] + 1;
     memmap_info_num_pages = 1;
-    nr_special_pages++;
     pfn_list[nr_special_pages] = memmap_info_pfn;
     nr_special_pages++;
 
@@ -1033,28 +1034,14 @@ setup_guest(int xc_handle, uint32_t dom,
         goto error_out;
     }
 
-    xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, pfn_list[1]);
-
-    // Retrieve special pages like io, xenstore, etc. 
-    sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-                                                 PROT_READ | PROT_WRITE,
-                                                 pfn_list[0]);
-    if (sp == 0)
-        goto error_out;
-
-    memset(sp, 0, PAGE_SIZE);
-    munmap(sp, PAGE_SIZE);
-    ioreq_buffer_page = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-                                             PROT_READ | PROT_WRITE,
-                                             pfn_list[2]); 
-    memset(ioreq_buffer_page,0,PAGE_SIZE);
-    munmap(ioreq_buffer_page, PAGE_SIZE);
-
-    pio_buffer_page = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-                                           PROT_READ | PROT_WRITE,
-                                           pfn_list[3]);
-    memset(pio_buffer_page,0,PAGE_SIZE);
-    munmap(pio_buffer_page, PAGE_SIZE);
+    // zero clear all special pages
+    for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) {
+        xc_set_hvm_param(xc_handle, dom,
+                         special_pages[i].param, special_pages[i].pfn);
+        if (xc_clear_domain_page(xc_handle, dom, special_pages[i].pfn))
+            goto error_out;
+    }
+
     free(pfn_list);
     return 0;
 
diff -r e57d44a3fa2a -r 11666b14a110 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c  Thu Oct 18 16:04:14 2007 +0900
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c  Mon Oct 22 11:51:17 2007 +0900
@@ -285,9 +285,10 @@ xc_ia64_hvm_recv_context(int xc_handle, 
 
     /* HVM: magic frames for ioreqs and xenstore comms */
     const int hvm_params[] = {
+        HVM_PARAM_STORE_PFN,
         HVM_PARAM_IOREQ_PFN,
         HVM_PARAM_BUFIOREQ_PFN,
-        HVM_PARAM_STORE_PFN,
+        HVM_PARAM_BUFPIOREQ_PFN,
     };
     const int NR_PARAMS = sizeof(hvm_params) / sizeof(hvm_params[0]);
     /* ioreq_pfn, bufioreq_pfn, store_pfn */
@@ -368,7 +369,7 @@ xc_ia64_hvm_recv_context(int xc_handle, 
         ERROR("error setting HVM params: %i", rc);
         goto out;
     }
-    *store_mfn = magic_pfns[2];
+    *store_mfn = magic_pfns[0];
 
     /* Read HVM context */
     if (!read_exact(io_fd, &rec_size, sizeof(rec_size))) {
diff -r e57d44a3fa2a -r 11666b14a110 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Thu Oct 18 16:04:14 2007 +0900
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Mon Oct 22 11:51:17 2007 +0900
@@ -285,9 +285,10 @@ xc_ia64_hvm_send_context(int xc_handle, 
 
     /* HVM: magic frames for ioreqs and xenstore comms */
     const int hvm_params[] = {
+        HVM_PARAM_STORE_PFN,
         HVM_PARAM_IOREQ_PFN,
         HVM_PARAM_BUFIOREQ_PFN,
-        HVM_PARAM_STORE_PFN,
+        HVM_PARAM_BUFPIOREQ_PFN,
     };
     const int NR_PARAMS = sizeof(hvm_params) / sizeof(hvm_params[0]);
     /* ioreq_pfn, bufioreq_pfn, store_pfn */

Attachment: 16184_11666b14a110_ia64_hvm_builder_clean_up.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 6/7] vti save-restore: ia64 hvm builder/save/restore clean up, Isaku Yamahata <=