]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
s390: allow overriding facilities via command line
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 27 Feb 2019 15:52:42 +0000 (16:52 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 1 Mar 2019 07:00:41 +0000 (08:00 +0100)
Add "facilities=" command line option which allows to override
facility bits returned by stfle. The main purpose of that is debugging
aids which allows to test specific kernel behaviour depending on
specific facilities presence. It also affects CPU alternatives.

"facilities=" command line option format is comma separated list of
integer values to be additionally set or cleared (if value is starting
with "!"). Values ranges are also supported. e.g.:

facilities=!130-160,159,167-169

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/boot/boot.h
arch/s390/boot/ipl_parm.c
arch/s390/boot/startup.c

index fc41e2277ea883ed2d9bd7e3edb4a339a343bedb..8665497fd33567faf032dc67edb765a8c420f291 100644 (file)
@@ -6,6 +6,7 @@ void startup_kernel(void);
 void detect_memory(void);
 void store_ipl_parmblock(void);
 void setup_boot_command_line(void);
+void parse_boot_command_line(void);
 void setup_memory_end(void);
 
 #endif /* BOOT_BOOT_H */
index 9dab596be98e0a20fac16d85ff12252e9012e4d3..94e5374c36305a8cf8cf1431f210c32a3832dfcf 100644 (file)
@@ -5,6 +5,7 @@
 #include <asm/sclp.h>
 #include <asm/sections.h>
 #include <asm/boot_data.h>
+#include <asm/facility.h>
 #include "boot.h"
 
 char __bootdata(early_command_line)[COMMAND_LINE_SIZE];
@@ -143,8 +144,51 @@ void setup_boot_command_line(void)
                append_ipl_block_parm();
 }
 
+static void modify_facility(unsigned long nr, bool clear)
+{
+       if (clear)
+               __clear_facility(nr, S390_lowcore.stfle_fac_list);
+       else
+               __set_facility(nr, S390_lowcore.stfle_fac_list);
+}
+
+static void modify_fac_list(char *str)
+{
+       unsigned long val, endval;
+       char *endp;
+       bool clear;
+
+       while (*str) {
+               clear = false;
+               if (*str == '!') {
+                       clear = true;
+                       str++;
+               }
+               val = simple_strtoull(str, &endp, 0);
+               if (str == endp)
+                       break;
+               str = endp;
+               if (*str == '-') {
+                       str++;
+                       endval = simple_strtoull(str, &endp, 0);
+                       if (str == endp)
+                               break;
+                       str = endp;
+                       while (val <= endval) {
+                               modify_facility(val, clear);
+                               val++;
+                       }
+               } else {
+                       modify_facility(val, clear);
+               }
+               if (*str != ',')
+                       break;
+               str++;
+       }
+}
+
 static char command_line_buf[COMMAND_LINE_SIZE] __section(.data);
-static void parse_mem_opt(void)
+void parse_boot_command_line(void)
 {
        char *param, *val;
        bool enabled;
@@ -165,12 +209,14 @@ static void parse_mem_opt(void)
                        if (!rc && !enabled)
                                noexec_disabled = 1;
                }
+
+               if (!strcmp(param, "facilities"))
+                       modify_fac_list(val);
        }
 }
 
 void setup_memory_end(void)
 {
-       parse_mem_opt();
 #ifdef CONFIG_CRASH_DUMP
        if (!OLDMEM_BASE && early_ipl_block_valid &&
            early_ipl_block.hdr.pbt == DIAG308_IPL_TYPE_FCP &&
index 4d441317cdebd821bbab40cd61021b0000a8b4df..bdfc5549a2998e649392896dd1fe53a03db9c3f6 100644 (file)
@@ -53,6 +53,7 @@ void startup_kernel(void)
        sclp_early_read_info();
        store_ipl_parmblock();
        setup_boot_command_line();
+       parse_boot_command_line();
        setup_memory_end();
        detect_memory();
        if (!IS_ENABLED(CONFIG_KERNEL_UNCOMPRESSED)) {