]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: kernel: Add processor type march=z10 and a processor type safety check. | |
3 | References: bnc#445100 | |
4 | ||
5 | Description: This patch adds the code generation option for IBM System z10 and | |
6 | adds a check in head[31,64].S to prevent the execution of a kernel | |
7 | compiled for a new processor type on an old machine. | |
8 | ||
9 | Acked-by: John Jolly <jjolly@suse.de> | |
10 | --- | |
11 | ||
12 | arch/s390/Kconfig | 8 +++++++ | |
13 | arch/s390/Makefile | 1 | |
14 | arch/s390/kernel/head.S | 49 ++++++++++++++++++++++++++++++++++++++++++++++ | |
15 | arch/s390/kernel/head31.S | 27 ++----------------------- | |
16 | arch/s390/kernel/head64.S | 23 --------------------- | |
17 | 5 files changed, 61 insertions(+), 47 deletions(-) | |
18 | ||
19 | --- a/arch/s390/Kconfig | |
20 | +++ b/arch/s390/Kconfig | |
21 | @@ -223,6 +223,14 @@ config MARCH_Z9_109 | |
22 | Class (z9 BC). The kernel will be slightly faster but will not | |
23 | work on older machines such as the z990, z890, z900, and z800. | |
24 | ||
25 | +config MARCH_Z10 | |
26 | + bool "IBM System z10" | |
27 | + help | |
28 | + Select this to enable optimizations for IBM System z10. The | |
29 | + kernel will be slightly faster but will not work on older | |
30 | + machines such as the z990, z890, z900, z800, z9-109, z9-ec | |
31 | + and z9-bc. | |
32 | + | |
33 | endchoice | |
34 | ||
35 | config PACK_STACK | |
36 | --- a/arch/s390/kernel/head31.S | |
37 | +++ b/arch/s390/kernel/head31.S | |
38 | @@ -10,34 +10,13 @@ | |
39 | * | |
40 | */ | |
41 | ||
42 | -# | |
43 | -# startup-code at 0x10000, running in absolute addressing mode | |
44 | -# this is called either by the ipl loader or directly by PSW restart | |
45 | -# or linload or SALIPL | |
46 | -# | |
47 | - .org 0x10000 | |
48 | -startup:basr %r13,0 # get base | |
49 | -.LPG0: l %r13,0f-.LPG0(%r13) | |
50 | - b 0(%r13) | |
51 | -0: .long startup_continue | |
52 | - | |
53 | -# | |
54 | -# params at 10400 (setup.h) | |
55 | -# | |
56 | - .org PARMAREA | |
57 | - .long 0,0 # IPL_DEVICE | |
58 | - .long 0,0 # INITRD_START | |
59 | - .long 0,0 # INITRD_SIZE | |
60 | - | |
61 | - .org COMMAND_LINE | |
62 | - .byte "root=/dev/ram0 ro" | |
63 | - .byte 0 | |
64 | - | |
65 | .org 0x11000 | |
66 | ||
67 | startup_continue: | |
68 | basr %r13,0 # get base | |
69 | -.LPG1: mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) | |
70 | +.LPG1: | |
71 | + | |
72 | + mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) | |
73 | lctl %c0,%c15,.Lctl-.LPG1(%r13) # load control registers | |
74 | l %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area | |
75 | # move IPL device to lowcore | |
76 | --- a/arch/s390/kernel/head64.S | |
77 | +++ b/arch/s390/kernel/head64.S | |
78 | @@ -10,29 +10,6 @@ | |
79 | * | |
80 | */ | |
81 | ||
82 | -# | |
83 | -# startup-code at 0x10000, running in absolute addressing mode | |
84 | -# this is called either by the ipl loader or directly by PSW restart | |
85 | -# or linload or SALIPL | |
86 | -# | |
87 | - .org 0x10000 | |
88 | -startup:basr %r13,0 # get base | |
89 | -.LPG0: l %r13,0f-.LPG0(%r13) | |
90 | - b 0(%r13) | |
91 | -0: .long startup_continue | |
92 | - | |
93 | -# | |
94 | -# params at 10400 (setup.h) | |
95 | -# | |
96 | - .org PARMAREA | |
97 | - .quad 0 # IPL_DEVICE | |
98 | - .quad 0 # INITRD_START | |
99 | - .quad 0 # INITRD_SIZE | |
100 | - | |
101 | - .org COMMAND_LINE | |
102 | - .byte "root=/dev/ram0 ro" | |
103 | - .byte 0 | |
104 | - | |
105 | .org 0x11000 | |
106 | ||
107 | startup_continue: | |
108 | --- a/arch/s390/kernel/head.S | |
109 | +++ b/arch/s390/kernel/head.S | |
110 | @@ -461,6 +461,55 @@ start: | |
111 | .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 | |
112 | .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff | |
113 | ||
114 | +# | |
115 | +# startup-code at 0x10000, running in absolute addressing mode | |
116 | +# this is called either by the ipl loader or directly by PSW restart | |
117 | +# or linload or SALIPL | |
118 | +# | |
119 | + .org 0x10000 | |
120 | +startup:basr %r13,0 # get base | |
121 | +.LPG0: | |
122 | + | |
123 | +#ifndef CONFIG_MARCH_G5 | |
124 | + # check processor version against MARCH_{G5,Z900,Z990,Z9_109,Z10} | |
125 | + stidp __LC_CPUID # store cpuid | |
126 | + lhi %r0,(3f-2f) / 2 | |
127 | + la %r1,2f-.LPG0(%r13) | |
128 | +0: clc __LC_CPUID+4(2),0(%r1) | |
129 | + jne 3f | |
130 | + lpsw 1f-.LPG0(13) # machine type not good enough, crash | |
131 | + .align 16 | |
132 | +1: .long 0x000a0000,0x00000000 | |
133 | +2: | |
134 | +#if defined(CONFIG_MARCH_Z10) | |
135 | + .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086, 0x2094, 0x2096 | |
136 | +#elif defined(CONFIG_MARCH_Z9_109) | |
137 | + .short 0x9672, 0x2064, 0x2066, 0x2084, 0x2086 | |
138 | +#elif defined(CONFIG_MARCH_Z990) | |
139 | + .short 0x9672, 0x2064, 0x2066 | |
140 | +#elif defined(CONFIG_MARCH_Z900) | |
141 | + .short 0x9672 | |
142 | +#endif | |
143 | +3: la %r1,2(%r1) | |
144 | + brct %r0,0b | |
145 | +#endif | |
146 | + | |
147 | + l %r13,0f-.LPG0(%r13) | |
148 | + b 0(%r13) | |
149 | +0: .long startup_continue | |
150 | + | |
151 | +# | |
152 | +# params at 10400 (setup.h) | |
153 | +# | |
154 | + .org PARMAREA | |
155 | + .long 0,0 # IPL_DEVICE | |
156 | + .long 0,0 # INITRD_START | |
157 | + .long 0,0 # INITRD_SIZE | |
158 | + | |
159 | + .org COMMAND_LINE | |
160 | + .byte "root=/dev/ram0 ro" | |
161 | + .byte 0 | |
162 | + | |
163 | #ifdef CONFIG_64BIT | |
164 | #include "head64.S" | |
165 | #else | |
166 | --- a/arch/s390/Makefile | |
167 | +++ b/arch/s390/Makefile | |
168 | @@ -34,6 +34,7 @@ cflags-$(CONFIG_MARCH_G5) += $(call cc | |
169 | cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900) | |
170 | cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990) | |
171 | cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) | |
172 | +cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10) | |
173 | ||
174 | #KBUILD_IMAGE is necessary for make rpm | |
175 | KBUILD_IMAGE :=arch/s390/boot/image |