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] [patch 2/3] kexec: Add machine_kexec_get()

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 2/3] kexec: Add machine_kexec_get()
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 27 Feb 2008 16:01:07 +0900
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Tue, 26 Feb 2008 23:19:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
Introduce machine_kexec_get to allow architecture-specific handling of the
xen region. x86_64 is currently different to x86_32 and ia64. A subsequent
patch will make ia64 different from x86_32.

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

--- 

 xen/arch/ia64/xen/machine_kexec.c   |   15 +++++++++++++++
 xen/arch/powerpc/machine_kexec.c    |    6 ++++++
 xen/arch/x86/machine_kexec.c        |   10 ++++++++++
 xen/arch/x86/x86_32/Makefile        |    1 +
 xen/arch/x86/x86_32/machine_kexec.c |   33 +++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/Makefile        |    1 +
 xen/arch/x86/x86_64/machine_kexec.c |   32 ++++++++++++++++++++++++++++++++
 xen/common/kexec.c                  |   18 ++++--------------
 xen/include/xen/kexec.h             |    1 +
 9 files changed, 103 insertions(+), 14 deletions(-)

Index: xen-unstable.hg/xen/arch/ia64/xen/machine_kexec.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/xen/machine_kexec.c      2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/xen/machine_kexec.c   2008-02-25 
17:37:10.000000000 +0900
@@ -162,6 +162,21 @@ void machine_reboot_kexec(xen_kexec_imag
        machine_kexec(image);
 }
 
+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;
+       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);
+}
+
 /*
  * Local variables:
  * mode: C
Index: xen-unstable.hg/xen/arch/powerpc/machine_kexec.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/powerpc/machine_kexec.c       2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/arch/powerpc/machine_kexec.c    2008-02-25 
17:11:39.000000000 +0900
@@ -24,6 +24,12 @@ void machine_kexec(xen_kexec_image_t *im
     printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
 }
 
+int machine_kexec_get(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
Index: xen-unstable.hg/xen/common/kexec.c
===================================================================
--- xen-unstable.hg.orig/xen/common/kexec.c     2008-02-25 17:04:20.000000000 
+0900
+++ xen-unstable.hg/xen/common/kexec.c  2008-02-25 17:08:53.000000000 +0900
@@ -20,6 +20,7 @@
 #include <xen/spinlock.h>
 #include <xen/version.h>
 #include <xen/console.h>
+#include <xen/kexec.h>
 #include <public/elfnote.h>
 #include <xsm/xsm.h>
 
@@ -164,17 +165,6 @@ static int kexec_get_reserve(xen_kexec_r
     return 0;
 }
 
-static int kexec_get_xen(xen_kexec_range_t *range)
-{
-#ifdef CONFIG_X86_64
-    range->start = xenheap_phys_start;
-#else
-    range->start = virt_to_maddr(_start);
-#endif
-    range->size = (unsigned long)xenheap_phys_end - (unsigned 
long)range->start;
-    return 0;
-}
-
 static int kexec_get_cpu(xen_kexec_range_t *range)
 {
     int nr = range->nr;
@@ -228,12 +218,12 @@ static int kexec_get_range_internal(xen_
     case KEXEC_RANGE_MA_CRASH:
         ret = kexec_get_reserve(range);
         break;
-    case KEXEC_RANGE_MA_XEN:
-        ret = kexec_get_xen(range);
-        break;
     case KEXEC_RANGE_MA_CPU:
         ret = kexec_get_cpu(range);
         break;
+    default:
+        ret = machine_kexec_get(range);
+        break;
     }
 
     return ret;
Index: xen-unstable.hg/xen/arch/x86/machine_kexec.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/machine_kexec.c   2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/arch/x86/machine_kexec.c        2008-02-25 
17:11:55.000000000 +0900
@@ -24,6 +24,9 @@ typedef void (*relocate_new_kernel_t)(
                 unsigned long *page_list,
                 unsigned long start_address);
 
+extern int machine_kexec_get_xen(xen_kexec_range_t *range);
+
+
 int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
 {
     unsigned long prev_ma = 0;
@@ -135,6 +138,13 @@ void machine_kexec(xen_kexec_image_t *im
     }
 }
 
+int machine_kexec_get(xen_kexec_range_t *range)
+{
+       if (range->range != KEXEC_RANGE_MA_XEN)
+               return -EINVAL;
+       return machine_kexec_get_xen(range);
+}
+
 /*
  * Local variables:
  * mode: C
Index: xen-unstable.hg/xen/arch/x86/x86_32/Makefile
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/x86_32/Makefile   2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/arch/x86/x86_32/Makefile        2008-02-25 
17:08:10.000000000 +0900
@@ -4,6 +4,7 @@ obj-y += gpr_switch.o
 obj-y += mm.o
 obj-y += seg_fixup.o
 obj-y += traps.o
+obj-y += machine_kexec.o
 
 obj-$(crash_debug) += gdbstub.o
 
Index: xen-unstable.hg/xen/arch/x86/x86_32/machine_kexec.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ xen-unstable.hg/xen/arch/x86/x86_32/machine_kexec.c 2008-02-25 
17:08:10.000000000 +0900
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * machine_kexec.c
+ *
+ * Xen port written by:
+ * - Simon 'Horms' Horman <horms@xxxxxxxxxxxx>
+ * - Magnus Damm <magnus@xxxxxxxxxxxxx>
+ */
+
+#ifndef CONFIG_COMPAT
+
+#include <xen/types.h>
+#include <xen/kernel.h>
+#include <asm/page.h>
+#include <public/kexec.h>
+
+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;
+        return 0;
+}
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Index: xen-unstable.hg/xen/include/xen/kexec.h
===================================================================
--- xen-unstable.hg.orig/xen/include/xen/kexec.h        2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/include/xen/kexec.h     2008-02-25 17:08:10.000000000 
+0900
@@ -31,6 +31,7 @@ void kexec_disable_iosapic(void);
 void kexec_crash_save_cpu(void);
 crash_xen_info_t *kexec_crash_save_info(void);
 void machine_crash_shutdown(void);
