aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2005-08-02 00:11:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-02 00:37:59 -0400
commit5d3f229fcd4409d3e182b204defc122eb7833535 (patch)
tree89db475baaf74bde17eedd7421edbd299504fc16
parent4374ae10e5ef577d8fd73fdadcdb37149d8b3953 (diff)
[PATCH] s390: kexec fixes and improvements.
Disable pseudo page fault handling before starting the new kernel and try to use diag308 to reset the machine. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/s390/kernel/machine_kexec.c7
-rw-r--r--arch/s390/kernel/relocate_kernel.S41
-rw-r--r--arch/s390/kernel/relocate_kernel64.S45
-rw-r--r--arch/s390/kernel/smp.c6
-rw-r--r--arch/s390/kernel/traps.c15
5 files changed, 109 insertions, 5 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 2721c3a32b84..5aa71b05b8ae 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -70,6 +70,8 @@ machine_kexec(struct kimage *image)
70 for (;;); 70 for (;;);
71} 71}
72 72
73extern void pfault_fini(void);
74
73static void 75static void
74kexec_halt_all_cpus(void *kernel_image) 76kexec_halt_all_cpus(void *kernel_image)
75{ 77{
@@ -78,6 +80,11 @@ kexec_halt_all_cpus(void *kernel_image)
78 struct kimage *image; 80 struct kimage *image;
79 relocate_kernel_t data_mover; 81 relocate_kernel_t data_mover;
80 82
83#ifdef CONFIG_PFAULT
84 if (MACHINE_IS_VM)
85 pfault_fini();
86#endif
87
81 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) 88 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
82 signal_processor(smp_processor_id(), sigp_stop); 89 signal_processor(smp_processor_id(), sigp_stop);
83 90
diff --git a/arch/s390/kernel/relocate_kernel.S b/arch/s390/kernel/relocate_kernel.S
index d5e4a62fbb79..2a25ec7147ff 100644
--- a/arch/s390/kernel/relocate_kernel.S
+++ b/arch/s390/kernel/relocate_kernel.S
@@ -4,6 +4,7 @@
4 * (C) Copyright IBM Corp. 2005 4 * (C) Copyright IBM Corp. 2005
5 * 5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> 6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
7 * 8 *
8 */ 9 */
9 10
@@ -25,8 +26,31 @@
25 relocate_kernel: 26 relocate_kernel:
26 basr %r13,0 #base address 27 basr %r13,0 #base address
27 .base: 28 .base:
28 spx zero64-.base(%r13) #absolute addressing mode
29 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external) 29 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external)
30 spx zero64-.base(%r13) #absolute addressing mode
31 stctl %c0,%c15,ctlregs-.base(%r13)
32 stm %r0,%r15,gprregs-.base(%r13)
33 la %r1,load_psw-.base(%r13)
34 mvc 0(8,%r0),0(%r1)
35 la %r0,.back-.base(%r13)
36 st %r0,4(%r0)
37 oi 4(%r0),0x80
38 mvc 0x68(8,%r0),0(%r1)
39 la %r0,.back_pgm-.base(%r13)
40 st %r0,0x6c(%r0)
41 oi 0x6c(%r0),0x80
42 lhi %r0,0
43 diag %r0,%r0,0x308
44 .back:
45 basr %r13,0
46 .back_base:
47 oi have_diag308-.back_base(%r13),0x01
48 lctl %c0,%c15,ctlregs-.back_base(%r13)
49 lm %r0,%r15,gprregs-.back_base(%r13)
50 j .start_reloc
51 .back_pgm:
52 lm %r0,%r15,gprregs-.base(%r13)
53 .start_reloc:
30 lhi %r10,-1 #preparing the mask 54 lhi %r10,-1 #preparing the mask
31 sll %r10,12 #shift it such that it becomes 0xf000 55 sll %r10,12 #shift it such that it becomes 0xf000
32 .top: 56 .top:
@@ -63,6 +87,10 @@
63 o %r3,4(%r4) #or load address into psw 87 o %r3,4(%r4) #or load address into psw
64 st %r3,4(%r4) 88 st %r3,4(%r4)
65 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0 89 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0
90 tm have_diag308-.base(%r13),0x01
91 jno .no_diag308
92 diag %r0,%r0,0x308
93 .no_diag308:
66 sr %r1,%r1 #clear %r1 94 sr %r1,%r1 #clear %r1
67 sr %r2,%r2 #clear %r2 95 sr %r2,%r2 #clear %r2
68 sigp %r1,%r2,0x12 #set cpuid to zero 96 sigp %r1,%r2,0x12 #set cpuid to zero
@@ -75,6 +103,17 @@
75 .long 0x00080000,0x80000000 103 .long 0x00080000,0x80000000
76 sys_msk: 104 sys_msk:
77 .quad 0 105 .quad 0
106 ctlregs:
107 .rept 16
108 .long 0
109 .endr
110 gprregs:
111 .rept 16
112 .long 0
113 .endr
114 have_diag308:
115 .byte 0
116 .align 8
78 relocate_kernel_end: 117 relocate_kernel_end:
79 .globl relocate_kernel_len 118 .globl relocate_kernel_len
80 relocate_kernel_len: 119 relocate_kernel_len:
diff --git a/arch/s390/kernel/relocate_kernel64.S b/arch/s390/kernel/relocate_kernel64.S
index 96290cc4eb3c..8cdb86e8911f 100644
--- a/arch/s390/kernel/relocate_kernel64.S
+++ b/arch/s390/kernel/relocate_kernel64.S
@@ -4,6 +4,7 @@
4 * (C) Copyright IBM Corp. 2005 4 * (C) Copyright IBM Corp. 2005
5 * 5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> 6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
7 * 8 *
8 */ 9 */
9 10
@@ -26,8 +27,34 @@
26 relocate_kernel: 27 relocate_kernel:
27 basr %r13,0 #base address 28 basr %r13,0 #base address
28 .base: 29 .base:
30 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQs
29 spx zero64-.base(%r13) #absolute addressing mode 31 spx zero64-.base(%r13) #absolute addressing mode
30 stnsm sys_msk-.base(%r13),0xf8 #disable DAT and IRQ (external) 32 stctg %c0,%c15,ctlregs-.base(%r13)
33 stmg %r0,%r15,gprregs-.base(%r13)
34 lghi %r0,3
35 sllg %r0,%r0,31
36 stg %r0,0x1d0(%r0)
37 la %r0,.back_pgm-.base(%r13)
38 stg %r0,0x1d8(%r0)
39 la %r1,load_psw-.base(%r13)
40 mvc 0(8,%r0),0(%r1)
41 la %r0,.back-.base(%r13)
42 st %r0,4(%r0)
43 oi 4(%r0),0x80
44 lghi %r0,0
45 diag %r0,%r0,0x308
46 .back:
47 lhi %r1,1 #mode 1 = esame
48 sigp %r1,%r0,0x12 #switch to esame mode
49 sam64 #switch to 64 bit addressing mode
50 basr %r13,0
51 .back_base:
52 oi have_diag308-.back_base(%r13),0x01
53 lctlg %c0,%c15,ctlregs-.back_base(%r13)
54 lmg %r0,%r15,gprregs-.back_base(%r13)
55 j .top
56 .back_pgm:
57 lmg %r0,%r15,gprregs-.base(%r13)
31 .top: 58 .top:
32 lghi %r7,4096 #load PAGE_SIZE in r7 59 lghi %r7,4096 #load PAGE_SIZE in r7
33 lghi %r9,4096 #load PAGE_SIZE in r9 60 lghi %r9,4096 #load PAGE_SIZE in r9
@@ -62,6 +89,10 @@
62 o %r3,4(%r4) #or load address into psw 89 o %r3,4(%r4) #or load address into psw
63 st %r3,4(%r4) 90 st %r3,4(%r4)
64 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0 91 mvc 0(8,%r0),0(%r4) #copy psw to absolute address 0
92 tm have_diag308-.base(%r13),0x01
93 jno .no_diag308
94 diag %r0,%r0,0x308
95 .no_diag308:
65 sam31 #31 bit mode 96 sam31 #31 bit mode
66 sr %r1,%r1 #erase register r1 97 sr %r1,%r1 #erase register r1
67 sr %r2,%r2 #erase register r2 98 sr %r2,%r2 #erase register r2
@@ -75,8 +106,18 @@
75 .long 0x00080000,0x80000000 106 .long 0x00080000,0x80000000
76 sys_msk: 107 sys_msk:
77 .quad 0 108 .quad 0
109 ctlregs:
110 .rept 16
111 .quad 0
112 .endr
113 gprregs:
114 .rept 16
115 .quad 0
116 .endr
117 have_diag308:
118 .byte 0
119 .align 8
78 relocate_kernel_end: 120 relocate_kernel_end:
79 .globl relocate_kernel_len 121 .globl relocate_kernel_len
80 relocate_kernel_len: 122 relocate_kernel_len:
81 .quad relocate_kernel_end - relocate_kernel 123 .quad relocate_kernel_end - relocate_kernel
82
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index da77f001af8d..85222fee4361 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -537,7 +537,8 @@ int __devinit start_secondary(void *cpuvoid)
537#endif 537#endif
538#ifdef CONFIG_PFAULT 538#ifdef CONFIG_PFAULT
539 /* Enable pfault pseudo page faults on this cpu. */ 539 /* Enable pfault pseudo page faults on this cpu. */
540 pfault_init(); 540 if (MACHINE_IS_VM)
541 pfault_init();
541#endif 542#endif
542 /* Mark this cpu as online */ 543 /* Mark this cpu as online */
543 cpu_set(smp_processor_id(), cpu_online_map); 544 cpu_set(smp_processor_id(), cpu_online_map);
@@ -690,7 +691,8 @@ __cpu_disable(void)
690 691
691#ifdef CONFIG_PFAULT 692#ifdef CONFIG_PFAULT
692 /* Disable pfault pseudo page faults on this cpu. */ 693 /* Disable pfault pseudo page faults on this cpu. */
693 pfault_fini(); 694 if (MACHINE_IS_VM)
695 pfault_fini();
694#endif 696#endif
695 697
696 /* disable all external interrupts */ 698 /* disable all external interrupts */
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index bc7b7be7acbe..6b8703ec2ae6 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -29,6 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/kallsyms.h> 31#include <linux/kallsyms.h>
32#include <linux/reboot.h>
32 33
33#include <asm/system.h> 34#include <asm/system.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -675,6 +676,19 @@ asmlinkage void kernel_stack_overflow(struct pt_regs * regs)
675 panic("Corrupt kernel stack, can't continue."); 676 panic("Corrupt kernel stack, can't continue.");
676} 677}
677 678
679#ifndef CONFIG_ARCH_S390X
680static int
681pagex_reboot_event(struct notifier_block *this, unsigned long event, void *ptr)
682{
683 if (MACHINE_IS_VM)
684 cpcmd("SET PAGEX OFF", NULL, 0, NULL);
685 return NOTIFY_DONE;
686}
687
688static struct notifier_block pagex_reboot_notifier = {
689 .notifier_call = &pagex_reboot_event,
690};
691#endif
678 692
679/* init is done in lowcore.S and head.S */ 693/* init is done in lowcore.S and head.S */
680 694
@@ -735,6 +749,7 @@ void __init trap_init(void)
735 &ext_int_pfault); 749 &ext_int_pfault);
736#endif 750#endif
737#ifndef CONFIG_ARCH_S390X 751#ifndef CONFIG_ARCH_S390X
752 register_reboot_notifier(&pagex_reboot_notifier);
738 cpcmd("SET PAGEX ON", NULL, 0, NULL); 753 cpcmd("SET PAGEX ON", NULL, 0, NULL);
739#endif 754#endif
740 } 755 }