sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg [Linux 4.14.129]

sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg [Linux 4.14.129]

This Linux kernel change "sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg" is included in the Linux 4.14.129 release. This change is authored by John Paul Adrian Glaubitz <glaubitz [at] physik.fu-berlin.de> on Tue Jun 11 17:38:37 2019 +0200. The commit for this change in Linux stable tree is 155656d (patch) which is from upstream commit 07a6d63. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 07a6d63.

sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg

[ Upstream commit 07a6d63eb1b54b5fb38092780fe618dfe1d96e23 ]

In d5a2aa24, the name in struct console sunhv_console was changed from "ttyS"
to "ttyHV" while the name in struct uart_ops sunhv_pops remained unchanged.

This results in the hypervisor console device to be listed as "ttyHV0" under
/proc/consoles while the device node is still named "ttyS0":

[email protected]:~# cat /proc/consoles
ttyHV0               -W- (EC p  )    4:64
tty0                 -WU (E     )    4:1
[email protected]:~# readlink /sys/dev/char/4:64
../../devices/root/f02836f0/f0285690/tty/ttyS0
[email protected]:~#

This means that any userland code which tries to determine the name of the
device file of the hypervisor console device can not rely on the information
provided by /proc/consoles. In particular, booting current versions of debian-
installer inside a SPARC LDOM will fail with the installer unable to determine
the console device.

After renaming the device in struct uart_ops sunhv_pops to "ttyHV" as well,
the inconsistency is fixed and it is possible again to determine the name
of the device file of the hypervisor console device by reading the contents
of /proc/console:

[email protected]:~# cat /proc/consoles
ttyHV0               -W- (EC p  )    4:64
tty0                 -WU (E     )    4:1
[email protected]:~# readlink /sys/dev/char/4:64
../../devices/root/f02836f0/f0285690/tty/ttyHV0
[email protected]:~#

With this change, debian-installer works correctly when installing inside
a SPARC LDOM.

Signed-off-by: John Paul Adrian Glaubitz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/tty/serial/sunhv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index 46e4689..84c4d83 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -396,7 +396,7 @@ static int sunhv_verify_port(struct uart_port *port, struct serial_struct *ser)
 static struct uart_driver sunhv_reg = {
    .owner          = THIS_MODULE,
    .driver_name        = "sunhv",
-   .dev_name       = "ttyS",
+   .dev_name       = "ttyHV",
    .major          = TTY_MAJOR,
 };

Leave a Reply

Your email address will not be published. Required fields are marked *