Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/virtio viocon(4): New virtio tty driver imported fro...



details:   https://anonhg.NetBSD.org/src/rev/93496857deaa
branches:  trunk
changeset: 368901:93496857deaa
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Aug 12 11:15:40 2022 +0000

description:
viocon(4): New virtio tty driver imported from OpenBSD.

viocon* at virtio?

/dev/ttyVI??

Tested under qemu with:

qemu-system-aarch64 ... \
  -device virtio-serial \
  -chardev socket,path=/tmp/ttyVI00,server=on,wait=off,id=ttyVI00 \
  -device virtconsole,chardev=ttyVI00,name=org.NetBSD.dev.ttyVI00 \
  ...

I updated MAKEDEV.conf to create /dev/ttyVI?? on all ports where it
looks likely to work based on:
(a) having pci or a non-pci virtio attachment,
(b) `qemu-system-$ARCH -M ?' mentioned something resembling the port,
    and
(c) `qemu-system-$ARCH -device virtio-serial' launched without
    complaining about the virtio-serial device.

(Criterion (c) excluded sparc and sparc64.)

diffstat:

 distrib/sets/lists/man/mi    |    5 +-
 etc/MAKEDEV.tmpl             |   14 +-
 etc/etc.alpha/MAKEDEV.conf   |    3 +-
 etc/etc.amd64/MAKEDEV.conf   |    3 +-
 etc/etc.evbarm/MAKEDEV.conf  |    3 +-
 etc/etc.evbmips/MAKEDEV.conf |    3 +-
 etc/etc.evbppc/MAKEDEV.conf  |    3 +-
 etc/etc.hppa/MAKEDEV.conf    |    3 +-
 etc/etc.i386/MAKEDEV.conf    |    3 +-
 etc/etc.macppc/MAKEDEV.conf  |    3 +-
 share/man/man4/Makefile      |    4 +-
 share/man/man4/viocon.4      |   66 ++++
 sys/conf/majors              |    3 +-
 sys/dev/virtio/files.virtio  |    6 +-
 sys/dev/virtio/viocon.c      |  632 +++++++++++++++++++++++++++++++++++++++++++
 15 files changed, 740 insertions(+), 14 deletions(-)

diffs (truncated from 956 to 300 lines):

diff -r 92d561c6fcdc -r 93496857deaa distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Fri Aug 12 10:59:42 2022 +0000
+++ b/distrib/sets/lists/man/mi Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1752 2022/07/10 19:49:24 nia Exp $
+# $NetBSD: mi,v 1.1753 2022/08/12 11:15:40 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2047,6 +2047,7 @@
 ./usr/share/man/cat4/video.0                   man-sys-catman          .cat
 ./usr/share/man/cat4/vinum.0                   man-obsolete            obsolete
 ./usr/share/man/cat4/vio9p.0                   man-sys-catman          .cat
+./usr/share/man/cat4/viocon.0                  man-sys-catman          .cat
 ./usr/share/man/cat4/vioif.0                   man-sys-catman          .cat
 ./usr/share/man/cat4/viomb.0                   man-sys-catman          .cat
 ./usr/share/man/cat4/viornd.0                  man-sys-catman          .cat
@@ -5233,6 +5234,7 @@
 ./usr/share/man/html4/viaide.html              man-sys-htmlman         html
 ./usr/share/man/html4/video.html               man-sys-htmlman         html
 ./usr/share/man/html4/vio9p.html               man-sys-htmlman         html
+./usr/share/man/html4/viocon.html              man-sys-htmlman         html
 ./usr/share/man/html4/vioif.html               man-sys-htmlman         html
 ./usr/share/man/html4/viomb.html               man-sys-htmlman         html
 ./usr/share/man/html4/viornd.html              man-sys-htmlman         html
@@ -8351,6 +8353,7 @@
 ./usr/share/man/man4/video.4                   man-sys-man             .man
 ./usr/share/man/man4/vinum.4                   man-obsolete            obsolete
 ./usr/share/man/man4/vio9p.4                   man-sys-man             .man
+./usr/share/man/man4/viocon.4                  man-sys-man             .man
 ./usr/share/man/man4/vioif.4                   man-sys-man             .man
 ./usr/share/man/man4/viomb.4                   man-sys-man             .man
 ./usr/share/man/man4/viornd.4                  man-sys-man             .man
