ia64/xen-unstable

changeset 6674:a75b08af8d19

merge?
author cl349@firebug.cl.cam.ac.uk
date Wed Sep 07 12:48:11 2005 +0000 (2005-09-07)
parents 63e226a5e272 c9fd91d7540d
children e991ec23c318
files linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c tools/libxc/Makefile tools/libxc/xc_linux_save.c tools/libxc/xc_load_aout9.c tools/python/xen/lowlevel/xs/xs.c xen/arch/x86/time.c xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Wed Sep 07 12:47:45 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Wed Sep 07 12:48:11 2005 +0000
     1.3 @@ -359,7 +359,8 @@ static void __init probe_roms(void)
     1.4  shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
     1.5  EXPORT_SYMBOL(HYPERVISOR_shared_info);
     1.6  
     1.7 -unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
     1.8 +unsigned long *phys_to_machine_mapping;
     1.9 +unsigned long *pfn_to_mfn_frame_list_list, *pfn_to_mfn_frame_list[16];
    1.10  EXPORT_SYMBOL(phys_to_machine_mapping);
    1.11  
    1.12  /* Raw start-of-day parameters from the hypervisor. */
    1.13 @@ -1519,7 +1520,7 @@ static void set_mca_bus(int x) { }
    1.14   */
    1.15  void __init setup_arch(char **cmdline_p)
    1.16  {
    1.17 -	int i, j;
    1.18 +	int i, j, k, fpp;
    1.19  	physdev_op_t op;
    1.20  	unsigned long max_low_pfn;
    1.21  
    1.22 @@ -1669,14 +1670,31 @@ void __init setup_arch(char **cmdline_p)
    1.23  			sizeof(unsigned long))));
    1.24  	}
    1.25  
    1.26 -	pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
    1.27 -	for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
    1.28 -	{	
    1.29 -	     pfn_to_mfn_frame_list[j] = 
    1.30 -		  virt_to_mfn(&phys_to_machine_mapping[i]);
    1.31 +
    1.32 +	/* 
    1.33 +	 * Initialise the list of the frames that specify the list of 
    1.34 +	 * frames that make up the p2m table. Used by save/restore
    1.35 +	 */
    1.36 +	pfn_to_mfn_frame_list_list = alloc_bootmem_low_pages(PAGE_SIZE);
    1.37 +	HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
    1.38 +	  virt_to_mfn(pfn_to_mfn_frame_list_list);
    1.39 +	       
    1.40 +	fpp = PAGE_SIZE/sizeof(unsigned long);
    1.41 +	for ( i=0, j=0, k=-1; i< max_pfn; i+=fpp, j++ )
    1.42 +	{
    1.43 +	    if ( (j % fpp) == 0 )
    1.44 +	    {
    1.45 +	        k++;
    1.46 +		BUG_ON(k>=16);
    1.47 +		pfn_to_mfn_frame_list[k] = alloc_bootmem_low_pages(PAGE_SIZE);
    1.48 +		pfn_to_mfn_frame_list_list[k] = 
    1.49 +		    virt_to_mfn(pfn_to_mfn_frame_list[k]);
    1.50 +		j=0;
    1.51 +	    }
    1.52 +	    pfn_to_mfn_frame_list[k][j] = 
    1.53 +	        virt_to_mfn(&phys_to_machine_mapping[i]);
    1.54  	}
    1.55 -	HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list =
    1.56 -	     virt_to_mfn(pfn_to_mfn_frame_list);
    1.57 +	HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
    1.58  
    1.59  	/*
    1.60  	 * NOTE: at this point the bootmem allocator is fully available.
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Wed Sep 07 12:47:45 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Wed Sep 07 12:48:11 2005 +0000
     2.3 @@ -67,7 +67,7 @@ static int shutting_down = SHUTDOWN_INVA
     2.4  
     2.5  static int __do_suspend(void *ignore)
     2.6  {
     2.7 -    int i, j;
     2.8 +    int i, j, k, fpp;
     2.9  
    2.10  #ifdef CONFIG_XEN_USB_FRONTEND
    2.11      extern void usbif_resume();
    2.12 @@ -81,7 +81,7 @@ static int __do_suspend(void *ignore)
    2.13      extern void time_suspend(void);
    2.14      extern void time_resume(void);
    2.15      extern unsigned long max_pfn;
    2.16 -    extern unsigned long *pfn_to_mfn_frame_list;
    2.17 +    extern unsigned long *pfn_to_mfn_frame_list_list, *pfn_to_mfn_frame_list[];
    2.18  
    2.19  #ifdef CONFIG_SMP
    2.20      extern void smp_suspend(void);
    2.21 @@ -191,14 +191,24 @@ static int __do_suspend(void *ignore)
    2.22      HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
    2.23  
    2.24      memset(empty_zero_page, 0, PAGE_SIZE);
    2.25 -
    2.26 -    for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
    2.27 +	     
    2.28 +    HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
    2.29 +		virt_to_mfn(pfn_to_mfn_frame_list_list);
    2.30 +  
    2.31 +    fpp = PAGE_SIZE/sizeof(unsigned long);
    2.32 +    for ( i=0, j=0, k=-1; i< max_pfn; i+=fpp, j++ )
    2.33      {
    2.34 -        pfn_to_mfn_frame_list[j] = 
    2.35 -            virt_to_mfn(&phys_to_machine_mapping[i]);
    2.36 +	if ( (j % fpp) == 0 )
    2.37 +	{
    2.38 +	    k++;
    2.39 +	    pfn_to_mfn_frame_list_list[k] = 
    2.40 +		    virt_to_mfn(pfn_to_mfn_frame_list[k]);
    2.41 +	    j=0;
    2.42 +	}
    2.43 +	pfn_to_mfn_frame_list[k][j] = 
    2.44 +		virt_to_mfn(&phys_to_machine_mapping[i]);
    2.45      }
    2.46 -    HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list =
    2.47 -        virt_to_mfn(pfn_to_mfn_frame_list);
    2.48 +    HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
    2.49  
    2.50      gnttab_resume();
    2.51  
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Sep 07 12:47:45 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Wed Sep 07 12:48:11 2005 +0000
     3.3 @@ -76,7 +76,8 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
     3.4  /* Allows setting of maximum possible memory size  */
     3.5  unsigned long xen_override_max_pfn;
     3.6  
     3.7 -unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
     3.8 +unsigned long *phys_to_machine_mapping;
     3.9 +unsigned long *pfn_to_mfn_frame_list_list, *pfn_to_mfn_frame_list[512];
    3.10  
    3.11  EXPORT_SYMBOL(phys_to_machine_mapping);
    3.12  
    3.13 @@ -730,7 +731,7 @@ void __init setup_arch(char **cmdline_p)
    3.14  #endif
    3.15  #ifdef CONFIG_XEN
    3.16  	{
    3.17 -		int i, j;
    3.18 +		int i, j, k, fpp;
    3.19  		/* Make sure we have a large enough P->M table. */
    3.20  		if (end_pfn > xen_start_info->nr_pages) {
    3.21  			phys_to_machine_mapping = alloc_bootmem(
    3.22 @@ -746,11 +747,35 @@ void __init setup_arch(char **cmdline_p)
    3.23  						sizeof(unsigned long))));
    3.24  		}
    3.25  
    3.26 -		pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE);
    3.27 +		/* 
    3.28 +		 * Initialise the list of the frames that specify the list of 
    3.29 +		 * frames that make up the p2m table. Used by save/restore
    3.30 +		 */
    3.31 +		pfn_to_mfn_frame_list_list = alloc_bootmem(PAGE_SIZE);
    3.32 +		HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
    3.33 +		  virt_to_mfn(pfn_to_mfn_frame_list_list);
    3.34 +	       
    3.35 +		fpp = PAGE_SIZE/sizeof(unsigned long);
    3.36 +		for ( i=0, j=0, k=-1; i< max_pfn; i+=fpp, j++ )
    3.37 +		{
    3.38 +			if ( (j % fpp) == 0 )
    3.39 +			{
    3.40 +				k++;
    3.41 +				BUG_ON(k>=fpp);
    3.42 +				pfn_to_mfn_frame_list[k] = alloc_bootmem(PAGE_SIZE);
    3.43 +				pfn_to_mfn_frame_list_list[k] = 
    3.44 +					virt_to_mfn(pfn_to_mfn_frame_list[k]);
    3.45 +				j=0;
    3.46 +			}
    3.47 +			pfn_to_mfn_frame_list[k][j] = 
    3.48 +				virt_to_mfn(&phys_to_machine_mapping[i]);
    3.49 +		}
    3.50 +		HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
    3.51 +		
    3.52 +		
    3.53  
    3.54 -		for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
    3.55 -			pfn_to_mfn_frame_list[j] =
    3.56 -				virt_to_mfn(&phys_to_machine_mapping[i]);
    3.57 +
    3.58 +
    3.59  	}
    3.60  #endif
    3.61  
     5.1 --- a/tools/libxc/xc_linux_save.c	Wed Sep 07 12:47:45 2005 +0000
     5.2 +++ b/tools/libxc/xc_linux_save.c	Wed Sep 07 12:48:11 2005 +0000
     5.3 @@ -419,6 +419,7 @@ int xc_linux_save(int xc_handle, int io_
     5.4      unsigned long page[1024];
     5.5  
     5.6      /* A copy of the pfn-to-mfn table frame list. */
     5.7 +    unsigned long *live_pfn_to_mfn_frame_list_list = NULL;
     5.8      unsigned long *live_pfn_to_mfn_frame_list = NULL;
     5.9      unsigned long pfn_to_mfn_frame_list[1024];
    5.10  
    5.11 @@ -506,11 +507,20 @@ int xc_linux_save(int xc_handle, int io_
    5.12          goto out;
    5.13      }
    5.14  
    5.15 -    /* the pfn_to_mfn_frame_list fits in a single page */
    5.16 +    live_pfn_to_mfn_frame_list_list = xc_map_foreign_range(xc_handle, dom,
    5.17 +                                        PAGE_SIZE, PROT_READ,
    5.18 +                                        live_shinfo->arch.pfn_to_mfn_frame_list_list);
    5.19 +
    5.20 +    if (!live_pfn_to_mfn_frame_list_list){
    5.21 +        ERR("Couldn't map pfn_to_mfn_frame_list_list");
    5.22 +        goto out;
    5.23 +    }
    5.24 +
    5.25      live_pfn_to_mfn_frame_list = 
    5.26 -        xc_map_foreign_range(xc_handle, dom, 
    5.27 -                              PAGE_SIZE, PROT_READ, 
    5.28 -                              live_shinfo->arch.pfn_to_mfn_frame_list );
    5.29 +	xc_map_foreign_batch(xc_handle, dom, 
    5.30 +			     PROT_READ,
    5.31 +			     live_pfn_to_mfn_frame_list_list,
    5.32 +			     (nr_pfns+(1024*1024)-1)/(1024*1024) );
    5.33  
    5.34      if (!live_pfn_to_mfn_frame_list){
    5.35          ERR("Couldn't map pfn_to_mfn_frame_list");
     6.1 --- a/tools/libxc/xc_load_aout9.c	Wed Sep 07 12:47:45 2005 +0000
     6.2 +++ b/tools/libxc/xc_load_aout9.c	Wed Sep 07 12:48:11 2005 +0000
     6.3 @@ -14,7 +14,6 @@
     6.4  
     6.5  
     6.6  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
     6.7 -#define round_pgdown(_p)  ((_p)&PAGE_MASK)
     6.8  #define KZERO             0x80000000
     6.9  #define KOFFSET(_p)       ((_p)&~KZERO)
    6.10  
    6.11 @@ -49,7 +48,7 @@ parseaout9image(
    6.12      struct domain_setup_info *dsi)
    6.13  {
    6.14      struct Exec ehdr;
    6.15 -    unsigned long start, txtsz, end;
    6.16 +    unsigned long start, dstart, end;
    6.17  
    6.18      if (!get_header(image, image_size, &ehdr)) {
    6.19          ERROR("Kernel image does not have a a.out9 header.");
    6.20 @@ -61,9 +60,9 @@ parseaout9image(
    6.21          return -EINVAL;
    6.22      }
    6.23  
    6.24 -    start = round_pgdown(ehdr.entry);
    6.25 -    txtsz = round_pgup(ehdr.text);
    6.26 -    end = start + txtsz + ehdr.data + ehdr.bss;
    6.27 +    start = ehdr.entry;
    6.28 +    dstart = round_pgup(start + ehdr.text);
    6.29 +    end = dstart + ehdr.data + ehdr.bss;
    6.30  
    6.31      dsi->v_start	= KZERO;
    6.32      dsi->v_kernstart	= start;
    6.33 @@ -85,19 +84,18 @@ loadaout9image(
    6.34      struct domain_setup_info *dsi)
    6.35  {
    6.36      struct Exec ehdr;
    6.37 -    unsigned long start, txtsz;
    6.38 +    unsigned long start, dstart;
    6.39  
    6.40      if (!get_header(image, image_size, &ehdr)) {
    6.41          ERROR("Kernel image does not have a a.out9 header.");
    6.42          return -EINVAL;
    6.43      }
    6.44  
    6.45 -    start = round_pgdown(ehdr.entry);
    6.46 -    txtsz = round_pgup(ehdr.text);
    6.47 -    copyout(xch, dom, parray, 
    6.48 -            start, image, sizeof ehdr + ehdr.text);
    6.49 -    copyout(xch, dom, parray, 
    6.50 -            start+txtsz, image + sizeof ehdr + ehdr.text, ehdr.data);
    6.51 +    start = ehdr.entry;
    6.52 +    dstart = round_pgup(start + ehdr.text);
    6.53 +    copyout(xch, dom, parray, start, image + sizeof ehdr, ehdr.text);
    6.54 +    copyout(xch, dom, parray, dstart,
    6.55 +            image + sizeof ehdr + ehdr.text, ehdr.data);
    6.56  
    6.57      /* XXX load symbols */
    6.58  
     7.1 --- a/tools/python/xen/lowlevel/xs/xs.c	Wed Sep 07 12:47:45 2005 +0000
     7.2 +++ b/tools/python/xen/lowlevel/xs/xs.c	Wed Sep 07 12:48:11 2005 +0000
     7.3 @@ -15,6 +15,7 @@
     7.4   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     7.5   *
     7.6   * Copyright (C) 2005 Mike Wray Hewlett-Packard
     7.7 + * Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
     7.8   *
     7.9   */
    7.10  
     8.1 --- a/xen/arch/x86/time.c	Wed Sep 07 12:47:45 2005 +0000
     8.2 +++ b/xen/arch/x86/time.c	Wed Sep 07 12:48:11 2005 +0000
     8.3 @@ -792,6 +792,13 @@ static void local_time_calibration(void 
     8.4      tsc_elapsed64   = curr_tsc - prev_tsc;
     8.5  
     8.6      /*
     8.7 +     * Weirdness can happen if we lose sync with the platform timer.
     8.8 +     * We could be smarter here: resync platform timer with local timer?
     8.9 +     */
    8.10 +    if ( ((s64)stime_elapsed64 < (EPOCH / 2)) )
    8.11 +        goto out;
    8.12 +
    8.13 +    /*
    8.14       * Calculate error-correction factor. This only slows down a fast local
    8.15       * clock (slow clocks are warped forwards). The scale factor is clamped
    8.16       * to >= 0.5.
    8.17 @@ -854,6 +861,7 @@ static void local_time_calibration(void 
    8.18      cpu_time[cpu].stime_local_stamp  = curr_local_stime;
    8.19      cpu_time[cpu].stime_master_stamp = curr_master_stime;
    8.20  
    8.21 + out:
    8.22      set_ac_timer(&cpu_time[cpu].calibration_timer, NOW() + EPOCH);
    8.23  
    8.24      if ( cpu == 0 )
     9.1 --- a/xen/include/public/arch-x86_32.h	Wed Sep 07 12:47:45 2005 +0000
     9.2 +++ b/xen/include/public/arch-x86_32.h	Wed Sep 07 12:48:11 2005 +0000
     9.3 @@ -128,8 +128,11 @@ typedef struct vcpu_guest_context {
     9.4  } vcpu_guest_context_t;
     9.5  
     9.6  typedef struct arch_shared_info {
     9.7 -    /* MFN of a table of MFNs that make up p2m table */
     9.8 -    u64 pfn_to_mfn_frame_list;
     9.9 +    unsigned long max_pfn;                  /* max pfn that appears in table */
    9.10 +    unsigned long pfn_to_mfn_frame_list_list; 
    9.11 +                                            /* frame containing list of mfns
    9.12 +					       containing list of mfns 
    9.13 +					       containing the p2m table. */
    9.14  } arch_shared_info_t;
    9.15  
    9.16  #endif
    10.1 --- a/xen/include/public/arch-x86_64.h	Wed Sep 07 12:47:45 2005 +0000
    10.2 +++ b/xen/include/public/arch-x86_64.h	Wed Sep 07 12:48:11 2005 +0000
    10.3 @@ -186,8 +186,11 @@ typedef struct vcpu_guest_context {
    10.4  } vcpu_guest_context_t;
    10.5  
    10.6  typedef struct arch_shared_info {
    10.7 -    /* MFN of a table of MFNs that make up p2m table */
    10.8 -    u64 pfn_to_mfn_frame_list;
    10.9 +    unsigned long max_pfn;                  /* max pfn that appears in table */
   10.10 +    unsigned long pfn_to_mfn_frame_list_list; 
   10.11 +                                            /* frame containing list of mfns
   10.12 +					       containing list of mfns 
   10.13 +					       containing the p2m table. */
   10.14  } arch_shared_info_t;
   10.15  
   10.16  #endif /* !__ASSEMBLY__ */