debuggers.hg
changeset 16393:df5b49037c77
[IA64] vti save-restore: ia64 hvm builder clean up with respect to hvm params.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Wed Nov 07 10:34:09 2007 -0700 (2007-11-07) |
parents | 91575bb23d07 |
children | 1d0a2cb9f383 |
files | tools/libxc/ia64/xc_ia64_hvm_build.c tools/libxc/ia64/xc_ia64_linux_restore.c tools/libxc/ia64/xc_ia64_linux_save.c |
line diff
1.1 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 07 10:31:09 2007 -0700 1.2 +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Nov 07 10:34:09 2007 -0700 1.3 @@ -893,9 +893,6 @@ setup_guest(int xc_handle, uint32_t dom, 1.4 char *image, unsigned long image_size) 1.5 { 1.6 xen_pfn_t *pfn_list; 1.7 - shared_iopage_t *sp; 1.8 - void *ioreq_buffer_page; 1.9 - void *pio_buffer_page; 1.10 unsigned long dom_memsize = memsize << 20; 1.11 unsigned long nr_pages = memsize << (20 - PAGE_SHIFT); 1.12 unsigned long vcpus; 1.13 @@ -905,6 +902,16 @@ setup_guest(int xc_handle, uint32_t dom, 1.14 unsigned long nvram_start = NVRAM_START, nvram_fd = 0; 1.15 int rc; 1.16 long i; 1.17 + const struct hvm_special_page { 1.18 + int param; 1.19 + xen_pfn_t pfn; 1.20 + } special_pages[] = { 1.21 + // pfn-sorted array 1.22 + { HVM_PARAM_IOREQ_PFN, IO_PAGE_START >> PAGE_SHIFT}, 1.23 + { HVM_PARAM_STORE_PFN, STORE_PAGE_START >> PAGE_SHIFT}, 1.24 + { HVM_PARAM_BUFIOREQ_PFN, BUFFER_IO_PAGE_START >> PAGE_SHIFT}, 1.25 + { HVM_PARAM_BUFPIOREQ_PFN, BUFFER_PIO_PAGE_START >> PAGE_SHIFT}, 1.26 + }; 1.27 DECLARE_DOMCTL; 1.28 1.29 1.30 @@ -957,18 +964,12 @@ setup_guest(int xc_handle, uint32_t dom, 1.31 goto error_out; 1.32 } 1.33 1.34 - nr_special_pages = 0; 1.35 - pfn_list[nr_special_pages] = IO_PAGE_START >> PAGE_SHIFT; 1.36 - nr_special_pages++; 1.37 - pfn_list[nr_special_pages] = STORE_PAGE_START >> PAGE_SHIFT; 1.38 - nr_special_pages++; 1.39 - pfn_list[nr_special_pages] = BUFFER_IO_PAGE_START >> PAGE_SHIFT; 1.40 - nr_special_pages++; 1.41 - pfn_list[nr_special_pages] = BUFFER_PIO_PAGE_START >> PAGE_SHIFT; 1.42 + for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) 1.43 + pfn_list[i] = special_pages[i].pfn; 1.44 1.45 - memmap_info_pfn = pfn_list[nr_special_pages] + 1; 1.46 + nr_special_pages = i; 1.47 + memmap_info_pfn = pfn_list[nr_special_pages - 1] + 1; 1.48 memmap_info_num_pages = 1; 1.49 - nr_special_pages++; 1.50 pfn_list[nr_special_pages] = memmap_info_pfn; 1.51 nr_special_pages++; 1.52 1.53 @@ -1033,28 +1034,14 @@ setup_guest(int xc_handle, uint32_t dom, 1.54 goto error_out; 1.55 } 1.56 1.57 - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, pfn_list[1]); 1.58 - 1.59 - // Retrieve special pages like io, xenstore, etc. 1.60 - sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 1.61 - PROT_READ | PROT_WRITE, 1.62 - pfn_list[0]); 1.63 - if (sp == 0) 1.64 - goto error_out; 1.65 + // zero clear all special pages 1.66 + for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { 1.67 + xc_set_hvm_param(xc_handle, dom, 1.68 + special_pages[i].param, special_pages[i].pfn); 1.69 + if (xc_clear_domain_page(xc_handle, dom, special_pages[i].pfn)) 1.70 + goto error_out; 1.71 + } 1.72 1.73 - memset(sp, 0, PAGE_SIZE); 1.74 - munmap(sp, PAGE_SIZE); 1.75 - ioreq_buffer_page = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 1.76 - PROT_READ | PROT_WRITE, 1.77 - pfn_list[2]); 1.78 - memset(ioreq_buffer_page,0,PAGE_SIZE); 1.79 - munmap(ioreq_buffer_page, PAGE_SIZE); 1.80 - 1.81 - pio_buffer_page = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, 1.82 - PROT_READ | PROT_WRITE, 1.83 - pfn_list[3]); 1.84 - memset(pio_buffer_page,0,PAGE_SIZE); 1.85 - munmap(pio_buffer_page, PAGE_SIZE); 1.86 free(pfn_list); 1.87 return 0; 1.88
2.1 --- a/tools/libxc/ia64/xc_ia64_linux_restore.c Wed Nov 07 10:31:09 2007 -0700 2.2 +++ b/tools/libxc/ia64/xc_ia64_linux_restore.c Wed Nov 07 10:34:09 2007 -0700 2.3 @@ -285,9 +285,10 @@ xc_ia64_hvm_recv_context(int xc_handle, 2.4 2.5 /* HVM: magic frames for ioreqs and xenstore comms */ 2.6 const int hvm_params[] = { 2.7 + HVM_PARAM_STORE_PFN, 2.8 HVM_PARAM_IOREQ_PFN, 2.9 HVM_PARAM_BUFIOREQ_PFN, 2.10 - HVM_PARAM_STORE_PFN, 2.11 + HVM_PARAM_BUFPIOREQ_PFN, 2.12 }; 2.13 const int NR_PARAMS = sizeof(hvm_params) / sizeof(hvm_params[0]); 2.14 /* ioreq_pfn, bufioreq_pfn, store_pfn */ 2.15 @@ -368,7 +369,7 @@ xc_ia64_hvm_recv_context(int xc_handle, 2.16 ERROR("error setting HVM params: %i", rc); 2.17 goto out; 2.18 } 2.19 - *store_mfn = magic_pfns[2]; 2.20 + *store_mfn = magic_pfns[0]; 2.21 2.22 /* Read HVM context */ 2.23 if (!read_exact(io_fd, &rec_size, sizeof(rec_size))) {
3.1 --- a/tools/libxc/ia64/xc_ia64_linux_save.c Wed Nov 07 10:31:09 2007 -0700 3.2 +++ b/tools/libxc/ia64/xc_ia64_linux_save.c Wed Nov 07 10:34:09 2007 -0700 3.3 @@ -285,9 +285,10 @@ xc_ia64_hvm_send_context(int xc_handle, 3.4 3.5 /* HVM: magic frames for ioreqs and xenstore comms */ 3.6 const int hvm_params[] = { 3.7 + HVM_PARAM_STORE_PFN, 3.8 HVM_PARAM_IOREQ_PFN, 3.9 HVM_PARAM_BUFIOREQ_PFN, 3.10 - HVM_PARAM_STORE_PFN, 3.11 + HVM_PARAM_BUFPIOREQ_PFN, 3.12 }; 3.13 const int NR_PARAMS = sizeof(hvm_params) / sizeof(hvm_params[0]); 3.14 /* ioreq_pfn, bufioreq_pfn, store_pfn */