diff -r 92d561c6fcdc -r 93496857deaa etc/MAKEDEV.tmpl
--- a/etc/MAKEDEV.tmpl  Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/MAKEDEV.tmpl  Fri Aug 12 11:15:40 2022 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#      $NetBSD: MAKEDEV.tmpl,v 1.230 2022/05/17 11:41:41 uwe Exp $
+#      $NetBSD: MAKEDEV.tmpl,v 1.231 2022/08/12 11:15:40 riastradh Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -148,6 +148,7 @@
 #      dmz*    UNIBUS DMZ32 (vax)
 #      dl*     UNIBUS DL11 (vax)
 #      xencons Xen virtual console
+#      ttyVI?? viocon(4)
 #
 # Terminal multiplexors:
 #      dc*     4 channel serial interface (keyboard, mouse, modem, printer)
@@ -2272,6 +2273,17 @@
        mkdev scmd$unit c %scmd_chr% $unit 666
        ;;
 
+ttyVI[0-9][0-9])
+       port=${i#ttyVI?}
+       devunit=${i%$port}
+       unit=${devunit#ttyVI}
+       mkdev ttyVI$unit$port c %viocon_chr% $((16*$unit + $port))
+       ;;
+
+ttyVI)
+       makedev ttyVI00 ttyVI10 ttyVI20 ttyVI30
+       ;;
+
 midevend)
 %MI_DEVICES_END%
 local)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.alpha/MAKEDEV.conf
--- a/etc/etc.alpha/MAKEDEV.conf        Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.alpha/MAKEDEV.conf        Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.14 2020/04/05 14:09:17 jdolecek Exp $
+# $NetBSD: MAKEDEV.conf,v 1.15 2022/08/12 11:15:41 riastradh Exp $
 
 all_md)
        makedev wscons stic0 sd0 sd1 sd2 sd3 sd4
@@ -20,6 +20,7 @@
        makedev bktr
        makedev radio
        makedev kttcp
+       makedev ttyVI
        ;;
 
 minimal)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.amd64/MAKEDEV.conf
--- a/etc/etc.amd64/MAKEDEV.conf        Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.amd64/MAKEDEV.conf        Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.33 2021/07/24 11:39:18 jmcneill Exp $
+# $NetBSD: MAKEDEV.conf,v 1.34 2022/08/12 11:15:41 riastradh Exp $
 
 # As of 2003-04-17, the "init" case must not create more than 890 entries.
 all_md)
@@ -47,6 +47,7 @@
        makedev xmm0
        makedev acpi
        makedev smbios
+       makedev ttyVI
        ;;
 
 xen)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.evbarm/MAKEDEV.conf
--- a/etc/etc.evbarm/MAKEDEV.conf       Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.evbarm/MAKEDEV.conf       Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.22 2021/10/10 13:03:09 jmcneill Exp $
+# $NetBSD: MAKEDEV.conf,v 1.23 2022/08/12 11:15:41 riastradh Exp $
 
 all_md)
        makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3
@@ -28,6 +28,7 @@
        makedev bpf
        makedev openfirm
        makedev acpi smbios efi
+       makedev ttyVI
        ;;
 
 ramdisk|floppy)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.evbmips/MAKEDEV.conf
--- a/etc/etc.evbmips/MAKEDEV.conf      Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.evbmips/MAKEDEV.conf      Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.11 2020/07/24 12:07:09 jmcneill Exp $
+# $NetBSD: MAKEDEV.conf,v 1.12 2022/08/12 11:15:41 riastradh Exp $
 
 # When creating a /dev file system on MFS, init makes a FS that leaves
 # only 890 (or so) inodes free.  Therefore the "init" case (used by
@@ -36,6 +36,7 @@
        makedev iic0 iic1 iic2 iic3 iic4
        makedev kttcp
        makedev openfirm
+       makedev ttyVI
        ;;
 
 minimal)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.evbppc/MAKEDEV.conf
--- a/etc/etc.evbppc/MAKEDEV.conf       Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.evbppc/MAKEDEV.conf       Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.12 2020/11/10 11:22:22 rin Exp $
+# $NetBSD: MAKEDEV.conf,v 1.13 2022/08/12 11:15:41 riastradh Exp $
 
 all_md)
        makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1
@@ -23,6 +23,7 @@
        makedev kttcp
        makedev xlcom0
        makedev cfs
+       makedev ttyVI
        ;;
 
 # No bpf?
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.hppa/MAKEDEV.conf
--- a/etc/etc.hppa/MAKEDEV.conf Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.hppa/MAKEDEV.conf Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.2 2016/12/08 11:31:14 nat Exp $
+# $NetBSD: MAKEDEV.conf,v 1.3 2022/08/12 11:15:41 riastradh Exp $
 
 all_md)
        makedev wscons
@@ -12,4 +12,5 @@
        makedev pci0 pci1 pci2 pci3
        makedev raid0 raid1 raid2 raid3
        makedev sysmon
