b66ed232 | 23-Jan-2025 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/char-hub: implement backend chardev aggregator
This patch implements a new chardev backend `hub` device, which aggregates input from multiple backend devices and forwards it to a single fron
chardev/char-hub: implement backend chardev aggregator
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 Message-ID: <20250123085327.965501-3-r.peniaev@gmail.com>
show more ...
|
3c8ab23f | 28-Aug-2024 |
Nicholas Piggin <npiggin@gmail.com> |
chardev: Remove __-prefixed names
Peter points out double underscore prefix names tend to be reserved for the system. Clean these up.
Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-o
chardev: Remove __-prefixed names
Peter points out double underscore prefix names tend to be reserved for the system. Clean these up.
Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240828043337.14587-3-npiggin@gmail.com>
show more ...
|
651b3862 | 28-Aug-2024 |
Nicholas Piggin <npiggin@gmail.com> |
chardev: Fix record/replay error path NULL deref in device creation
qemu_chardev_set_replay() was being called in chardev creation to set up replay parameters even if the chardev is NULL.
A segfaul
chardev: Fix record/replay error path NULL deref in device creation
qemu_chardev_set_replay() was being called in chardev creation to set up replay parameters even if the chardev is NULL.
A segfault can be reproduced by specifying '-serial chardev:bad' with an rr=record mode.
Fix this with a NULL pointer check.
Reported-by: Peter Maydell <peter.maydell@linaro.org> Resolves: Coverity CID 1559470 Fixes: 4c193bb129dae ("chardev: set record/replay on the base device of a muxed device") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240828043337.14587-2-npiggin@gmail.com>
show more ...
|
e6214fd6 | 29-Nov-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/char-mux: make boolean bit check instead of find_next_bit()
This patch simplifies (and makes less confusing) bit checks by replacing `find_next_bit()` calls with boolean AND operation.
Reso
chardev/char-mux: make boolean bit check instead of find_next_bit()
This patch simplifies (and makes less confusing) bit checks by replacing `find_next_bit()` calls with boolean AND operation.
Resolves: Coverity CID 1563776 Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Reviewed-by: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Clément Mathieu--Drif <clement.mathieu--drif@eviden.com> Cc: qemu-devel@nongnu.org Message-ID: <20241129103239.464061-3-r.peniaev@gmail.com>
show more ...
|
327993f1 | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/mux: implement detach of frontends from mux
With bitset management now it becomes feasible to implement the logic of detaching frontends from multiplexer.
Signed-off-by: Roman Penyaev <r.pe
chardev/mux: implement detach of frontends from mux
With bitset management now it becomes feasible to implement the logic of detaching frontends from multiplexer.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-8-r.peniaev@gmail.com>
show more ...
|
005b6d51 | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/mux: switch mux frontends management to bitset
Frontends can be attached and detached during run-time (although detach is not implemented, but will follow). Counter variable of muxes is not
chardev/mux: switch mux frontends management to bitset
Frontends can be attached and detached during run-time (although detach is not implemented, but will follow). Counter variable of muxes is not enough for proper attach/detach management, so this patch implements bitset: if bit is set for the `mux_bitset` variable, then frontend device can be found in the `backend` array (yes, huge confusion with backend and frontends names).
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-7-r.peniaev@gmail.com>
show more ...
|
709a4cab | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/mux: introduce `mux_chr_attach_frontend() call
Move away logic which attaches frontend device to a mux from `char-fe.c` to actual `char-mux.c` implementation and make it a separate function.
chardev/mux: introduce `mux_chr_attach_frontend() call
Move away logic which attaches frontend device to a mux from `char-fe.c` to actual `char-mux.c` implementation and make it a separate function.
No logic changes are made.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-6-r.peniaev@gmail.com>
show more ...
|
c64f0bc1 | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/mux: convert size members to unsigned int
There is no sense to keep `focus`, `mux_cnt`, `prod`, `cons` and `tag` variables as signed, those represent either size, either position in array, w
chardev/mux: convert size members to unsigned int
There is no sense to keep `focus`, `mux_cnt`, `prod`, `cons` and `tag` variables as signed, those represent either size, either position in array, which both are unsigned.
`focus` member of `MuxChardev` is kept signed, because initially set to -1.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-5-r.peniaev@gmail.com>
show more ...
|
1ba39940 | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/mux: use bool type for `linestart` and `term_got_escape`
Those are boolean variables, not signed integers.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcan
chardev/mux: use bool type for `linestart` and `term_got_escape`
Those are boolean variables, not signed integers.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-4-r.peniaev@gmail.com>
show more ...
|
58e5a3ae | 14-Oct-2024 |
Roman Penyaev <r.peniaev@gmail.com> |
chardev/chardev-internal: remove unused `max_size` struct member
Clean up forgotten leftovers.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.co
chardev/chardev-internal: remove unused `max_size` struct member
Clean up forgotten leftovers.
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20241014152408.427700-3-r.peniaev@gmail.com>
show more ...
|
b74cb876 | 06-Aug-2024 |
Octavian Purdila <tavip@google.com> |
chardev: add path option for pty backend
Add path option to the pty char backend which will create a symbolic link to the given path that points to the allocated PTY.
This avoids having to make QMP
chardev: add path option for pty backend
Add path option to the pty char backend which will create a symbolic link to the given path that points to the allocated PTY.
This avoids having to make QMP or HMP monitor queries to find out what the new PTY device path is.
Based on patch from Paulo Neves:
https://patchew.org/QEMU/1548509635-15776-1-git-send-email-ptsneves@gmail.com/
Tested with the following invocations that the link is created and removed when qemu stops:
qemu-system-x86_64 -nodefaults -mon chardev=compat_monitor \ -chardev pty,path=test,id=compat_monitor0
qemu-system-x86_64 -nodefaults -monitor pty:test
# check QMP invocation with path set qemu-system-x86_64 -nodefaults -qmp tcp:localhost:4444,server=on,wait=off nc localhost 4444 > {"execute": "qmp_capabilities"} > {"execute": "chardev-add", "arguments": {"id": "bar", "backend": { "type": "pty", "data": {"path": "test" }}}}
# check QMP invocation with path not set qemu-system-x86_64 -nodefaults -qmp tcp:localhost:4444,server=on,wait=off nc localhost 4444 > {"execute": "qmp_capabilities"} > {"execute": "chardev-add", "arguments": {"id": "bar", "backend": { "type": "pty", "data": {}}}}
Also tested that when a link path is not passed invocations still work, e.g.:
qemu-system-x86_64 -monitor pty
Co-authored-by: Paulo Neves <ptsneves@gmail.com> Signed-off-by: Paulo Neves <ptsneves@gmail.com> [OP: rebase and address original patch review comments] Signed-off-by: Octavian Purdila <tavip@google.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20240806010735.2450555-1-tavip@google.com>
show more ...
|