ia64/xen-unstable

changeset 16337:1d0a2cb9f383

[IA64] vti save-restore: ia64 qemu-dm boot clean up.

Use xc_get_hvm_param()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Wed Nov 07 10:41:43 2007 -0700 (2007-11-07)
parents df5b49037c77
children 303ac8ec2359
files tools/ioemu/hw/xen_machine_fv.c
line diff
     1.1 --- a/tools/ioemu/hw/xen_machine_fv.c	Wed Nov 07 10:34:09 2007 -0700
     1.2 +++ b/tools/ioemu/hw/xen_machine_fv.c	Wed Nov 07 10:41:43 2007 -0700
     1.3 @@ -194,9 +194,7 @@ static void xen_init_fv(uint64_t ram_siz
     1.4                          const char *initrd_filename,
     1.5                          const char *direct_pci)
     1.6  {
     1.7 -#if defined(__i386__) || defined(__x86_64__)
     1.8      unsigned long ioreq_pfn;
     1.9 -#endif
    1.10      extern void *shared_page;
    1.11      extern void *buffered_io_page;
    1.12  #ifdef __ia64__
    1.13 @@ -233,7 +231,34 @@ static void xen_init_fv(uint64_t ram_siz
    1.14  
    1.15  #elif defined(__ia64__)
    1.16  
    1.17 -    nr_pages = ram_size/PAGE_SIZE;
    1.18 +    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
    1.19 +    fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn);
    1.20 +    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.21 +                                       PROT_READ|PROT_WRITE, ioreq_pfn);
    1.22 +    if (shared_page == NULL) {
    1.23 +        fprintf(logfile, "map shared IO page returned error %d\n", errno);
    1.24 +        exit(-1);
    1.25 +    }
    1.26 +    
    1.27 +    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &ioreq_pfn);
    1.28 +    fprintf(logfile, "buffered io page at pfn %lx\n", ioreq_pfn);
    1.29 +    buffered_io_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.30 +                                            PROT_READ|PROT_WRITE, ioreq_pfn);
    1.31 +    if (buffered_io_page == NULL) {
    1.32 +        fprintf(logfile, "map buffered IO page returned error %d\n", errno);
    1.33 +        exit(-1);
    1.34 +    }
    1.35 +
    1.36 +    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFPIOREQ_PFN, &ioreq_pfn);
    1.37 +    fprintf(logfile, "buffered pio page at pfn %lx\n", ioreq_pfn);
    1.38 +    buffered_pio_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.39 +					     PROT_READ|PROT_WRITE, ioreq_pfn);
    1.40 +    if (buffered_pio_page == NULL) {
    1.41 +        fprintf(logfile, "map buffered PIO page returned error %d\n", errno);
    1.42 +        exit(-1);
    1.43 +    }
    1.44 +
    1.45 +    nr_pages = ram_size / PAGE_SIZE;
    1.46  
    1.47      page_array = (xen_pfn_t *)malloc(nr_pages * sizeof(xen_pfn_t));
    1.48      if (page_array == NULL) {
    1.49 @@ -241,18 +266,6 @@ static void xen_init_fv(uint64_t ram_siz
    1.50          exit(-1);
    1.51      }
    1.52  
    1.53 -    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.54 -                                       PROT_READ|PROT_WRITE,
    1.55 -                                       IO_PAGE_START >> PAGE_SHIFT);
    1.56 -
    1.57 -    buffered_io_page =xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.58 -                                       PROT_READ|PROT_WRITE,
    1.59 -                                       BUFFER_IO_PAGE_START >> PAGE_SHIFT);
    1.60 -
    1.61 -    buffered_pio_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.62 -                                       PROT_READ|PROT_WRITE,
    1.63 -                                       BUFFER_PIO_PAGE_START >> PAGE_SHIFT);
    1.64 -
    1.65      for (i = 0; i < nr_pages; i++)
    1.66          page_array[i] = i;
    1.67