ia64/linux-2.6.18-xen.hg

changeset 451:11371d0e841b

kexec: read more iomem regions from hypervisor

This sets the location of the efi memmap and boot parameter
regions using information provided by the hypervisor,
overriding values derived by dom0 from the virtualised
efi memory regions.

It also creates a xen heap region and uses this as the parent
of per-cpu regions - they belong in hypervisor memory not
dom0 kernel memory.

The xen heap region is inserted into /proc/iomem_machine

* There is also a hypervisor portion of this patch.
* In order for the regions to show up after kexec patches
to kexec-tools are required. I have posted them
to the kexec mailing list and intend to merge them.

http://lists.infradead.org/pipermail/kexec/2008-February/001348.html

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 10:54:55 2008 +0000 (2008-02-28)
parents b7f980c60a61
children c7ed6fe5dca0
files arch/ia64/kernel/machine_kexec.c include/xen/interface/kexec.h
line diff
     1.1 --- a/arch/ia64/kernel/machine_kexec.c	Thu Feb 28 10:54:20 2008 +0000
     1.2 +++ b/arch/ia64/kernel/machine_kexec.c	Thu Feb 28 10:54:55 2008 +0000
     1.3 @@ -143,18 +143,62 @@ void machine_kexec_setup_load_arg(xen_ke
     1.4  		kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT;
     1.5  }
     1.6  
     1.7 +static struct resource xen_hypervisor_heap_res;
     1.8 +
     1.9  int __init machine_kexec_setup_resources(struct resource *hypervisor,
    1.10  					 struct resource *phys_cpus,
    1.11  					 int nr_phys_cpus)
    1.12  {
    1.13 +	xen_kexec_range_t range;
    1.14  	int k;
    1.15  
    1.16 -	/* The per-cpu crash note resources belong to the hypervisor resource */
    1.17 +	/* fill in xen_hypervisor_heap_res with hypervisor heap
    1.18 +	 * machine address range
    1.19 +	 */
    1.20 +
    1.21 +	memset(&range, 0, sizeof(range));
    1.22 +	range.range = KEXEC_RANGE_MA_XENHEAP;
    1.23 +
    1.24 +	if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
    1.25 +		return -1;
    1.26 +
    1.27 +	xen_hypervisor_heap_res.name = "Hypervisor heap";
    1.28 +	xen_hypervisor_heap_res.start = range.start;
    1.29 +	xen_hypervisor_heap_res.end = range.start + range.size - 1;
    1.30 +	xen_hypervisor_heap_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM;
    1.31 +
    1.32 +	/* The per-cpu crash note  resources belong inside the
    1.33 +	 * hypervisor heap resource */
    1.34  	for (k = 0; k < nr_phys_cpus; k++)
    1.35 -		request_resource(hypervisor, phys_cpus + k);
    1.36 +		request_resource(&xen_hypervisor_heap_res, phys_cpus + k);
    1.37 +
    1.38 +	/* fill in efi_memmap_res with EFI memmap machine address range */
    1.39 +
    1.40 +	memset(&range, 0, sizeof(range));
    1.41 +	range.range = KEXEC_RANGE_MA_EFI_MEMMAP;
    1.42 +
    1.43 +	if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
    1.44 +		return -1;
    1.45 +
    1.46 +	efi_memmap_res.start = range.start;
    1.47 +	efi_memmap_res.end = range.start + range.size - 1;
    1.48 +
    1.49 +	/* fill in boot_param_res with boot parameter machine address range */
    1.50 +
    1.51 +	memset(&range, 0, sizeof(range));
    1.52 +	range.range = KEXEC_RANGE_MA_BOOT_PARAM;
    1.53 +
    1.54 +	if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
    1.55 +		return -1;
    1.56 +
    1.57 +	boot_param_res.start = range.start;
    1.58 +	boot_param_res.end = range.start + range.size - 1;
    1.59  
    1.60  	return 0;
    1.61  }
    1.62  
    1.63 -void machine_kexec_register_resources(struct resource *res) { ; }
    1.64 +void machine_kexec_register_resources(struct resource *res)
    1.65 +{
    1.66 +	request_resource(res, &xen_hypervisor_heap_res);
    1.67 +}
    1.68  #endif /* CONFIG_XEN */
     2.1 --- a/include/xen/interface/kexec.h	Thu Feb 28 10:54:20 2008 +0000
     2.2 +++ b/include/xen/interface/kexec.h	Thu Feb 28 10:54:55 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