qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] chardev: implement backend chardev multiplexing
@ 2024-09-13 16:36 Roman Penyaev
  2024-09-13 16:36 ` [PATCH 1/2] " Roman Penyaev
  2024-09-13 16:36 ` [PATCH 2/2] qemu-options.hx: describe multiplexing of several backend devices Roman Penyaev
  0 siblings, 2 replies; 9+ messages in thread
From: Roman Penyaev @ 2024-09-13 16:36 UTC (permalink / raw)
  Cc: Roman Penyaev, Marc-André Lureau, Paolo Bonzini, qemu-devel

Mux is a character backend (host side) device, which multiplexes
multiple frontends with one backend device. The following is a
few lines from the QEMU manpage [1]:

  A multiplexer is a "1:N" device, and here the "1" end is your
  specified chardev backend, and the "N" end is the various parts
  of QEMU that can talk to a chardev.

But sadly multiple backends are not supported.

This work implements multiplexing capability of several backend
devices, which opens up an opportunity to use a single frontend
device on the guest, which can be manipulated from several
backend devices.

The main motivation of this work is to use a virtio console
frontend device on the guest, which can be manipulated from
several backend devices. The following is QEMU command line
example:

  -chardev socket,path=/tmp/sock,server=on,wait=off,id=sock0 \
  -chardev vc,id=vc0 \
  -chardev mux,id=mux0,chardev=vc0,,sock0 \
  -device virtconsole,chardev=mux0 \
  -vnc 0.0.0.0:0

Which creates 2 backend devices: text virtual console (`vc0`)
and a socket (`sock0`) connected to the single virtio hvc
console with the multiplexer (`mux0`) help. `vc0` renders
text to an image, which can be shared over the VNC protocol.
`sock0` is a socket backend which provides biderectional
communication to the virtio hvc console.

Once QEMU starts VNC client and any TTY emulator can be used to
control a single hvc console, for example these two different
consoles should have similar input and output due the buffer
multiplexing:

   # VNC client
   vncviewer :0

   # TTY emulator
   socat unix:connect:/tmp/sock pty,link=/tmp/pty
   tio /tmp/pty

[1] https://www.qemu.org/docs/master/system/qemu-manpage.html#hxtool-6

Roman Penyaev (2):
  chardev: implement backend chardev multiplexing
  qemu-options.hx: describe multiplexing of several backend devices

 chardev/char-fe.c          |  14 +++--
 chardev/char-mux.c         | 120 +++++++++++++++++++++++++++++--------
 chardev/char.c             |   2 +-
 chardev/chardev-internal.h |   7 ++-
 qemu-options.hx            |  44 ++++++++++++--
 5 files changed, 151 insertions(+), 36 deletions(-)

Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
-- 
2.34.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-09-18 12:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 16:36 [PATCH 0/2] chardev: implement backend chardev multiplexing Roman Penyaev
2024-09-13 16:36 ` [PATCH 1/2] " Roman Penyaev
2024-09-17 12:31   ` Marc-André Lureau
2024-09-17 12:40     ` Peter Maydell
2024-09-17 12:56       ` Peter Maydell
2024-09-17 14:15     ` Roman Penyaev
2024-09-18 10:52       ` Marc-André Lureau
2024-09-18 12:31         ` Roman Penyaev
2024-09-13 16:36 ` [PATCH 2/2] qemu-options.hx: describe multiplexing of several backend devices Roman Penyaev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).