]> git.karo-electronics.de Git - linux-beck.git/commitdiff
s390/console: Make preferred console handling more consistent
authorPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
Thu, 7 Jul 2016 05:52:38 +0000 (07:52 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 13 Jul 2016 08:58:07 +0000 (10:58 +0200)
Use the same code structure when determining preferred consoles for
Linux running as KVM guest as with Linux running in LPAR and z/VM
guest:

 - Extend the console_mode variable to cover vt220 and hvc consoles
 - Determine sensible console defaults in conmode_default()
 - Remove KVM-special handling in set_preferred_console()

Ensure that the sclp line mode console is also registered when the
vt220 console was selected to not change existing behavior that
someone might be relying on.

As an externally visible change, KVM guest users can now select
the 3270 or 3215 console devices using the conmode= kernel parameter,
provided that support for the corresponding driver was compiled into
the kernel.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/setup.h
arch/s390/kernel/setup.c
drivers/s390/char/sclp_con.c

index c0f0efbb6ab5b43c6d503d600c376b30a130c296..5e8d57e1cc5ef19b685126341e83ad5335192dc5 100644 (file)
@@ -86,9 +86,13 @@ extern char vmpoff_cmd[];
 #define CONSOLE_IS_SCLP                (console_mode == 1)
 #define CONSOLE_IS_3215                (console_mode == 2)
 #define CONSOLE_IS_3270                (console_mode == 3)
+#define CONSOLE_IS_VT220       (console_mode == 4)
+#define CONSOLE_IS_HVC         (console_mode == 5)
 #define SET_CONSOLE_SCLP       do { console_mode = 1; } while (0)
 #define SET_CONSOLE_3215       do { console_mode = 2; } while (0)
 #define SET_CONSOLE_3270       do { console_mode = 3; } while (0)
+#define SET_CONSOLE_VT220      do { console_mode = 4; } while (0)
+#define SET_CONSOLE_HVC                do { console_mode = 5; } while (0)
 
 #define NSS_NAME_SIZE  8
 extern char kernel_nss_name[];
index 00e38f0c75dfc15d8594348b8908d35a3b7f75eb..ba5f456edaa9078261d3ce0b2572aa7eda5de843 100644 (file)
@@ -130,17 +130,14 @@ __setup("condev=", condev_setup);
 
 static void __init set_preferred_console(void)
 {
-       if (MACHINE_IS_KVM) {
-               if (sclp.has_vt220)
-                       add_preferred_console("ttyS", 1, NULL);
-               else if (sclp.has_linemode)
-                       add_preferred_console("ttyS", 0, NULL);
-               else
-                       add_preferred_console("hvc", 0, NULL);
-       } else if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP)
+       if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP)
                add_preferred_console("ttyS", 0, NULL);
        else if (CONSOLE_IS_3270)
                add_preferred_console("tty3270", 0, NULL);
+       else if (CONSOLE_IS_VT220)
+               add_preferred_console("ttyS", 1, NULL);
+       else if (CONSOLE_IS_HVC)
+               add_preferred_console("hvc", 0, NULL);
 }
 
 static int __init conmode_setup(char *str)
@@ -206,6 +203,15 @@ static void __init conmode_default(void)
                        SET_CONSOLE_SCLP;
 #endif
                }
+       } else if (MACHINE_IS_KVM) {
+               if (sclp.has_vt220 &&
+                   config_enabled(CONFIG_SCLP_VT220_CONSOLE))
+                       SET_CONSOLE_VT220;
+               else if (sclp.has_linemode &&
+                        config_enabled(CONFIG_SCLP_CONSOLE))
+                       SET_CONSOLE_SCLP;
+               else
+                       SET_CONSOLE_HVC;
        } else {
 #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
                SET_CONSOLE_SCLP;
index 5880def98fc1be4dbfedbfa166d725a52ffc35c2..6037bc87e767380695a0ebe09b0fcb78ee2d69ea 100644 (file)
@@ -319,7 +319,8 @@ sclp_console_init(void)
        int i;
        int rc;
 
-       if (!CONSOLE_IS_SCLP)
+       /* SCLP consoles are handled together */
+       if (!(CONSOLE_IS_SCLP || CONSOLE_IS_VT220))
                return 0;
        rc = sclp_rw_init();
        if (rc)