s390/setup: fix novx parameter
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 14 Aug 2015 11:20:28 +0000 (13:20 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 19 Aug 2015 08:40:04 +0000 (10:40 +0200)
The novx parameter disables the vector facility but the HWCAP_S390_VXRS
bit in the ELf hardware capabilies is always set if the machine has
the vector facility. If the user space program uses the "vx" string
in the features field of /proc/cpuinfo to utilize vector instruction
it will crash if the novx kernel paramter is set.

Convert setup_hwcaps to an arch_initcall and use MACHINE_HAS_VX to
decide if the HWCAPS_S390_VXRS bit needs to be set.

Cc: stable@vger.kernel.org # 3.18+
Reported-by: Ulrich Weigand <uweigand@de.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/setup.c

index af6b0236ccf3207c59def49353e4a4fc2997c2ad..ce0cbd6ba7ca9e5a8ca4b0cf05b37ea2a1e5dcc0 100644 (file)
@@ -689,7 +689,7 @@ static void __init setup_memory(void)
 /*
  * Setup hardware capabilities.
  */
-static void __init setup_hwcaps(void)
+static int __init setup_hwcaps(void)
 {
        static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 };
        struct cpuid cpu_id;
@@ -755,9 +755,11 @@ static void __init setup_hwcaps(void)
                elf_hwcap |= HWCAP_S390_TE;
 
        /*
-        * Vector extension HWCAP_S390_VXRS is bit 11.
+        * Vector extension HWCAP_S390_VXRS is bit 11. The Vector extension
+        * can be disabled with the "novx" parameter. Use MACHINE_HAS_VX
+        * instead of facility bit 129.
         */
-       if (test_facility(129))
+       if (MACHINE_HAS_VX)
                elf_hwcap |= HWCAP_S390_VXRS;
        get_cpu_id(&cpu_id);
        add_device_randomness(&cpu_id, sizeof(cpu_id));
@@ -794,7 +796,9 @@ static void __init setup_hwcaps(void)
                strcpy(elf_platform, "z13");
                break;
        }
+       return 0;
 }
+arch_initcall(setup_hwcaps);
 
 /*
  * Add system information as device randomness
@@ -882,11 +886,6 @@ void __init setup_arch(char **cmdline_p)
         cpu_init();
        numa_setup();
 
-       /*
-        * Setup capabilities (ELF_HWCAP & ELF_PLATFORM).
-        */
-       setup_hwcaps();
-
        /*
         * Create kernel page tables and switch to virtual addressing.
         */
This page took 0.026262 seconds and 5 git commands to generate.