Skip to contentSkip to conversation

s390: add kexec support to 2.6.12-rc2-mm3

PATCH New Heiko Carstens 1 participant 1 message Apr 25, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: add kexec support to 2.6.12-rc2-mm3

Hi Andrew,

the patch below adds kexec support for s390. The patch applies against 2.6.12-rc2-mm3. Could you apply this patch to your -mm tree please?

Thanks,
Heiko

From: Rolf Adelsberger <[email protected]>
From: Heiko Carstens <[email protected]>

Add kexec support for s390 architecture.

diffstat:

 arch/s390/Kconfig                    |   20 +++++
 arch/s390/kernel/Makefile            |   10 ++
 arch/s390/kernel/compat_wrapper.S    |    8 ++
 arch/s390/kernel/crash.c             |   17 ++++
 arch/s390/kernel/machine_kexec.c     |  131 +++++++++++++++++++++++++++++++++++
 arch/s390/kernel/relocate_kernel.S   |   83 ++++++++++++++++++++++
 arch/s390/kernel/relocate_kernel64.S |   84 ++++++++++++++++++++++
 arch/s390/kernel/syscalls.S          |    2 
 include/asm-s390/kexec.h             |   42 +++++++++++
 include/asm-s390/unistd.h            |    2 
 include/linux/kexec.h                |    1 
 11 files changed, 398 insertions(+), 2 deletions(-)
arch/s390/Kconfig +20 -0
diff -urN a/arch/s390/Kconfig b/arch/s390/Kconfig
@@ -455,6 +455,26 @@
 	  The HZ timer is switched off in idle by default. That means the
 	  HZ timer is already disabled at boot time.
 
+config KEXEC
+	bool "kexec system call (EXPERIMENTAL)"
+	depends on EXPERIMENTAL
+	help
+	  kexec is a system call that implements the ability to shutdown your
+	  current kernel, and to start another kernel.  It is like a reboot
+	  but it is indepedent of the system firmware.   And like a reboot
+	  you can start any kernel with it, not just Linux.
+	  
+	  The name comes from the similiarity to the exec system call.
+	  
+	  It is an ongoing process to be certain the hardware in a machine
+	  is properly shutdown, so do not be surprised if this code does not
+	  initially work for you.  It may help to enable device hotplugging
+	  support.  As of this writing the exact hardware interface is
+	  strongly in flux, so no good recommendation can be made.
+	  
+	  In the GAMECUBE implementation, kexec allows you to load and
+	  run DOL files, including kernel and homebrew DOLs.
+
 endmenu
 
 config PCMCIA
arch/s390/kernel/compat_wrapper.S +8 -0
diff -urN a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
@@ -1441,3 +1441,11 @@
 	lgfr	%r5,%r5			# int
 	llgtr	%r6,%r6			# struct rusage_emu31 *
 	jg	compat_sys_waitid
+
+	.globl	compat_sys_kexec_load_wrapper
+compat_sys_kexec_load_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# unsigned long
+	llgtr	%r4,%r4			# struct kexec_segment *
+	llgfr	%r5,%r5			# unsigned long
+	jg	compat_sys_kexec_load
arch/s390/kernel/crash.c +17 -0
diff -urN a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c
@@ -0,0 +1,17 @@
+/*
+ * arch/s390/kernel/crash.c
+ *
+ * (C) Copyright IBM Corp. 2005
+ *
+ * Author(s): Heiko Carstens <[email protected]>
+ *
+ */
+
+#include <linux/threads.h>
+#include <linux/kexec.h>
+
+note_buf_t crash_notes[NR_CPUS];
+
+void machine_crash_shutdown(void)
+{
+}
arch/s390/kernel/machine_kexec.c +131 -0

131 lines not on this page · raw message

arch/s390/kernel/Makefile +10 -0
diff -urN a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
@@ -25,6 +25,16 @@
 
 obj-$(CONFIG_VIRT_TIMER)	+= vtime.o
 
+# Kexec part
+S390_KEXEC_OBJS := machine_kexec.o crash.o
+ifeq ($(CONFIG_ARCH_S390X),y)
+S390_KEXEC_OBJS += relocate_kernel64.o
+else
+S390_KEXEC_OBJS += relocate_kernel.o
+endif
+obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
+
+
 #
 # This is just to get the dependencies...
 #
arch/s390/kernel/relocate_kernel64.S +84 -0

84 lines not on this page · raw message

arch/s390/kernel/relocate_kernel.S +83 -0

83 lines not on this page · raw message

arch/s390/kernel/syscalls.S +1 -1
diff -urN a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
@@ -285,7 +285,7 @@
 SYSCALL(sys_mq_timedreceive,sys_mq_timedreceive,compat_sys_mq_timedreceive_wrapper)
 SYSCALL(sys_mq_notify,sys_mq_notify,compat_sys_mq_notify_wrapper) /* 275 */
 SYSCALL(sys_mq_getsetattr,sys_mq_getsetattr,compat_sys_mq_getsetattr_wrapper)
-NI_SYSCALL							/* reserved for kexec */
+SYSCALL(sys_kexec_load,sys_kexec_load,compat_sys_kexec_load_wrapper)
 SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key_wrapper)
 SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper)
 SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl)		/* 280 */
include/asm-s390/kexec.h +42 -0

42 lines not on this page · raw message

include/asm-s390/unistd.h +1 -1
diff -urN a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
@@ -269,7 +269,7 @@
 #define __NR_mq_timedreceive	274
 #define __NR_mq_notify		275
 #define __NR_mq_getsetattr	276
-/* Number 277 is reserved for new sys_kexec_load */
+#define __NR_kexec_load		277
 #define __NR_add_key		278
 #define __NR_request_key	279
 #define __NR_keyctl		280
include/linux/kexec.h +1 -0
diff -urN a/include/linux/kexec.h b/include/linux/kexec.h
@@ -115,6 +115,7 @@
 #define KEXEC_ARCH_PPC     (20 << 16)
 #define KEXEC_ARCH_PPC64   (21 << 16)
 #define KEXEC_ARCH_IA_64   (50 << 16)
+#define KEXEC_ARCH_S390    (22 << 16)
 
 #define KEXEC_FLAGS    (KEXEC_ON_CRASH)  /* List of defined/legal kexec flags */