ia64/xen-unstable

changeset 14651:121a97005d11

[HVM] Save/restore: don't get guest size from "memory_static_min"
since it doesn't mean that any more. This is a sticking-plaster
to get HVM S/R working until the proper memory-map handling patch
is ready.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Mar 29 15:27:18 2007 +0000 (2007-03-29)
parents a9dc65d34b14
children 19f33f5ba96b
files tools/libxc/xc_hvm_restore.c tools/python/xen/xend/XendCheckpoint.py tools/xcutils/xc_restore.c
line diff
     1.1 --- a/tools/libxc/xc_hvm_restore.c	Thu Mar 29 16:18:39 2007 +0100
     1.2 +++ b/tools/libxc/xc_hvm_restore.c	Thu Mar 29 15:27:18 2007 +0000
     1.3 @@ -81,7 +81,7 @@ int xc_hvm_restore(int xc_handle, int io
     1.4      unsigned int rc = 1, n, i;
     1.5      uint32_t rec_len, nr_vcpus;
     1.6      uint8_t *hvm_buf = NULL;
     1.7 -    unsigned long long v_end, memsize;
     1.8 +    unsigned long long v_end;
     1.9      unsigned long shared_page_nr;
    1.10  
    1.11      unsigned long pfn;
    1.12 @@ -91,16 +91,19 @@ int xc_hvm_restore(int xc_handle, int io
    1.13      /* Types of the pfns in the current region */
    1.14      unsigned long region_pfn_type[MAX_BATCH_SIZE];
    1.15  
    1.16 -    /* Number of pages of memory the guest has.  *Not* the same as max_pfn. */
    1.17 -    unsigned long nr_pages;
    1.18 -
    1.19      /* The size of an array big enough to contain all guest pfns */
    1.20      unsigned long pfn_array_size = max_pfn + 1;
    1.21  
    1.22 -    /* hvm guest mem size (Mb) */
    1.23 -    memsize = (unsigned long long)*store_mfn;
    1.24 -    v_end = memsize << 20;
    1.25 -    nr_pages = (unsigned long) memsize << (20 - PAGE_SHIFT);
    1.26 +    /* Number of pages of memory the guest has.  *Not* the same as max_pfn. */
    1.27 +    unsigned long nr_pages = max_pfn + 1;
    1.28 +    /* MMIO hole doesn't contain RAM */
    1.29 +    if ( nr_pages >= HVM_BELOW_4G_MMIO_START >> PAGE_SHIFT ) 
    1.30 +        nr_pages -= HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; 
    1.31 +    /* VGA hole doesn't contain RAM */
    1.32 +    nr_pages -= 0x20;
    1.33 +
    1.34 +    /* XXX: Unlikely to be true, but matches previous behaviour. :( */
    1.35 +    v_end = (nr_pages + 0x20) << PAGE_SHIFT;
    1.36  
    1.37      DPRINTF("xc_hvm_restore:dom=%d, nr_pages=0x%lx, store_evtchn=%d, "
    1.38              "*store_mfn=%ld, pae=%u, apic=%u.\n", 
    1.39 @@ -146,7 +149,7 @@ int xc_hvm_restore(int xc_handle, int io
    1.40          0, 0, &pfns[0x00]);
    1.41      if ( (rc == 0) && (nr_pages > 0xc0) )
    1.42          rc = xc_domain_memory_populate_physmap(
    1.43 -            xc_handle, dom, nr_pages - 0xc0, 0, 0, &pfns[0xc0]);
    1.44 +            xc_handle, dom, nr_pages - 0xa0, 0, 0, &pfns[0xc0]);
    1.45      if ( rc != 0 )
    1.46      {
    1.47          PERROR("Could not allocate memory for HVM guest.\n");
    1.48 @@ -276,14 +279,6 @@ int xc_hvm_restore(int xc_handle, int io
    1.49      else
    1.50          shared_page_nr = (v_end >> PAGE_SHIFT) - 1;
    1.51  
    1.52 -    /* Paranoia: clean pages. */
    1.53 -    if ( xc_clear_domain_page(xc_handle, dom, shared_page_nr) ||
    1.54 -         xc_clear_domain_page(xc_handle, dom, shared_page_nr-1) ||
    1.55 -         xc_clear_domain_page(xc_handle, dom, shared_page_nr-2) ) {
    1.56 -        ERROR("error clearing comms frames!\n");
    1.57 -        goto out;
    1.58 -    }
    1.59 -
    1.60      xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, shared_page_nr-1);
    1.61      xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2);
    1.62      xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr);
     2.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Thu Mar 29 16:18:39 2007 +0100
     2.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Thu Mar 29 15:27:18 2007 +0000
     2.3 @@ -192,13 +192,11 @@ def restore(xd, fd, dominfo = None, paus
     2.4      image_cfg = dominfo.info.get('image', {})
     2.5      is_hvm = dominfo.info.is_hvm()
     2.6      if is_hvm:
     2.7 -        hvm  = dominfo.info['memory_static_min']
     2.8          apic = int(dominfo.info['platform'].get('apic', 0))
     2.9          pae  = int(dominfo.info['platform'].get('pae',  0))
    2.10 -        log.info("restore hvm domain %d, mem=%d, apic=%d, pae=%d",
    2.11 -                 dominfo.domid, hvm, apic, pae)
    2.12 +        log.info("restore hvm domain %d, apic=%d, pae=%d",
    2.13 +                 dominfo.domid, apic, pae)
    2.14      else:
    2.15 -        hvm  = 0
    2.16          apic = 0
    2.17          pae  = 0
    2.18  
    2.19 @@ -224,7 +222,7 @@ def restore(xd, fd, dominfo = None, paus
    2.20  
    2.21          cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
    2.22                          fd, dominfo.getDomid(), max_pfn,
    2.23 -                        store_port, console_port, hvm, pae, apic])
    2.24 +                        store_port, console_port, int(is_hvm), pae, apic])
    2.25          log.debug("[xc_restore]: %s", string.join(cmd))
    2.26  
    2.27          handler = RestoreInputHandler()
     3.1 --- a/tools/xcutils/xc_restore.c	Thu Mar 29 16:18:39 2007 +0100
     3.2 +++ b/tools/xcutils/xc_restore.c	Thu Mar 29 15:27:18 2007 +0000
     3.3 @@ -42,8 +42,6 @@ main(int argc, char **argv)
     3.4      apic = atoi(argv[8]);
     3.5  
     3.6      if (hvm) {
     3.7 -         /* pass the memsize to xc_hvm_restore to find the store_mfn */
     3.8 -        store_mfn = hvm;
     3.9          ret = xc_hvm_restore(xc_fd, io_fd, domid, max_pfn, store_evtchn,
    3.10                  &store_mfn, pae, apic);
    3.11      } else