qemu-patch-raspberry4/hw/char
Daniel P. Berrange bce6261eb2 virtio-console: set frontend open permanently for console devs
The virtio-console.c file handles both serial consoles
and interactive consoles, since they're backed by the
same device model.

Since serial devices are expected to be reliable and
need to notify the guest when the backend is opened
or closed, the virtio-console.c file wires up support
for chardev events. This affects both serial consoles
and interactive consoles, using a network connection
based chardev backend such as 'socket', but not when
using a PTY based backend or plain 'file' backends.

When the host side is not connected the handle_output()
method in virtio-serial-bus.c will drop any data sent
by the guest, before it even reaches the virtio-console.c
code. This means that if the chardev has a logfile
configured, the data will never get logged.

Consider for example, configuring a x86_64 guest with a
plain UART serial port

  -chardev socket,id=charserial1,host=127.0.0.1,port=9001,server,nowait,logfile=console1.log,logappend=on
  -device isa-serial,chardev=charserial1,id=serial1

vs a s390 guest which has to use the virtio-console port

  -chardev socket,id=charconsole1,host=127.0.0.1,port=9000,server,nowait,logfile=console2.log,logappend=on
  -device virtconsole,chardev=charconsole1,id=console1

The isa-serial one gets data written to the log regardless
of whether a client is connected, while the virtioconsole
one only gets data written to the log when a client is
connected.

There is no need for virtio-serial-bus.c to aggressively
drop the data for console devices, as the chardev code is
prefectly capable of discarding the data itself.

So this patch changes virtconsole devices so that they
are always marked as having the host side open. This
ensures that the guest OS will always send any data it
has (Linux virtio-console hvc driver actually ignores
the host open state and sends data regardless, but we
should not rely on that), and also prevents the
virtio-serial-bus code prematurely discarding data.

The behaviour of virtserialport devices is *not* changed,
only virtconsole, because for the former, it is important
that the guest OSknow exactly when the host side is opened
/ closed so it can do any protocol re-negotiation that may
be required.

Fixes bug: https://bugs.launchpad.net/qemu/+bug/1599214

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1470241360-3574-2-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-08-11 16:38:58 +05:30
..
bcm2835_aux.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
cadence_uart.c * serial port fixes (Paolo) 2016-06-29 19:14:48 +01:00
debugcon.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
digic-uart.c hw/char: QOM'ify digic-uart model 2016-06-06 16:59:31 +01:00
escc.c hw/char: QOM'ify escc.c (fix) 2016-06-06 18:57:06 +02:00
etraxfs_ser.c hw/char: QOM'ify etraxfs_ser.c 2016-05-29 09:11:10 +02:00
exynos4210_uart.c arm: Clean up includes 2016-01-29 15:07:23 +00:00
grlib_apbuart.c sparc: Clean up includes 2016-01-29 15:07:22 +00:00
imx_serial.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
ipoctal232.c ipack: Update e-mail address 2016-05-18 15:04:27 +03:00
lm32_juart.c hw/char: QOM'ify lm32_juart.c 2016-05-29 09:11:10 +02:00
lm32_uart.c hw/char: QOM'ify lm32_uart.c 2016-05-29 09:11:10 +02:00
Makefile.objs bcm2835_aux: add emulation of BCM2835 AUX (aka UART1) block 2016-03-16 17:42:18 +00:00
mcf_uart.c hw: Clean up includes 2016-01-29 15:07:25 +00:00
milkymist-uart.c milkymist: update specification URLs 2016-06-20 18:12:04 +02:00
omap_uart.c arm devices: Clean up includes 2016-01-29 15:07:25 +00:00
parallel.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
pl011.c hw/char: QOM'ify pl011 model 2016-06-06 16:59:31 +01:00
sclpconsole-lm.c hw/char: QOM'ify sclpconsole-lm.c 2016-05-17 15:50:29 +02:00
sclpconsole.c Use #include "..." for our own headers, <...> for others 2016-07-12 16:19:16 +02:00
serial-isa.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
serial-pci.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
serial.c serial: reinstate watch after migration 2016-06-29 14:03:47 +02:00
sh_serial.c hw: Clean up includes 2016-01-29 15:07:25 +00:00
spapr_vty.c hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
stm32f2xx_usart.c hw/char: QOM'ify stm32f2xx_usart model 2016-06-06 16:59:32 +01:00
trace-events trace: split out trace events for hw/char/ directory 2016-06-20 17:22:15 +01:00
virtio-console.c virtio-console: set frontend open permanently for console devs 2016-08-11 16:38:58 +05:30
virtio-serial-bus.c virtio-serial: Wrap in vmstate 2016-07-21 20:44:20 +03:00
xen_console.c os-posix: include sys/mman.h 2016-06-16 18:39:03 +02:00
xilinx_uartlite.c hw/char: QOM'ify xilinx_uartlite model 2016-06-06 16:59:32 +01:00