+       makedev ttyVI
        ;;
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.i386/MAKEDEV.conf
--- a/etc/etc.i386/MAKEDEV.conf Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.i386/MAKEDEV.conf Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.34 2021/07/24 11:39:19 jmcneill Exp $
+# $NetBSD: MAKEDEV.conf,v 1.35 2022/08/12 11:15:41 riastradh Exp $
 
 # As of 2005-03-15, the "init" case must not create more than 1024 entries.
 all_md)
@@ -51,6 +51,7 @@
        makedev cfs
        makedev acpi
        makedev smbios
+       makedev ttyVI
        ;;
 
 xen)
diff -r 92d561c6fcdc -r 93496857deaa etc/etc.macppc/MAKEDEV.conf
--- a/etc/etc.macppc/MAKEDEV.conf       Fri Aug 12 10:59:42 2022 +0000
+++ b/etc/etc.macppc/MAKEDEV.conf       Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.13 2020/04/05 14:36:43 sevan Exp $
+# $NetBSD: MAKEDEV.conf,v 1.14 2022/08/12 11:15:41 riastradh Exp $
 
 all_md)
        makedev wscons sd0 sd1 sd2 st0 st1 cd0 cd1 wd0 wd1 wd2 wd3
@@ -19,6 +19,7 @@
        makedev radio
        makedev kttcp
        makedev cfs
+       makedev ttyVI
        ;;
 
 floppy)
diff -r 92d561c6fcdc -r 93496857deaa share/man/man4/Makefile
--- a/share/man/man4/Makefile   Fri Aug 12 10:59:42 2022 +0000
+++ b/share/man/man4/Makefile   Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.727 2022/07/10 19:49:24 nia Exp $
+#      $NetBSD: Makefile,v 1.728 2022/08/12 11:15:41 riastradh Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -68,7 +68,7 @@
        uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 umb.4 \
        unix.4 userconf.4 \
        vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 \
-       vio9p.4 vioif.4 viomb.4 viornd.4 vioscsi.4 virt.4 virtio.4 \
+       vio9p.4 viocon.4 vioif.4 viomb.4 viornd.4 vioscsi.4 virt.4 virtio.4 \
        vether.4 vlan.4 vmmon.4 vmnet.4 vmt.4 vmx.4 vnd.4 voodoofb.4 vr.4 \
        vte.4 \
        wapbl.4 wb.4 wbsio.4 wd.4 wdc.4 wg.4 wi.4 wm.4 wpi.4 \
diff -r 92d561c6fcdc -r 93496857deaa share/man/man4/viocon.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/viocon.4   Fri Aug 12 11:15:40 2022 +0000
@@ -0,0 +1,66 @@
+.\"    $NetBSD: viocon.4,v 1.1 2022/08/12 11:15:41 riastradh Exp $
+.\"     $OpenBSD: viocon.4,v 1.3 2017/06/21 08:21:14 akfaew Exp $
+.\"
+.\" Copyright (c) 2015 Stefan Fritsch <sf%sfritsch.de@localhost>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: June 21 2017 $
+.Dt VIOCON 4
+.Os
+.Sh NAME
+.Nm viocon
+.Nd VirtIO console device
+.Sh SYNOPSIS
+.Cd "viocon* at virtio?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Xr virtio 4
+console interface provided by KVM, QEMU, and others.
+.Pp
+It provides serial ports that are attached as ttys.
+.Sh FILES
+.Bl -tag -width Pa -compact
+.It Pa /dev/ttyVI00
+.It Pa /dev/ttyVI10
+.It Pa /dev/ttyVI20
+.It Pa /dev/ttyVI30
+.It Pa /dev/ttyVI40
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr tty 4 ,
+.Xr virtio 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 5.9 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for
+.Ox
+by
+.An Stefan Fritsch Aq Mt sf%sfritsch.de@localhost .
+It was ported to
+.Nx 10.0 .
+.Sh BUGS
+Use as a kernel console for
+.Nx
+is not yet supported.
+.Pp
+The multiport feature is not yet supported.
diff -r 92d561c6fcdc -r 93496857deaa sys/conf/majors
--- a/sys/conf/majors   Fri Aug 12 10:59:42 2022 +0000
+++ b/sys/conf/majors   Fri Aug 12 11:15:40 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: majors,v 1.101 2021/12/07 17:39:54 brad Exp $
+# $NetBSD: majors,v 1.102 2022/08/12 11:15:42 riastradh Exp $
 #
 # Device majors for Machine-Independent drivers.
 #



Home | Main Index | Thread Index | Old Index