diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2010-10-25 10:10:51 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2010-10-25 10:10:21 -0400 |
commit | 14375bc4eb8dd0fb0e765390650564c35bb31068 (patch) | |
tree | 27200620658245c582ee9497fc969a082b304cab /arch/s390/kernel/early.c | |
parent | eca577ef5989d25dedc6b0fae3c4622ceaee8005 (diff) |
[S390] cleanup facility list handling
Store the facility list once at system startup with stfl/stfle and
reuse the result for all facility tests.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/early.c')
-rw-r--r-- | arch/s390/kernel/early.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 0badc6344eb4..d2455d44d99a 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -256,13 +256,35 @@ static noinline __init void setup_lowcore_early(void) | |||
256 | s390_base_pgm_handler_fn = early_pgm_check_handler; | 256 | s390_base_pgm_handler_fn = early_pgm_check_handler; |
257 | } | 257 | } |
258 | 258 | ||
259 | static noinline __init void setup_facility_list(void) | ||
260 | { | ||
261 | unsigned long nr; | ||
262 | |||
263 | S390_lowcore.stfl_fac_list = 0; | ||
264 | asm volatile( | ||
265 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ | ||
266 | "0:\n" | ||
267 | EX_TABLE(0b,0b) : "=m" (S390_lowcore.stfl_fac_list)); | ||
268 | memcpy(&S390_lowcore.stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); | ||
269 | nr = 4; /* # bytes stored by stfl */ | ||
270 | if (test_facility(7)) { | ||
271 | /* More facility bits available with stfle */ | ||
272 | register unsigned long reg0 asm("0") = MAX_FACILITY_BIT/64 - 1; | ||
273 | asm volatile(".insn s,0xb2b00000,%0" /* stfle */ | ||
274 | : "=m" (S390_lowcore.stfle_fac_list), "+d" (reg0) | ||
275 | : : "cc"); | ||
276 | nr = (reg0 + 1) * 8; /* # bytes stored by stfle */ | ||
277 | } | ||
278 | memset((char *) S390_lowcore.stfle_fac_list + nr, 0, | ||
279 | MAX_FACILITY_BIT/8 - nr); | ||
280 | } | ||
281 | |||
259 | static noinline __init void setup_hpage(void) | 282 | static noinline __init void setup_hpage(void) |
260 | { | 283 | { |
261 | #ifndef CONFIG_DEBUG_PAGEALLOC | 284 | #ifndef CONFIG_DEBUG_PAGEALLOC |
262 | unsigned int facilities; | 285 | unsigned int facilities; |
263 | 286 | ||
264 | facilities = stfl(); | 287 | if (!test_facility(2) || !test_facility(8)) |
265 | if (!(facilities & (1UL << 23)) || !(facilities & (1UL << 29))) | ||
266 | return; | 288 | return; |
267 | S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE; | 289 | S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE; |
268 | __ctl_set_bit(0, 23); | 290 | __ctl_set_bit(0, 23); |
@@ -356,18 +378,13 @@ static __init void detect_diag44(void) | |||
356 | static __init void detect_machine_facilities(void) | 378 | static __init void detect_machine_facilities(void) |
357 | { | 379 | { |
358 | #ifdef CONFIG_64BIT | 380 | #ifdef CONFIG_64BIT |
359 | unsigned int facilities; | 381 | if (test_facility(3)) |
360 | unsigned long long facility_bits; | ||
361 | |||
362 | facilities = stfl(); | ||
363 | if (facilities & (1 << 28)) | ||
364 | S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; | 382 | S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; |
365 | if (facilities & (1 << 23)) | 383 | if (test_facility(8)) |
366 | S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF; | 384 | S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF; |
367 | if (facilities & (1 << 4)) | 385 | if (test_facility(27)) |
368 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; | 386 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; |
369 | if ((stfle(&facility_bits, 1) > 0) && | 387 | if (test_facility(40)) |
370 | (facility_bits & (1ULL << (63 - 40)))) | ||
371 | S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; | 388 | S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; |
372 | #endif | 389 | #endif |
373 | } | 390 | } |
@@ -448,6 +465,7 @@ void __init startup_init(void) | |||
448 | lockdep_off(); | 465 | lockdep_off(); |
449 | sort_main_extable(); | 466 | sort_main_extable(); |
450 | setup_lowcore_early(); | 467 | setup_lowcore_early(); |
468 | setup_facility_list(); | ||
451 | detect_machine_type(); | 469 | detect_machine_type(); |
452 | ipl_update_parameters(); | 470 | ipl_update_parameters(); |
453 | setup_boot_command_line(); | 471 | setup_boot_command_line(); |