ia64/xen-unstable

changeset 17148:896b543581fe

kexec: extend hypercall for efi memory map, boot parameter and xenheap regions

Extend the kexec hypercall to allow it to return the efi memory map,
boot parameter and xen heap regions.

The efi memory map and boot parameter regions need to be supplied
by xen to dom0, rather than established by dom0 as dom0's memory
is not machine memory and thus the regions are not in the correct
location. These regions are inserted into machine_iomem by dom0.

The xen heap region is needed as on xen the hypervisor code and
heap exist in two different EFI memory regions, which are
reflected in machine_iomem. Thus a single xen code region can't be
inserted into machine_iomem.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 10:48:42 2008 +0000 (2008-02-28)
parents c88394b7c05a
children ecf7ded43d5c
files xen/arch/ia64/xen/machine_kexec.c xen/include/public/kexec.h
line diff
     1.1 --- a/xen/arch/ia64/xen/machine_kexec.c	Thu Feb 28 10:46:27 2008 +0000
     1.2 +++ b/xen/arch/ia64/xen/machine_kexec.c	Thu Feb 28 10:48:42 2008 +0000
     1.3 @@ -24,6 +24,7 @@
     1.4  #include <linux/cpu.h>
     1.5  #include <linux/notifier.h>
     1.6  #include <asm/dom_fw_dom0.h>
     1.7 +#include <asm-generic/sections.h>
     1.8  
     1.9  typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)(
    1.10  					unsigned long indirection_page,
    1.11 @@ -167,17 +168,50 @@ void machine_reboot_kexec(xen_kexec_imag
    1.12  
    1.13  static int machine_kexec_get_xen(xen_kexec_range_t *range)
    1.14  {
    1.15 -	range->start = virt_to_maddr(_start);
    1.16 +	range->start = range->start = ia64_tpa(_text);
    1.17 +	range->size = (unsigned long)_end - (unsigned long)_text;
    1.18 +	return 0;
    1.19 +}
    1.20 +
    1.21 +#define ELF_PAGE_SHIFT 16
    1.22 +#define ELF_PAGE_SIZE  (__IA64_UL_CONST(1) << ELF_PAGE_SHIFT)
    1.23 +#define ELF_PAGE_MASK  (~(ELF_PAGE_SIZE - 1))
    1.24 +
    1.25 +static int machine_kexec_get_xenheap(xen_kexec_range_t *range)
    1.26 +{
    1.27 +	range->start = (ia64_tpa(_end) + (ELF_PAGE_SIZE - 1)) & ELF_PAGE_MASK;
    1.28  	range->size = (unsigned long)xenheap_phys_end -
    1.29  		      (unsigned long)range->start;
    1.30  	return 0;
    1.31  }
    1.32  
    1.33 +static int machine_kexec_get_boot_param(xen_kexec_range_t *range)
    1.34 +{
    1.35 +	range->start = __pa(ia64_boot_param);
    1.36 +	range->size = sizeof(*ia64_boot_param);
    1.37 +	return 0;
    1.38 +}
    1.39 +
    1.40 +static int machine_kexec_get_efi_memmap(xen_kexec_range_t *range)
    1.41 +{
    1.42 +	range->start = ia64_boot_param->efi_memmap;
    1.43 +	range->size = ia64_boot_param->efi_memmap_size;
    1.44 +	return 0;
    1.45 +}
    1.46 +
    1.47  int machine_kexec_get(xen_kexec_range_t *range)
    1.48  {
    1.49 -	if (range->range != KEXEC_RANGE_MA_XEN)
    1.50 -		return -EINVAL;
    1.51 -	return machine_kexec_get_xen(range);
    1.52 +	switch (range->range) {
    1.53 +	case KEXEC_RANGE_MA_XEN:
    1.54 +		return machine_kexec_get_xen(range);
    1.55 +	case KEXEC_RANGE_MA_XENHEAP:
    1.56 +		return machine_kexec_get_xenheap(range);
    1.57 +	case KEXEC_RANGE_MA_BOOT_PARAM:
    1.58 +		return machine_kexec_get_boot_param(range);
    1.59 +	case KEXEC_RANGE_MA_EFI_MEMMAP:
    1.60 +		return machine_kexec_get_efi_memmap(range);
    1.61 +	}
    1.62 +	return -EINVAL;
    1.63  }
    1.64  
    1.65  /*
     2.1 --- a/xen/include/public/kexec.h	Thu Feb 28 10:46:27 2008 +0000
     2.2 +++ b/xen/include/public/kexec.h	Thu Feb 28 10:48:42 2008 +0000
     2.3 @@ -126,9 +126,18 @@ typedef struct xen_kexec_load {
     2.4      xen_kexec_image_t image;
     2.5  } xen_kexec_load_t;
     2.6  
     2.7 -#define KEXEC_RANGE_MA_CRASH 0   /* machine address and size of crash area */
     2.8 -#define KEXEC_RANGE_MA_XEN   1   /* machine address and size of Xen itself */
     2.9 -#define KEXEC_RANGE_MA_CPU   2   /* machine address and size of a CPU note */
    2.10 +#define KEXEC_RANGE_MA_CRASH      0 /* machine address and size of crash area */
    2.11 +#define KEXEC_RANGE_MA_XEN        1 /* machine address and size of Xen itself */
    2.12 +#define KEXEC_RANGE_MA_CPU        2 /* machine address and size of a CPU note */
    2.13 +#define KEXEC_RANGE_MA_XENHEAP    3 /* machine address and size of xenheap
    2.14 +                                     * Note that although this is adjacent
    2.15 +                                     * to Xen it exists in a separate EFI
    2.16 +                                     * region on ia64, and thus needs to be
    2.17 +                                     * inserted into iomem_machine separately */
    2.18 +#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
    2.19 +                                     * the ia64_boot_param */
    2.20 +#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
    2.21 +                                     * of the EFI Memory Map */
    2.22  
    2.23  /*
    2.24   * Find the address and size of certain memory areas