Patchwork [4/6] virtio-serial: Call .guest_ready when new space is available in the queue.

login
register
mail settings
Submitter andrzej zaborowski
Date Jan. 9, 2012, 7:57 a.m.
Message ID <1326095876-31319-5-git-send-email-balrogg@gmail.com>
Download mbox | patch
Permalink /patch/135093/
State New
Headers show

Comments

andrzej zaborowski - Jan. 9, 2012, 7:57 a.m.
Without that it's impossible to write a virtio-serial port driver that
sends any buffers bigger than a couple kilobytes, other than by
polling to check when space in the queue becomes available.

Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
---
 hw/virtio-serial-bus.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 3a9004a..72bbe78 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -495,6 +495,14 @@  static void handle_output(VirtIODevice *vdev, VirtQueue *vq)
 
 static void handle_input(VirtIODevice *vdev, VirtQueue *vq)
 {
+    VirtIOSerial *vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
+    VirtIOSerialPort *port = find_port_by_vq(vser, vq);
+    VirtIOSerialPortInfo *info =
+        port ? DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info) : NULL;
+
+    if (info && info->guest_ready) {
+        info->guest_ready(port);
+    }
 }
 
 static uint32_t get_features(VirtIODevice *vdev, uint32_t features)