From: Markus Armbruster <armbru@redhat.com>
To: Roman Penyaev <r.peniaev@gmail.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v9 2/4] chardev/char-hub: implement backend chardev aggregator
Date: Tue, 18 Feb 2025 08:54:52 +0100 [thread overview]
Message-ID: <87eczvhelv.fsf@pond.sub.org> (raw)
In-Reply-To: <20250123085327.965501-3-r.peniaev@gmail.com> (Roman Penyaev's message of "Thu, 23 Jan 2025 09:53:22 +0100")
Roman Penyaev <r.peniaev@gmail.com> writes:
> This patch implements a new chardev backend `hub` device, which
> aggregates input from multiple backend devices and forwards it to a
> single frontend device. Additionally, `hub` device takes the output
> from the frontend device and sends it back to all the connected
> backend devices. This allows for seamless interaction between
> different backend devices and a single frontend interface.
>
> The idea of the change is trivial: keep list of backend devices
> (up to 4), init them on demand and forward data buffer back and
> forth.
>
> The following is QEMU command line example:
>
> -chardev pty,path=/tmp/pty,id=pty0 \
> -chardev vc,id=vc0 \
> -chardev hub,id=hub0,chardevs.0=pty0,chardevs.1=vc0 \
> -device virtconsole,chardev=hub0 \
> -vnc 0.0.0.0:0
>
> Which creates 2 backend devices: text virtual console (`vc0`) and a
> pseudo TTY (`pty0`) connected to the single virtio hvc console with
> the backend aggregator (`hub0`) help. `vc0` renders text to an image,
> which can be shared over the VNC protocol. `pty0` is a pseudo TTY
> backend which provides biderectional communication to the virtio hvc
> console.
>
> 'chardevs.N' list syntax is used for the sake of compatibility with
> the representation of JSON lists in 'key=val' pairs format of the
> util/keyval.c, despite the fact that modern QAPI way of parsing,
> namely qobject_input_visitor_new_str(), is not used. Choice of keeping
> QAPI list syntax may help to smoothly switch to modern parsing in the
> future.
>
> Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
> Reviewed-by: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> Cc: qemu-devel@nongnu.org
[...]
> diff --git a/qapi/char.json b/qapi/char.json
> index e04535435034..f02b66c06b3e 100644
> --- a/qapi/char.json
> +++ b/qapi/char.json
> @@ -332,6 +332,19 @@
> 'data': { 'chardev': 'str' },
> 'base': 'ChardevCommon' }
>
> +##
> +# @ChardevHub:
> +#
> +# Configuration info for hub chardevs.
> +#
> +# @chardevs: List of chardev IDs, which should be added to this hub
Suggest "IDs to be added".
According to the commit message, there's a limit of four chardevs.
Better document that here.
> +#
> +# Since: 10.0
> +##
> +{ 'struct': 'ChardevHub',
> + 'data': { 'chardevs': ['str'] },
> + 'base': 'ChardevCommon' }
> +
> ##
> # @ChardevStdio:
> #
> @@ -479,6 +492,8 @@
> #
> # @mux: (since 1.5)
> #
> +# @hub: (since 10.0)
> +#
> # @msmouse: emulated Microsoft serial mouse (since 1.5)
> #
> # @wctablet: emulated Wacom Penpartner serial tablet (since 2.9)
> @@ -521,6 +536,7 @@
> 'pty',
> 'null',
> 'mux',
> + 'hub',
> 'msmouse',
> 'wctablet',
> { 'name': 'braille', 'if': 'CONFIG_BRLAPI' },
> @@ -595,6 +611,16 @@
> { 'struct': 'ChardevMuxWrapper',
> 'data': { 'data': 'ChardevMux' } }
>
> +##
> +# @ChardevHubWrapper:
> +#
> +# @data: Configuration info for hub chardevs
> +#
> +# Since: 10.0
> +##
> +{ 'struct': 'ChardevHubWrapper',
> + 'data': { 'data': 'ChardevHub' } }
> +
> ##
> # @ChardevStdioWrapper:
> #
> @@ -703,6 +729,7 @@
> 'pty': 'ChardevPtyWrapper',
> 'null': 'ChardevCommonWrapper',
> 'mux': 'ChardevMuxWrapper',
> + 'hub': 'ChardevHubWrapper',
> 'msmouse': 'ChardevCommonWrapper',
> 'wctablet': 'ChardevCommonWrapper',
> 'braille': { 'type': 'ChardevCommonWrapper',
With the doc nits addressed
Acked-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2025-02-18 7:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 8:53 [PATCH v9 0/4] chardev: implement backend chardev multiplexing Roman Penyaev
2025-01-23 8:53 ` [PATCH v9 1/4] chardev/char-pty: send CHR_EVENT_CLOSED on disconnect Roman Penyaev
2025-01-23 8:53 ` [PATCH v9 2/4] chardev/char-hub: implement backend chardev aggregator Roman Penyaev
2025-02-18 7:54 ` Markus Armbruster [this message]
2025-02-18 7:57 ` Markus Armbruster
2025-02-19 9:07 ` Roman Penyaev
2025-01-23 8:53 ` [PATCH v9 3/4] tests/unit/test-char: add unit tests for hub chardev backend Roman Penyaev
2025-01-23 8:53 ` [PATCH v9 4/4] qemu-options.hx: describe hub chardev and aggregation of several backends Roman Penyaev
2025-02-03 9:06 ` [PATCH v9 0/4] chardev: implement backend chardev multiplexing Roman Penyaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eczvhelv.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=r.peniaev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.