Lines Matching +full:- +full:- +full:enable +full:- +full:trace +full:- +full:backend
10 * the COPYING file in the top-level directory.
14 #include "chardev/char-fe.h"
15 #include "qemu/error-report.h"
17 #include "trace.h"
18 #include "hw/qdev-properties.h"
19 #include "hw/qdev-properties-system.h"
20 #include "hw/virtio/virtio-serial.h"
22 #include "qapi/qapi-events-char.h"
38 * Callback function that's called from chardevs when backend becomes
46 vcon->watch = 0; in chr_write_unblocked()
58 if (!qemu_chr_fe_backend_connected(&vcon->chr)) { in flush_buf()
59 /* If there's no backend, we can just say we consumed all data. */ in flush_buf()
63 ret = qemu_chr_fe_write(&vcon->chr, buf, len); in flush_buf()
64 trace_virtio_console_flush_buf(port->id, len, ret); in flush_buf()
70 * Ideally we'd get a better error code than just -1, but in flush_buf()
72 * we had a finer-grained message, like -EPIPE, we could close in flush_buf()
80 * console data on EAGAIN. The Linux virtio-console in flush_buf()
82 * so if we enable throttling that'll stall the entire in flush_buf()
92 * Linux virtio-console hvc driver to not hold spinlocks in flush_buf()
98 if (!k->is_console) { in flush_buf()
100 if (!vcon->watch) { in flush_buf()
101 vcon->watch = qemu_chr_fe_add_watch(&vcon->chr, in flush_buf()
117 if (!k->is_console) { in set_guest_connected()
118 qemu_chr_fe_set_open(&vcon->chr, guest_connected); in set_guest_connected()
121 if (dev->id) { in set_guest_connected()
122 qapi_event_send_vserport_change(dev->id, guest_connected); in set_guest_connected()
130 qemu_chr_fe_accept_input(&vcon->chr); in guest_writable()
147 trace_virtio_console_chr_read(port->id, size); in chr_read()
156 trace_virtio_console_chr_event(port->id, event); in chr_event()
162 if (vcon->watch) { in chr_event()
163 g_source_remove(vcon->watch); in chr_event()
164 vcon->watch = 0; in chr_event()
182 if (k->is_console) { in chr_be_change()
183 qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, in chr_be_change()
186 qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, in chr_be_change()
190 if (vcon->watch) { in chr_be_change()
191 g_source_remove(vcon->watch); in chr_be_change()
192 vcon->watch = qemu_chr_fe_add_watch(&vcon->chr, in chr_be_change()
200 static void virtconsole_enable_backend(VirtIOSerialPort *port, bool enable) in virtconsole_enable_backend() argument
204 if (!qemu_chr_fe_backend_connected(&vcon->chr)) { in virtconsole_enable_backend()
208 if (enable) { in virtconsole_enable_backend()
211 qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, in virtconsole_enable_backend()
212 k->is_console ? NULL : chr_event, in virtconsole_enable_backend()
215 qemu_chr_fe_set_handlers(&vcon->chr, NULL, NULL, NULL, in virtconsole_enable_backend()
226 if (port->id == 0 && !k->is_console) { in virtconsole_realize()
227 error_setg(errp, "Port number 0 on virtio-serial devices reserved " in virtconsole_realize()
232 if (qemu_chr_fe_backend_connected(&vcon->chr)) { in virtconsole_realize()
235 * because nothing is connected - we'll just let it go in virtconsole_realize()
236 * whetherever the chardev wants - /dev/null probably. in virtconsole_realize()
242 if (k->is_console) { in virtconsole_realize()
243 qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, in virtconsole_realize()
248 qemu_chr_fe_set_handlers(&vcon->chr, chr_can_read, chr_read, in virtconsole_realize()
259 if (vcon->watch) { in virtconsole_unrealize()
260 g_source_remove(vcon->watch); in virtconsole_unrealize()
268 k->is_console = true; in virtconsole_class_init()
286 k->realize = virtconsole_realize; in virtserialport_class_init()
287 k->unrealize = virtconsole_unrealize; in virtserialport_class_init()
288 k->have_data = flush_buf; in virtserialport_class_init()
289 k->set_guest_connected = set_guest_connected; in virtserialport_class_init()
290 k->enable_backend = virtconsole_enable_backend; in virtserialport_class_init()
291 k->guest_writable = guest_writable; in virtserialport_class_init()