# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1194456849 25200
# Node ID df5b49037c773420c3f6197aaa332db0624873f2
# Parent 91575bb23d073515a50e7cad04b5367316c08f73
[IA64] vti save-restore: ia64 hvm builder clean up with respect to hvm params.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
tools/libxc/ia64/xc_ia64_hvm_build.c | 59 ++++++++++++-------------------
tools/libxc/ia64/xc_ia64_linux_restore.c | 5 +-
tools/libxc/ia64/xc_ia64_linux_save.c | 3 +
3 files changed, 28 insertions(+), 39 deletions(-)
diff -r 91575bb23d07 -r df5b49037c77 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 07 10:31:09 2007 -0700
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 07 10:34:09 2007 -0700
@@ -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 91575bb23d07 -r df5b49037c77 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c Wed Nov 07 10:31:09 2007 -0700
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Wed Nov 07 10:34:09 2007 -0700
@@ -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 91575bb23d07 -r df5b49037c77 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c Wed Nov 07 10:31:09 2007 -0700
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c Wed Nov 07 10:34:09 2007 -0700
@@ -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 */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|