+int machine_kexec_get(xen_kexec_range_t *range);
 
 #endif /* __XEN_KEXEC_H__ */
 
Index: xen-unstable.hg/xen/arch/x86/x86_64/Makefile
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/x86_64/Makefile   2008-02-25 
17:01:38.000000000 +0900
+++ xen-unstable.hg/xen/arch/x86/x86_64/Makefile        2008-02-25 
17:11:06.000000000 +0900
@@ -4,6 +4,7 @@ obj-y += entry.o
 obj-y += gpr_switch.o
 obj-y += mm.o
 obj-y += traps.o
+obj-y += machine_kexec.o
 
 obj-$(crash_debug)   += gdbstub.o
 obj-$(CONFIG_COMPAT) += compat.o
Index: xen-unstable.hg/xen/arch/x86/x86_64/machine_kexec.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ xen-unstable.hg/xen/arch/x86/x86_64/machine_kexec.c 2008-02-25 
17:08:10.000000000 +0900
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * machine_kexec.c
+ *
+ * Xen port written by:
+ * - Simon 'Horms' Horman <horms@xxxxxxxxxxxx>
+ * - Magnus Damm <magnus@xxxxxxxxxxxxx>
+ */
+
+#ifndef CONFIG_COMPAT
+
+#include <xen/types.h>
+#include <asm/page.h>
+#include <public/kexec.h>
+
+int machine_kexec_get_xen(xen_kexec_range_t *range)
+{
+        range->start = xenheap_phys_start;
+        range->size = (unsigned long)xenheap_phys_end -
+                      (unsigned long)range->start;
+        return 0;
+}
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

-- 

-- 
Horms


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