diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2021-07-21 21:58:03 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2021-07-27 10:39:21 +0300 |
commit | 251527c9b00c6d41565cfc05d17aa890ccb190e1 (patch) | |
tree | 019c17663dc65de1471e9a88aa5d020c35a00a04 | |
parent | 873129ca7b56c7b28dcf712b3bd50c08dc36b910 (diff) | |
download | linux-251527c9b00c6d41565cfc05d17aa890ccb190e1.tar.xz |
s390/hwcaps: open code initialization of first six hwcap bits
The first six hwcap bits are initialized in a rather odd way: an array
contains the stfl(e) bits which need to be set, so that the
corresponding bit position (= array index) within hwcaps are set.
Better open code it like it is done for all other bits, making it
obvious which bit is set when.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-rw-r--r-- | arch/s390/kernel/processor.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 7517e430b9e8..4beafae39d9d 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c @@ -182,9 +182,6 @@ static void show_cpu_summary(struct seq_file *m, void *v) */ static int __init setup_hwcaps(void) { - static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 }; - int i; - /* * The store facility list bits numbers as found in the principles * of operation are numbered with bit 1UL<<31 as number 0 to @@ -203,9 +200,30 @@ static int __init setup_hwcaps(void) * HWCAP_LDISP bit 4, HWCAP_EIMM bit 5 and * HWCAP_ETF3EH bit 8 (22 && 30). */ - for (i = 0; i < 6; i++) - if (test_facility(stfl_bits[i])) - elf_hwcap |= 1UL << i; + + /* instructions named N3, "backported" to esa-mode */ + if (test_facility(0)) + elf_hwcap |= HWCAP_ESAN3; + + /* z/Architecture mode active */ + if (test_facility(2)) + elf_hwcap |= HWCAP_ZARCH; + + /* store-facility-list-extended */ + if (test_facility(7)) + elf_hwcap |= HWCAP_STFLE; + + /* message-security assist */ + if (test_facility(17)) + elf_hwcap |= HWCAP_MSA; + + /* long-displacement */ + if (test_facility(19)) + elf_hwcap |= HWCAP_LDISP; + + /* extended-immediate */ + if (test_facility(21)) + elf_hwcap |= HWCAP_EIMM; if (test_facility(22) && test_facility(30)) elf_hwcap |= HWCAP_ETF3EH; |