]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
s390/hwcaps: open code initialization of first six hwcap bits
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 21 Jul 2021 18:58:03 +0000 (20:58 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 27 Jul 2021 07:39:21 +0000 (09:39 +0200)
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>
arch/s390/kernel/processor.c

index 7517e430b9e83534830f5e10fa0bc0cbd907d027..4beafae39d9d9fcfd1f74989b6d850f4d704361a 100644 (file)
@@ -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;