WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [Xen-ia64-devel] [patch 3/3] kexec: extend hypercall for

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: [Xen-ia64-devel] [patch 3/3] kexec: extend hypercall for efi memory map, boot parameter and xenheap regions
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Thu, 28 Feb 2008 16:50:34 +0900
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Wed, 27 Feb 2008 23:51:02 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080227071353.835335637@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20080227070105.949799153@xxxxxxxxxxxx> <20080227071353.835335637@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.17+20080114 (2008-01-14)
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.

* There is also a linux-xen portion of this patch.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

--- 

 xen/arch/ia64/xen/machine_kexec.c |   45 ++++++++++++++++++++++++++++++++-----
 xen/include/public/kexec.h        |   15 +++++++++---
 2 files changed, 51 insertions(+), 9 deletions(-)

Thu, 28 Feb 2008 16:30:07 +0900
- Consistently use tabs or spaces for indentation. Thanks to Alex Williamson

Index: xen-unstable.hg/xen/arch/ia64/xen/machine_kexec.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/xen/machine_kexec.c      2008-02-27 
15:48:02.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/xen/machine_kexec.c   2008-02-27 
15:48:03.000000000 +0900
@@ -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->size = (unsigned long)xenheap_phys_end -
-                     (unsigned long)range->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;
 }
 
 /*
Index: xen-unstable.hg/xen/include/public/kexec.h
===================================================================
--- xen-unstable.hg.orig/xen/include/public/kexec.h     2008-02-27 
12:54:37.000000000 +0900
+++ xen-unstable.hg/xen/include/public/kexec.h  2008-02-27 15:48:03.000000000 
+0900
@@ -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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel