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 | |
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')
-rw-r--r-- | arch/s390/kernel/early.c | 40 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 19 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/topology.c | 5 | ||||
-rw-r--r-- | arch/s390/kernel/vdso.c | 6 |
5 files changed, 40 insertions, 32 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(); |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 9071e984dcf1..e3ceb911dc75 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -409,6 +409,9 @@ setup_lowcore(void) | |||
409 | lc->current_task = (unsigned long) init_thread_union.thread_info.task; | 409 | lc->current_task = (unsigned long) init_thread_union.thread_info.task; |
410 | lc->thread_info = (unsigned long) &init_thread_union; | 410 | lc->thread_info = (unsigned long) &init_thread_union; |
411 | lc->machine_flags = S390_lowcore.machine_flags; | 411 | lc->machine_flags = S390_lowcore.machine_flags; |
412 | lc->stfl_fac_list = S390_lowcore.stfl_fac_list; | ||
413 | memcpy(lc->stfle_fac_list, S390_lowcore.stfle_fac_list, | ||
414 | MAX_FACILITY_BIT/8); | ||
412 | #ifndef CONFIG_64BIT | 415 | #ifndef CONFIG_64BIT |
413 | if (MACHINE_HAS_IEEE) { | 416 | if (MACHINE_HAS_IEEE) { |
414 | lc->extended_save_area_addr = (__u32) | 417 | lc->extended_save_area_addr = (__u32) |
@@ -675,12 +678,9 @@ setup_memory(void) | |||
675 | static void __init setup_hwcaps(void) | 678 | static void __init setup_hwcaps(void) |
676 | { | 679 | { |
677 | static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 }; | 680 | static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 }; |
678 | unsigned long long facility_list_extended; | ||
679 | unsigned int facility_list; | ||
680 | struct cpuid cpu_id; | 681 | struct cpuid cpu_id; |
681 | int i; | 682 | int i; |
682 | 683 | ||
683 | facility_list = stfl(); | ||
684 | /* | 684 | /* |
685 | * The store facility list bits numbers as found in the principles | 685 | * The store facility list bits numbers as found in the principles |
686 | * of operation are numbered with bit 1UL<<31 as number 0 to | 686 | * of operation are numbered with bit 1UL<<31 as number 0 to |
@@ -700,11 +700,10 @@ static void __init setup_hwcaps(void) | |||
700 | * HWCAP_S390_ETF3EH bit 8 (22 && 30). | 700 | * HWCAP_S390_ETF3EH bit 8 (22 && 30). |
701 | */ | 701 | */ |
702 | for (i = 0; i < 6; i++) | 702 | for (i = 0; i < 6; i++) |
703 | if (facility_list & (1UL << (31 - stfl_bits[i]))) | 703 | if (test_facility(stfl_bits[i])) |
704 | elf_hwcap |= 1UL << i; | 704 | elf_hwcap |= 1UL << i; |
705 | 705 | ||
706 | if ((facility_list & (1UL << (31 - 22))) | 706 | if (test_facility(22) && test_facility(30)) |
707 | && (facility_list & (1UL << (31 - 30)))) | ||
708 | elf_hwcap |= HWCAP_S390_ETF3EH; | 707 | elf_hwcap |= HWCAP_S390_ETF3EH; |
709 | 708 | ||
710 | /* | 709 | /* |
@@ -720,12 +719,8 @@ static void __init setup_hwcaps(void) | |||
720 | * translated to: | 719 | * translated to: |
721 | * HWCAP_S390_DFP bit 6 (42 && 44). | 720 | * HWCAP_S390_DFP bit 6 (42 && 44). |
722 | */ | 721 | */ |
723 | if ((elf_hwcap & (1UL << 2)) && | 722 | if ((elf_hwcap & (1UL << 2)) && test_facility(42) && test_facility(44)) |
724 | __stfle(&facility_list_extended, 1) > 0) { | 723 | elf_hwcap |= HWCAP_S390_DFP; |
725 | if ((facility_list_extended & (1ULL << (63 - 42))) | ||
726 | && (facility_list_extended & (1ULL << (63 - 44)))) | ||
727 | elf_hwcap |= HWCAP_S390_DFP; | ||
728 | } | ||
729 | 724 | ||
730 | /* | 725 | /* |
731 | * Huge page support HWCAP_S390_HPAGE is bit 7. | 726 | * Huge page support HWCAP_S390_HPAGE is bit 7. |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 354589d096b1..94cf510b8fe1 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -594,6 +594,8 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
594 | cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce; | 594 | cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce; |
595 | cpu_lowcore->machine_flags = S390_lowcore.machine_flags; | 595 | cpu_lowcore->machine_flags = S390_lowcore.machine_flags; |
596 | cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func; | 596 | cpu_lowcore->ftrace_func = S390_lowcore.ftrace_func; |
597 | memcpy(cpu_lowcore->stfle_fac_list, S390_lowcore.stfle_fac_list, | ||
598 | MAX_FACILITY_BIT/8); | ||
597 | eieio(); | 599 | eieio(); |
598 | 600 | ||
599 | while (sigp(cpu, sigp_restart) == sigp_busy) | 601 | while (sigp(cpu, sigp_restart) == sigp_busy) |
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index eb0bc4752ae8..91fb66baa50b 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -351,13 +351,10 @@ static void alloc_masks(struct tl_info *info, struct mask_info *mask, int offset | |||
351 | 351 | ||
352 | void __init s390_init_cpu_topology(void) | 352 | void __init s390_init_cpu_topology(void) |
353 | { | 353 | { |
354 | unsigned long long facility_bits; | ||
355 | struct tl_info *info; | 354 | struct tl_info *info; |
356 | int i; | 355 | int i; |
357 | 356 | ||
358 | if (stfle(&facility_bits, 1) <= 0) | 357 | if (!test_facility(2) || !test_facility(11)) |
359 | return; | ||
360 | if (!(facility_bits & (1ULL << 52)) || !(facility_bits & (1ULL << 61))) | ||
361 | return; | 358 | return; |
362 | machine_has_topology = 1; | 359 | machine_has_topology = 1; |
363 | 360 | ||
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index 6b83870507d5..e3150dd2fe74 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c | |||
@@ -84,11 +84,7 @@ struct vdso_data *vdso_data = &vdso_data_store.data; | |||
84 | */ | 84 | */ |
85 | static void vdso_init_data(struct vdso_data *vd) | 85 | static void vdso_init_data(struct vdso_data *vd) |
86 | { | 86 | { |
87 | unsigned int facility_list; | 87 | vd->ectg_available = user_mode != HOME_SPACE_MODE && test_facility(31); |
88 | |||
89 | facility_list = stfl(); | ||
90 | vd->ectg_available = | ||
91 | user_mode != HOME_SPACE_MODE && (facility_list & 1); | ||
92 | } | 88 | } |
93 | 89 | ||
94 | #ifdef CONFIG_64BIT | 90 | #ifdef CONFIG_64BIT |