diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-08-11 13:26:35 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-08-11 13:26:35 +0100 |
commit | bea048dcb936816627301cb1744624eb79ac0488 (patch) | |
tree | 151603a6b38d03a06d25bc8792c84b516c342353 /hw | |
parent | 144a6db0b0eb444e2b0ffd5b8ceb39bebd89a078 (diff) | |
parent | bce6261eb2d879625126485d4ddd28cacb93152e (diff) | |
download | qemu-bea048dcb936816627301cb1744624eb79ac0488.zip qemu-bea048dcb936816627301cb1744624eb79ac0488.tar.gz qemu-bea048dcb936816627301cb1744624eb79ac0488.tar.bz2 |
Merge remote-tracking branch 'remotes/amit/tags/vser-for-2.7-1' into staging
virtio-console: fix receiving data from guest
# gpg: Signature made Thu 11 Aug 2016 12:17:55 BST
# gpg: using RSA key 0xEB0B4DFC657EF670
# gpg: Good signature from "Amit Shah <amit@amitshah.net>"
# gpg: aka "Amit Shah <amit@kernel.org>"
# gpg: aka "Amit Shah <amitshah@gmx.net>"
# Primary key fingerprint: 48CA 3722 5FE7 F4A8 B337 2735 1E9A 3B5F 8540 83B6
# Subkey fingerprint: CC63 D332 AB8F 4617 4529 6534 EB0B 4DFC 657E F670
* remotes/amit/tags/vser-for-2.7-1:
virtio-console: set frontend open permanently for console devs
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/char/virtio-console.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 2e36481..4f0e03d 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -85,8 +85,9 @@ static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) { VirtConsole *vcon = VIRTIO_CONSOLE(port); DeviceState *dev = DEVICE(port); + VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_GET_CLASS(port); - if (vcon->chr) { + if (vcon->chr && !k->is_console) { qemu_chr_fe_set_open(vcon->chr, guest_connected); } @@ -156,9 +157,25 @@ static void virtconsole_realize(DeviceState *dev, Error **errp) } if (vcon->chr) { - vcon->chr->explicit_fe_open = 1; - qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, - vcon); + /* + * For consoles we don't block guest data transfer just + * because nothing is connected - we'll just let it go + * whetherever the chardev wants - /dev/null probably. + * + * For serial ports we need 100% reliable data transfer + * so we use the opened/closed signals from chardev to + * trigger open/close of the device + */ + if (k->is_console) { + vcon->chr->explicit_fe_open = 0; + qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, + NULL, vcon); + virtio_serial_open(port); + } else { + vcon->chr->explicit_fe_open = 1; + qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, + chr_event, vcon); + } } } |