diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2012-11-13 03:26:37 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-11-23 05:14:31 -0500 |
commit | 991c15053a3fc209d76f03c73d4f0621025c9452 (patch) | |
tree | 6a21d71eba7e0e67521d54c914a11625685d7cba | |
parent | d1e57508fbd63b340788afe6f2c74a608603e714 (diff) |
s390: add zEC12 code generation support
Allow to generate code that only runs on zEC12 machines.
Also add a check which prevents the kernel to run on machines which
do not have any of the following new facilities installed:
- (48) decimal-floating-point zoned-conversion
- (49) execution-hint
- (49) load-and-trap
- (49) miscellaneous-instruction-extensions
- (49) processor-assist
- (50) constrained transactional-execution
- (73) transactional-execution
48, 49, 50 and 73 are the bit numbers of the facility indications for
each of the required facilities.
Note that we assume that user-space gets compiled with the same
compiler options, therefore we also test for a dfp facility even
if the kernel doesn't make use of it.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r-- | arch/s390/Kconfig | 11 | ||||
-rw-r--r-- | arch/s390/Makefile | 1 | ||||
-rw-r--r-- | arch/s390/kernel/head.S | 74 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 3 |
4 files changed, 59 insertions, 30 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index d385f396dfee..1bf4b294c6e9 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -169,6 +169,10 @@ config HAVE_MARCH_Z196_FEATURES | |||
169 | def_bool n | 169 | def_bool n |
170 | select HAVE_MARCH_Z10_FEATURES | 170 | select HAVE_MARCH_Z10_FEATURES |
171 | 171 | ||
172 | config HAVE_MARCH_ZEC12_FEATURES | ||
173 | def_bool n | ||
174 | select HAVE_MARCH_Z196_FEATURES | ||
175 | |||
172 | choice | 176 | choice |
173 | prompt "Processor type" | 177 | prompt "Processor type" |
174 | default MARCH_G5 | 178 | default MARCH_G5 |
@@ -220,6 +224,13 @@ config MARCH_Z196 | |||
220 | (2818 and 2817 series). The kernel will be slightly faster but will | 224 | (2818 and 2817 series). The kernel will be slightly faster but will |
221 | not work on older machines. | 225 | not work on older machines. |
222 | 226 | ||
227 | config MARCH_ZEC12 | ||
228 | bool "IBM zEC12" | ||
229 | select HAVE_MARCH_ZEC12_FEATURES if 64BIT | ||
230 | help | ||
231 | Select this to enable optimizations for IBM zEC12 (2827 series). The | ||
232 | kernel will be slightly faster but will not work on older machines. | ||
233 | |||
223 | endchoice | 234 | endchoice |
224 | 235 | ||
225 | config 64BIT | 236 | config 64BIT |
diff --git a/arch/s390/Makefile b/arch/s390/Makefile index 49e76e8b477d..4b8e08b56f49 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile | |||
@@ -41,6 +41,7 @@ cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990) | |||
41 | cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) | 41 | cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109) |
42 | cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10) | 42 | cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10) |
43 | cflags-$(CONFIG_MARCH_Z196) += $(call cc-option,-march=z196) | 43 | cflags-$(CONFIG_MARCH_Z196) += $(call cc-option,-march=z196) |
44 | cflags-$(CONFIG_MARCH_ZEC12) += $(call cc-option,-march=zEC12) | ||
44 | 45 | ||
45 | #KBUILD_IMAGE is necessary for make rpm | 46 | #KBUILD_IMAGE is necessary for make rpm |
46 | KBUILD_IMAGE :=arch/s390/boot/image | 47 | KBUILD_IMAGE :=arch/s390/boot/image |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index 984726cbce16..fd8db63dfc94 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
@@ -393,30 +393,35 @@ ENTRY(startup_kdump) | |||
393 | xc 0x300(256),0x300 | 393 | xc 0x300(256),0x300 |
394 | xc 0xe00(256),0xe00 | 394 | xc 0xe00(256),0xe00 |
395 | stck __LC_LAST_UPDATE_CLOCK | 395 | stck __LC_LAST_UPDATE_CLOCK |
396 | spt 5f-.LPG0(%r13) | 396 | spt 6f-.LPG0(%r13) |
397 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) | 397 | mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13) |
398 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | 398 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST |
399 | #ifndef CONFIG_MARCH_G5 | 399 | #ifndef CONFIG_MARCH_G5 |
400 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} | 400 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} |
401 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list | 401 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list |
402 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? | 402 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? |
403 | jz 0f | 403 | jz 0f |
404 | la %r0,0 | 404 | la %r0,1 |
405 | .insn s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended | 405 | .insn s,0xb2b00000,__LC_STFL_FAC_LIST # store facility list extended |
406 | 0: l %r0,__LC_STFL_FAC_LIST | 406 | # verify if all required facilities are supported by the machine |
407 | n %r0,2f+8-.LPG0(%r13) | 407 | 0: la %r1,__LC_STFL_FAC_LIST |
408 | cl %r0,2f+8-.LPG0(%r13) | 408 | la %r2,3f+8-.LPG0(%r13) |
409 | jne 1f | 409 | l %r3,0(%r2) |
410 | l %r0,__LC_STFL_FAC_LIST+4 | 410 | 1: l %r0,0(%r1) |
411 | n %r0,2f+12-.LPG0(%r13) | 411 | n %r0,4(%r2) |
412 | cl %r0,2f+12-.LPG0(%r13) | 412 | cl %r0,4(%r2) |
413 | je 3f | 413 | jne 2f |
414 | 1: l %r15,.Lstack-.LPG0(%r13) | 414 | la %r1,4(%r1) |
415 | la %r2,4(%r2) | ||
416 | ahi %r3,-1 | ||
417 | jnz 1b | ||
418 | j 4f | ||
419 | 2: l %r15,.Lstack-.LPG0(%r13) | ||
415 | ahi %r15,-96 | 420 | ahi %r15,-96 |
416 | la %r2,.Lals_string-.LPG0(%r13) | 421 | la %r2,.Lals_string-.LPG0(%r13) |
417 | l %r3,.Lsclp_print-.LPG0(%r13) | 422 | l %r3,.Lsclp_print-.LPG0(%r13) |
418 | basr %r14,%r3 | 423 | basr %r14,%r3 |
419 | lpsw 2f-.LPG0(%r13) # machine type not good enough, crash | 424 | lpsw 3f-.LPG0(%r13) # machine type not good enough, crash |
420 | .Lals_string: | 425 | .Lals_string: |
421 | .asciz "The Linux kernel requires more recent processor hardware" | 426 | .asciz "The Linux kernel requires more recent processor hardware" |
422 | .Lsclp_print: | 427 | .Lsclp_print: |
@@ -424,33 +429,42 @@ ENTRY(startup_kdump) | |||
424 | .Lstack: | 429 | .Lstack: |
425 | .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER)) | 430 | .long 0x8000 + (1<<(PAGE_SHIFT+THREAD_ORDER)) |
426 | .align 16 | 431 | .align 16 |
427 | 2: .long 0x000a0000,0x8badcccc | 432 | 3: .long 0x000a0000,0x8badcccc |
433 | |||
434 | # List of facilities that are required. If not all facilities are present | ||
435 | # the kernel will crash. Format is number of facility words with bits set, | ||
436 | # followed by the facility words. | ||
437 | |||
428 | #if defined(CONFIG_64BIT) | 438 | #if defined(CONFIG_64BIT) |
429 | #if defined(CONFIG_MARCH_Z196) | 439 | #if defined(CONFIG_MARCH_ZEC12) |
430 | .long 0xc100efe3, 0xf46c0000 | 440 | .long 3, 0xc100efe3, 0xf46ce000, 0x00400000 |
441 | #elif defined(CONFIG_MARCH_Z196) | ||
442 | .long 2, 0xc100efe3, 0xf46c0000 | ||
431 | #elif defined(CONFIG_MARCH_Z10) | 443 | #elif defined(CONFIG_MARCH_Z10) |
432 | .long 0xc100efe3, 0xf0680000 | 444 | .long 2, 0xc100efe3, 0xf0680000 |
433 | #elif defined(CONFIG_MARCH_Z9_109) | 445 | #elif defined(CONFIG_MARCH_Z9_109) |
434 | .long 0xc100efc3, 0x00000000 | 446 | .long 1, 0xc100efc3 |
435 | #elif defined(CONFIG_MARCH_Z990) | 447 | #elif defined(CONFIG_MARCH_Z990) |
436 | .long 0xc0002000, 0x00000000 | 448 | .long 1, 0xc0002000 |
437 | #elif defined(CONFIG_MARCH_Z900) | 449 | #elif defined(CONFIG_MARCH_Z900) |
438 | .long 0xc0000000, 0x00000000 | 450 | .long 1, 0xc0000000 |
439 | #endif | 451 | #endif |
440 | #else | 452 | #else |
441 | #if defined(CONFIG_MARCH_Z196) | 453 | #if defined(CONFIG_MARCH_ZEC12) |
442 | .long 0x8100c880, 0x00000000 | 454 | .long 1, 0x8100c880 |
455 | #elif defined(CONFIG_MARCH_Z196) | ||
456 | .long 1, 0x8100c880 | ||
443 | #elif defined(CONFIG_MARCH_Z10) | 457 | #elif defined(CONFIG_MARCH_Z10) |
444 | .long 0x8100c880, 0x00000000 | 458 | .long 1, 0x8100c880 |
445 | #elif defined(CONFIG_MARCH_Z9_109) | 459 | #elif defined(CONFIG_MARCH_Z9_109) |
446 | .long 0x8100c880, 0x00000000 | 460 | .long 1, 0x8100c880 |
447 | #elif defined(CONFIG_MARCH_Z990) | 461 | #elif defined(CONFIG_MARCH_Z990) |
448 | .long 0x80002000, 0x00000000 | 462 | .long 1, 0x80002000 |
449 | #elif defined(CONFIG_MARCH_Z900) | 463 | #elif defined(CONFIG_MARCH_Z900) |
450 | .long 0x80000000, 0x00000000 | 464 | .long 1, 0x80000000 |
451 | #endif | 465 | #endif |
452 | #endif | 466 | #endif |
453 | 3: | 467 | 4: |
454 | #endif | 468 | #endif |
455 | 469 | ||
456 | #ifdef CONFIG_64BIT | 470 | #ifdef CONFIG_64BIT |
@@ -459,14 +473,14 @@ ENTRY(startup_kdump) | |||
459 | jg startup_continue | 473 | jg startup_continue |
460 | #else | 474 | #else |
461 | /* Continue with 31bit startup code in head31.S */ | 475 | /* Continue with 31bit startup code in head31.S */ |
462 | l %r13,4f-.LPG0(%r13) | 476 | l %r13,5f-.LPG0(%r13) |
463 | b 0(%r13) | 477 | b 0(%r13) |
464 | .align 8 | 478 | .align 8 |
465 | 4: .long startup_continue | 479 | 5: .long startup_continue |
466 | #endif | 480 | #endif |
467 | 481 | ||
468 | .align 8 | 482 | .align 8 |
469 | 5: .long 0x7fffffff,0xffffffff | 483 | 6: .long 0x7fffffff,0xffffffff |
470 | 484 | ||
471 | #include "head_kdump.S" | 485 | #include "head_kdump.S" |
472 | 486 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index cfdad57957fe..2568590973ad 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -1006,6 +1006,9 @@ static void __init setup_hwcaps(void) | |||
1006 | case 0x2818: | 1006 | case 0x2818: |
1007 | strcpy(elf_platform, "z196"); | 1007 | strcpy(elf_platform, "z196"); |
1008 | break; | 1008 | break; |
1009 | case 0x2827: | ||
1010 | strcpy(elf_platform, "zEC12"); | ||
1011 | break; | ||
1009 | } | 1012 | } |
1010 | } | 1013 | } |
1011 | 1014 | ||