[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] kexec: extend hypercall for efi memory map, boot parameter and xenheap regions



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204195722 0
# Node ID 896b543581febb03d8d65eb1275d74d90b9f708c
# Parent  c88394b7c05ad1bc4a379d45753c50ef5e76d85d
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@xxxxxxxxxxxx>
---
 xen/arch/ia64/xen/machine_kexec.c |   42 ++++++++++++++++++++++++++++++++++----
 xen/include/public/kexec.h        |   15 ++++++++++---
 2 files changed, 50 insertions(+), 7 deletions(-)

diff -r c88394b7c05a -r 896b543581fe xen/arch/ia64/xen/machine_kexec.c
--- a/xen/arch/ia64/xen/machine_kexec.c Thu Feb 28 10:46:27 2008 +0000
+++ b/xen/arch/ia64/xen/machine_kexec.c Thu Feb 28 10:48:42 2008 +0000
@@ -24,6 +24,7 @@
 #include <linux/cpu.h>
 #include <linux/notifier.h>
 #include <asm/dom_fw_dom0.h>
+#include <asm-generic/sections.h>
 
 typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)(
                                        unsigned long indirection_page,
@@ -167,17 +168,50 @@ void machine_reboot_kexec(xen_kexec_imag
 
 static int machine_kexec_get_xen(xen_kexec_range_t *range)
 {
-       range->start = virt_to_maddr(_start);
+       range->start = range->start = ia64_tpa(_text);
+       range->size = (unsigned long)_end - (unsigned long)_text;
+       return 0;
+}
+
+#define ELF_PAGE_SHIFT 16
+#define ELF_PAGE_SIZE  (__IA64_UL_CONST(1) << ELF_PAGE_SHIFT)
+#define ELF_PAGE_MASK  (~(ELF_PAGE_SIZE - 1))
+
+static int machine_kexec_get_xenheap(xen_kexec_range_t *range)
+{
+       range->start = (ia64_tpa(_end) + (ELF_PAGE_SIZE - 1)) & ELF_PAGE_MASK;
        range->size = (unsigned long)xenheap_phys_end -
                      (unsigned long)range->start;
        return 0;
 }
 
+static int machine_kexec_get_boot_param(xen_kexec_range_t *range)
+{
+       range->start = __pa(ia64_boot_param);
+       range->size = sizeof(*ia64_boot_param);
+       return 0;
+}
+
+static int machine_kexec_get_efi_memmap(xen_kexec_range_t *range)
+{
+       range->start = ia64_boot_param->efi_memmap;
+       range->size = ia64_boot_param->efi_memmap_size;
+       return 0;
+}
+
 int machine_kexec_get(xen_kexec_range_t *range)
 {
-       if (range->range != KEXEC_RANGE_MA_XEN)
-               return -EINVAL;
-       return machine_kexec_get_xen(range);
+       switch (range->range) {
+       case KEXEC_RANGE_MA_XEN:
+               return machine_kexec_get_xen(range);
+       case KEXEC_RANGE_MA_XENHEAP:
+               return machine_kexec_get_xenheap(range);
+       case KEXEC_RANGE_MA_BOOT_PARAM:
+               return machine_kexec_get_boot_param(range);
+       case KEXEC_RANGE_MA_EFI_MEMMAP:
+               return machine_kexec_get_efi_memmap(range);
+       }
+       return -EINVAL;
 }
 
 /*
diff -r c88394b7c05a -r 896b543581fe xen/include/public/kexec.h
--- a/xen/include/public/kexec.h        Thu Feb 28 10:46:27 2008 +0000
+++ b/xen/include/public/kexec.h        Thu Feb 28 10:48:42 2008 +0000
@@ -126,9 +126,18 @@ typedef struct xen_kexec_load {
     xen_kexec_image_t image;
 } xen_kexec_load_t;
 
-#define KEXEC_RANGE_MA_CRASH 0   /* machine address and size of crash area */
-#define KEXEC_RANGE_MA_XEN   1   /* machine address and size of Xen itself */
-#define KEXEC_RANGE_MA_CPU   2   /* machine address and size of a CPU note */
+#define KEXEC_RANGE_MA_CRASH      0 /* machine address and size of crash area 
*/
+#define KEXEC_RANGE_MA_XEN        1 /* machine address and size of Xen itself 
*/
+#define KEXEC_RANGE_MA_CPU        2 /* machine address and size of a CPU note 
*/
+#define KEXEC_RANGE_MA_XENHEAP    3 /* machine address and size of xenheap
+                                     * Note that although this is adjacent
+                                     * to Xen it exists in a separate EFI
+                                     * region on ia64, and thus needs to be
+                                     * inserted into iomem_machine separately 
*/
+#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
+                                     * the ia64_boot_param */
+#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
+                                     * of the EFI Memory Map */
 
 /*
  * Find the address and size of certain memory areas

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.