direct-io.hg

changeset 10936:a0b3cf802d99

[qemu] Fix qemu memory access beyond 3G @VTi side.

Signed-off-by: Zhang xiantao <xiantao.zhang@intel.com>
author chris@kneesaa.uk.xensource.com
date Fri Aug 04 10:52:25 2006 +0100 (2006-08-04)
parents 7e914d9cd7e6
children 87346792fe90
files tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Fri Aug 04 10:43:02 2006 +0100
     1.2 +++ b/tools/ioemu/vl.c	Fri Aug 04 10:52:25 2006 +0100
     1.3 @@ -5783,6 +5783,11 @@ int main(int argc, char **argv)
     1.4      /* init the memory */
     1.5      phys_ram_size = ram_size + vga_ram_size + bios_size;
     1.6  
     1.7 +#if defined (__ia64__)
     1.8 +    if (ram_size > MMIO_START)
     1.9 +	ram_size += 1 * MEM_G; /* skip 3G-4G MMIO, LEGACY_IO_SPACE etc. */
    1.10 +#endif
    1.11 +
    1.12  #ifdef CONFIG_DM
    1.13  
    1.14      nr_pages = ram_size/PAGE_SIZE;
    1.15 @@ -5816,22 +5821,9 @@ int main(int argc, char **argv)
    1.16              (uint64_t)(page_array[nr_pages - 1]));
    1.17  
    1.18  #elif defined(__ia64__)
    1.19 -    if (xc_ia64_get_pfn_list(xc_handle, domid,
    1.20 -                             page_array, 0, nr_pages) != nr_pages) {
    1.21 -        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
    1.22 -        exit(-1);
    1.23 -    }
    1.24 -
    1.25 -    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
    1.26 -                                         PROT_READ|PROT_WRITE,
    1.27 -                                         page_array, nr_pages);
    1.28 -    if (phys_ram_base == 0) {
    1.29 -        fprintf(logfile, "xc_map_foreign_batch returned error %d\n", errno);
    1.30 -        exit(-1);
    1.31 -    }
    1.32 -
    1.33 +  
    1.34      if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
    1.35 -                             IO_PAGE_START >> PAGE_SHIFT, 1) != 1){
    1.36 +                             IO_PAGE_START >> PAGE_SHIFT, 1) != 1) {
    1.37          fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
    1.38          exit(-1);
    1.39      }
    1.40 @@ -5842,6 +5834,26 @@ int main(int argc, char **argv)
    1.41  
    1.42      fprintf(logfile, "shared page at pfn:%lx, mfn: %016lx\n",
    1.43              IO_PAGE_START >> PAGE_SHIFT, page_array[0]);
    1.44 +
    1.45 +    if (xc_ia64_get_pfn_list(xc_handle, domid,
    1.46 +                             page_array, 0, nr_pages) != nr_pages) {
    1.47 +        fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
    1.48 +        exit(-1);
    1.49 +    }
    1.50 +
    1.51 +    if (ram_size > MMIO_START) {	
    1.52 +	for (i = 0 ; i < MEM_G >> PAGE_SHIFT; i++)
    1.53 +	    page_array[MMIO_START >> PAGE_SHIFT + i] =
    1.54 +		page_array[IO_PAGE_START >> PAGE_SHIFT + 1];
    1.55 +    }
    1.56 +
    1.57 +    phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
    1.58 +                                         PROT_READ|PROT_WRITE,
    1.59 +                                         page_array, nr_pages);
    1.60 +    if (phys_ram_base == 0) {
    1.61 +        fprintf(logfile, "xc_map_foreign_batch returned error %d\n", errno);
    1.62 +        exit(-1);
    1.63 +    }
    1.64  #endif
    1.65  #else  /* !CONFIG_DM */
    1.66