1 From: Gerald Schaefer <geraldsc@de.ibm.com>
2 Subject: kernel: Add processor type march=z10 and a processor type safety check.
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.
9 Acked-by: John Jolly <jjolly@suse.de>
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(-)
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.
26 + bool "IBM System z10"
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
36 --- a/arch/s390/kernel/head31.S
37 +++ b/arch/s390/kernel/head31.S
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
48 -startup:basr %r13,0 # get base
49 -.LPG0: l %r13,0f-.LPG0(%r13)
51 -0: .long startup_continue
54 -# params at 10400 (setup.h)
57 - .long 0,0 # IPL_DEVICE
58 - .long 0,0 # INITRD_START
59 - .long 0,0 # INITRD_SIZE
62 - .byte "root=/dev/ram0 ro"
68 basr %r13,0 # get base
69 -.LPG1: mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0)
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
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
88 -startup:basr %r13,0 # get base
89 -.LPG0: l %r13,0f-.LPG0(%r13)
91 -0: .long startup_continue
94 -# params at 10400 (setup.h)
97 - .quad 0 # IPL_DEVICE
98 - .quad 0 # INITRD_START
99 - .quad 0 # INITRD_SIZE
102 - .byte "root=/dev/ram0 ro"
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
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
120 +startup:basr %r13,0 # get base
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)
130 + lpsw 1f-.LPG0(13) # machine type not good enough, crash
132 +1: .long 0x000a0000,0x00000000
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)
147 + l %r13,0f-.LPG0(%r13)
149 +0: .long startup_continue
152 +# params at 10400 (setup.h)
155 + .long 0,0 # IPL_DEVICE
156 + .long 0,0 # INITRD_START
157 + .long 0,0 # INITRD_SIZE
160 + .byte "root=/dev/ram0 ro"
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)
174 #KBUILD_IMAGE is necessary for make rpm
175 KBUILD_IMAGE :=arch/s390/boot/image