summaryrefslogtreecommitdiffstats
path: root/hw/virtio/virtio-rng.c
diff options
context:
space:
mode:
authorPeter Maydell2016-03-03 14:13:35 +0100
committerPeter Maydell2016-03-03 14:13:36 +0100
commit2d3b7c0164e1b9287304bc70dd6ed071ba3e8dfc (patch)
treea3b813016b49116b18a7e18c4f5021dd556c109c /hw/virtio/virtio-rng.c
parentMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' int... (diff)
parentvirtio-rng: ask for more data if queue is not fully drained (diff)
downloadqemu-2d3b7c0164e1b9287304bc70dd6ed071ba3e8dfc.tar.gz
qemu-2d3b7c0164e1b9287304bc70dd6ed071ba3e8dfc.tar.xz
qemu-2d3b7c0164e1b9287304bc70dd6ed071ba3e8dfc.zip
Merge remote-tracking branch 'remotes/amit-virtio-rng/tags/rng-for-2.6-1' into staging
rng: - implement a request queue for rng-random so multiple guest requests don't result in vq buffers getting forgotten - remove unused request cancellation code - a VM with multiple vq buffers, when migrated, could get in a situation where not all buffers are handed back to the guest. This is now fixed. # gpg: Signature made Thu 03 Mar 2016 12:18:54 GMT using RSA key ID 854083B6 # gpg: Good signature from "Amit Shah <amit@amitshah.net>" # gpg: aka "Amit Shah <amit@kernel.org>" # gpg: aka "Amit Shah <amitshah@gmx.net>" * remotes/amit-virtio-rng/tags/rng-for-2.6-1: virtio-rng: ask for more data if queue is not fully drained rng: add request queue support to rng-random rng: move request queue cleanup from RngEgd to RngBackend rng: move request queue from RngEgd to RngBackend rng: remove the unused request cancellation code MAINTAINERS: Add an entry for the include/sysemu/rng*.h files Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/virtio-rng.c')
-rw-r--r--hw/virtio/virtio-rng.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 17da2f8f3d..d7134646e2 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -69,6 +69,13 @@ static void chr_read(void *opaque, const void *buf, size_t size)
g_free(elem);
}
virtio_notify(vdev, vrng->vq);
+
+ if (!virtio_queue_empty(vrng->vq)) {
+ /* If we didn't drain the queue, call virtio_rng_process
+ * to take care of asking for more data as appropriate.
+ */
+ virtio_rng_process(vrng);
+ }
}
static void virtio_rng_process(VirtIORNG *vrng)