ia64/xen-unstable

changeset 6639:89e8a2144c1d

Get rid of suspend record, start info holds all the info now.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Sep 05 14:53:39 2005 +0000 (2005-09-05)
parents 5d8b2c258b26
children 1f460d0fd6c6
files linux-2.6-xen-sparse/arch/xen/kernel/reboot.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Mon Sep 05 14:48:44 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Mon Sep 05 14:53:39 2005 +0000
     1.3 @@ -12,7 +12,6 @@
     1.4  #include <asm-xen/evtchn.h>
     1.5  #include <asm-xen/hypervisor.h>
     1.6  #include <asm-xen/xen-public/dom0_ops.h>
     1.7 -#include <asm-xen/linux-public/suspend.h>
     1.8  #include <asm-xen/queues.h>
     1.9  #include <asm-xen/xenbus.h>
    1.10  #include <asm-xen/ctrl_if.h>
    1.11 @@ -69,7 +68,6 @@ static int shutting_down = SHUTDOWN_INVA
    1.12  static int __do_suspend(void *ignore)
    1.13  {
    1.14      int i, j;
    1.15 -    suspend_record_t *suspend_record;
    1.16  
    1.17  #ifdef CONFIG_XEN_USB_FRONTEND
    1.18      extern void usbif_resume();
    1.19 @@ -112,10 +110,6 @@ static int __do_suspend(void *ignore)
    1.20      }
    1.21  #endif
    1.22  
    1.23 -    suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL);
    1.24 -    if ( suspend_record == NULL )
    1.25 -        goto out;
    1.26 -
    1.27      preempt_disable();
    1.28  #ifdef CONFIG_SMP
    1.29      /* Take all of the other cpus offline.  We need to be careful not
    1.30 @@ -145,8 +139,6 @@ static int __do_suspend(void *ignore)
    1.31      }
    1.32  #endif
    1.33  
    1.34 -    suspend_record->nr_pfns = max_pfn; /* final number of pfns */
    1.35 -
    1.36      __cli();
    1.37  
    1.38      preempt_enable();
    1.39 @@ -185,18 +177,12 @@ static int __do_suspend(void *ignore)
    1.40      HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
    1.41      clear_fixmap(FIX_SHARED_INFO);
    1.42  
    1.43 -    memcpy(&suspend_record->resume_info, xen_start_info,
    1.44 -           sizeof(*xen_start_info));
    1.45 -
    1.46      /* We'll stop somewhere inside this hypercall.  When it returns,
    1.47         we'll start resuming after the restore. */
    1.48 -    HYPERVISOR_suspend(virt_to_mfn(suspend_record));
    1.49 +    HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
    1.50  
    1.51      shutting_down = SHUTDOWN_INVALID; 
    1.52  
    1.53 -    memcpy(xen_start_info, &suspend_record->resume_info,
    1.54 -           sizeof(*xen_start_info));
    1.55 -
    1.56      set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
    1.57  
    1.58      HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
    1.59 @@ -248,9 +234,6 @@ static int __do_suspend(void *ignore)
    1.60      }
    1.61  #endif
    1.62  
    1.63 - out:
    1.64 -    if ( suspend_record != NULL )
    1.65 -        free_page((unsigned long)suspend_record);
    1.66      return err;
    1.67  }
    1.68  
     2.1 --- a/linux-2.6-xen-sparse/include/asm-xen/linux-public/suspend.h	Mon Sep 05 14:48:44 2005 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,43 +0,0 @@
     2.4 -/******************************************************************************
     2.5 - * suspend.h
     2.6 - * 
     2.7 - * Copyright (c) 2003-2004, K A Fraser
     2.8 - * 
     2.9 - * This file may be distributed separately from the Linux kernel, or
    2.10 - * incorporated into other software packages, subject to the following license:
    2.11 - * 
    2.12 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.13 - * of this source file (the "Software"), to deal in the Software without
    2.14 - * restriction, including without limitation the rights to use, copy, modify,
    2.15 - * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    2.16 - * and to permit persons to whom the Software is furnished to do so, subject to
    2.17 - * the following conditions:
    2.18 - * 
    2.19 - * The above copyright notice and this permission notice shall be included in
    2.20 - * all copies or substantial portions of the Software.
    2.21 - * 
    2.22 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.23 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.24 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.25 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.26 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.27 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    2.28 - * IN THE SOFTWARE.
    2.29 - */
    2.30 -
    2.31 -#ifndef __ASM_XEN_SUSPEND_H__
    2.32 -#define __ASM_XEN_SUSPEND_H__
    2.33 -
    2.34 -typedef struct suspend_record_st {
    2.35 -    /* To be filled in before resume. */
    2.36 -    start_info_t resume_info;
    2.37 -    /*
    2.38 -     * The number of a machine frame containing, in sequence, the number of
    2.39 -     * each machine frame that contains PFN -> MFN translation table data.
    2.40 -     */
    2.41 -    unsigned long pfn_to_mfn_frame_list;
    2.42 -    /* Number of entries in the PFN -> MFN translation table. */
    2.43 -    unsigned long nr_pfns;
    2.44 -} suspend_record_t;
    2.45 -
    2.46 -#endif /* __ASM_XEN_SUSPEND_H__ */
     3.1 --- a/tools/libxc/xc_linux_restore.c	Mon Sep 05 14:48:44 2005 +0000
     3.2 +++ b/tools/libxc/xc_linux_restore.c	Mon Sep 05 14:53:39 2005 +0000
     3.3 @@ -10,7 +10,6 @@
     3.4  #include <unistd.h>
     3.5  #include "xg_private.h"
     3.6  #include <xenctrl.h>
     3.7 -#include <xen/linux/suspend.h>
     3.8  #include <xen/memory.h>
     3.9  
    3.10  #define MAX_BATCH_SIZE 1024
    3.11 @@ -89,8 +88,8 @@ int xc_linux_restore(int xc_handle, int 
    3.12      /* used by mapper for updating the domain's copy of the table */
    3.13      unsigned long *live_pfn_to_mfn_table = NULL;
    3.14  
    3.15 -    /* A temporary mapping of the guest's suspend record. */
    3.16 -    suspend_record_t *p_srec;
    3.17 +    /* A temporary mapping of the guest's start_info page. */
    3.18 +    start_info_t *start_info;
    3.19  
    3.20      char *region_base;
    3.21  
    3.22 @@ -479,18 +478,18 @@ int xc_linux_restore(int xc_handle, int 
    3.23          goto out;
    3.24      }
    3.25      ctxt.user_regs.esi = mfn = pfn_to_mfn_table[pfn];
    3.26 -    p_srec = xc_map_foreign_range(
    3.27 +    start_info = xc_map_foreign_range(
    3.28          xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, mfn);
    3.29 -    p_srec->resume_info.nr_pages    = nr_pfns;
    3.30 -    p_srec->resume_info.shared_info = shared_info_frame << PAGE_SHIFT;
    3.31 -    p_srec->resume_info.flags       = 0;
    3.32 -    *store_mfn = p_srec->resume_info.store_mfn   =
    3.33 -	pfn_to_mfn_table[p_srec->resume_info.store_mfn];
    3.34 -    p_srec->resume_info.store_evtchn = store_evtchn;
    3.35 -    *console_mfn = p_srec->resume_info.console_mfn   =
    3.36 -	pfn_to_mfn_table[p_srec->resume_info.console_mfn];
    3.37 -    p_srec->resume_info.console_evtchn = console_evtchn;
    3.38 -    munmap(p_srec, PAGE_SIZE);
    3.39 +    start_info->nr_pages    = nr_pfns;
    3.40 +    start_info->shared_info = shared_info_frame << PAGE_SHIFT;
    3.41 +    start_info->flags       = 0;
    3.42 +    *store_mfn = start_info->store_mfn   =
    3.43 +	pfn_to_mfn_table[start_info->store_mfn];
    3.44 +    start_info->store_evtchn = store_evtchn;
    3.45 +    *console_mfn = start_info->console_mfn   =
    3.46 +	pfn_to_mfn_table[start_info->console_mfn];
    3.47 +    start_info->console_evtchn = console_evtchn;
    3.48 +    munmap(start_info, PAGE_SIZE);
    3.49  
    3.50      /* Uncanonicalise each GDT frame number. */
    3.51      if ( ctxt.gdt_ents > 8192 )
     4.1 --- a/tools/libxc/xc_linux_save.c	Mon Sep 05 14:48:44 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_save.c	Mon Sep 05 14:53:39 2005 +0000
     4.3 @@ -14,7 +14,6 @@
     4.4  
     4.5  #include "xg_private.h"
     4.6  
     4.7 -#include <xen/linux/suspend.h>
     4.8  #include <xen/io/domain_controller.h>
     4.9  
    4.10  #define BATCH_SIZE 1024   /* 1024 pages (4MB) at a time */
    4.11 @@ -435,8 +434,8 @@ int xc_linux_save(int xc_handle, int io_
    4.12      /* base of the region in which domain memory is mapped */
    4.13      unsigned char *region_base = NULL;
    4.14  
    4.15 -    /* A temporary mapping, and a copy, of the guest's suspend record. */
    4.16 -    suspend_record_t *p_srec = NULL;
    4.17 +    /* A temporary mapping of the guest's start_info page. */
    4.18 +    start_info_t *start_info = NULL;
    4.19  
    4.20      /* number of pages we're dealing with */
    4.21      unsigned long nr_pfns;
    4.22 @@ -672,22 +671,22 @@ int xc_linux_save(int xc_handle, int io_
    4.23  
    4.24      /* Map the suspend-record MFN to pin it. The page must be owned by 
    4.25         dom for this to succeed. */
    4.26 -    p_srec = xc_map_foreign_range(xc_handle, dom,
    4.27 -                                   sizeof(*p_srec), PROT_READ | PROT_WRITE, 
    4.28 -                                   ctxt.user_regs.esi);
    4.29 -    if (!p_srec){
    4.30 -        ERR("Couldn't map suspend record");
    4.31 +    start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    4.32 +				      PROT_READ | PROT_WRITE, 
    4.33 +				      ctxt.user_regs.esi);
    4.34 +    if (!start_info){
    4.35 +        ERR("Couldn't map start_info page");
    4.36          goto out;
    4.37      }
    4.38  
    4.39      /* Canonicalize store mfn. */
    4.40 -    if ( !translate_mfn_to_pfn(&p_srec->resume_info.store_mfn) ) {
    4.41 +    if ( !translate_mfn_to_pfn(&start_info->store_mfn) ) {
    4.42  	ERR("Store frame is not in range of pseudophys map");
    4.43  	goto out;
    4.44      }
    4.45  
    4.46      /* Canonicalize console mfn. */
    4.47 -    if ( !translate_mfn_to_pfn(&p_srec->resume_info.console_mfn) ) {
    4.48 +    if ( !translate_mfn_to_pfn(&start_info->console_mfn) ) {
    4.49  	ERR("Console frame is not in range of pseudophys map");
    4.50  	goto out;
    4.51      }
    4.52 @@ -1030,13 +1029,6 @@ int xc_linux_save(int xc_handle, int io_
    4.53  	}
    4.54      }
    4.55  
    4.56 -    if (nr_pfns != p_srec->nr_pfns )
    4.57 -    {
    4.58 -	ERR("Suspend record nr_pfns unexpected (%ld != %ld)",
    4.59 -		   p_srec->nr_pfns, nr_pfns);
    4.60 -        goto out;
    4.61 -    }
    4.62 -
    4.63      /* Canonicalise the suspend-record frame number. */
    4.64      if ( !translate_mfn_to_pfn(&ctxt.user_regs.esi) ){
    4.65          ERR("Suspend record is not in range of pseudophys map");
    4.66 @@ -1070,8 +1062,8 @@ int xc_linux_save(int xc_handle, int io_
    4.67      if(live_shinfo)
    4.68          munmap(live_shinfo, PAGE_SIZE);
    4.69  
    4.70 -    if(p_srec) 
    4.71 -        munmap(p_srec, sizeof(*p_srec));
    4.72 +    if(start_info) 
    4.73 +        munmap(start_info, PAGE_SIZE);
    4.74  
    4.75      if(live_pfn_to_mfn_frame_list) 
    4.76          munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);