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

[Xen-changelog] [xen-unstable] kexec: Add machine_kexec_get()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204195587 0
# Node ID c88394b7c05ad1bc4a379d45753c50ef5e76d85d
# Parent  90ae3dfdd3cc02aca07f5b8b53b4266e8fc48f95
kexec: Add machine_kexec_get()

Introduce machine_kexec_get to allow architecture-specific handling of
the xen region. x86_64 is currently different to x86_32 and ia64.

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(-)

diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/ia64/xen/machine_kexec.c
--- a/xen/arch/ia64/xen/machine_kexec.c Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/arch/ia64/xen/machine_kexec.c Thu Feb 28 10:46:27 2008 +0000
@@ -165,6 +165,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
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/powerpc/machine_kexec.c
--- a/xen/arch/powerpc/machine_kexec.c  Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/arch/powerpc/machine_kexec.c  Thu Feb 28 10:46:27 2008 +0000
@@ -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
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/x86/machine_kexec.c
--- a/xen/arch/x86/machine_kexec.c      Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/arch/x86/machine_kexec.c      Thu Feb 28 10:46:27 2008 +0000
@@ -23,6 +23,9 @@ typedef void (*relocate_new_kernel_t)(
                 unsigned long indirection_page,
                 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)
 {
@@ -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
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/x86/x86_32/Makefile
--- a/xen/arch/x86/x86_32/Makefile      Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/arch/x86/x86_32/Makefile      Thu Feb 28 10:46:27 2008 +0000
@@ -4,6 +4,7 @@ obj-y += mm.o
 obj-y += mm.o
 obj-y += seg_fixup.o
 obj-y += traps.o
+obj-y += machine_kexec.o
 
 obj-$(crash_debug) += gdbstub.o
 
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/x86/x86_32/machine_kexec.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_32/machine_kexec.c       Thu Feb 28 10:46:27 2008 +0000
@@ -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:
+ */
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile      Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/arch/x86/x86_64/Makefile      Thu Feb 28 10:46:27 2008 +0000
@@ -4,6 +4,7 @@ obj-y += gpr_switch.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
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/arch/x86/x86_64/machine_kexec.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_64/machine_kexec.c       Thu Feb 28 10:46:27 2008 +0000
@@ -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:
+ */
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/common/kexec.c        Thu Feb 28 10:46:27 2008 +0000
@@ -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,11 +218,11 @@ 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;
     }
 
diff -r 90ae3dfdd3cc -r c88394b7c05a xen/include/xen/kexec.h
--- a/xen/include/xen/kexec.h   Thu Feb 28 10:45:47 2008 +0000
+++ b/xen/include/xen/kexec.h   Thu Feb 28 10:46:27 2008 +0000
@@ -31,6 +31,7 @@ void kexec_crash_save_cpu(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__ */
 

_______________________________________________
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®.