|
|
ae23c9 |
From 28648492db9520d5914ea20eaa8425aae3d1627d Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Pankaj Gupta <pagupta@redhat.com>
|
|
|
ae23c9 |
Date: Fri, 13 Jul 2018 12:52:28 +0200
|
|
|
ae23c9 |
Subject: [PATCH 216/268] virtio-rng: process pending requests on DRIVER_OK
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Pankaj Gupta <pagupta@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180713125228.14458-1-pagupta@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81347
|
|
|
ae23c9 |
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH] virtio-rng: process pending requests on DRIVER_OK
|
|
|
ae23c9 |
Bugzilla: 1576743
|
|
|
ae23c9 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
virtio-rng device causes old guest kernels(2.6.32) to hang on latest qemu.
|
|
|
ae23c9 |
The driver attempts to read from the virtio-rng device too early in it's
|
|
|
ae23c9 |
initialization. Qemu detects guest is not ready and returns, resulting in
|
|
|
ae23c9 |
hang.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
To fix handle pending requests when guest is running and driver status is
|
|
|
ae23c9 |
set to 'VIRTIO_CONFIG_S_DRIVER_OK'.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
CC: qemu-stable@nongnu.org
|
|
|
ae23c9 |
Reported-by: Sergio lopez <slopezpa@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 5d9c9ea22ab4f3b3ee497523e34b6f4d3281f62d)
|
|
|
ae23c9 |
Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
hw/virtio/virtio-rng.c | 14 ++++++++++++++
|
|
|
ae23c9 |
1 file changed, 14 insertions(+)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
|
|
|
ae23c9 |
index 289bbca..855f1b4 100644
|
|
|
ae23c9 |
--- a/hw/virtio/virtio-rng.c
|
|
|
ae23c9 |
+++ b/hw/virtio/virtio-rng.c
|
|
|
ae23c9 |
@@ -156,6 +156,19 @@ static void check_rate_limit(void *opaque)
|
|
|
ae23c9 |
vrng->activate_timer = true;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+static void virtio_rng_set_status(VirtIODevice *vdev, uint8_t status)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ VirtIORNG *vrng = VIRTIO_RNG(vdev);
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ if (!vdev->vm_running) {
|
|
|
ae23c9 |
+ return;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+ vdev->status = status;
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ /* Something changed, try to process buffers */
|
|
|
ae23c9 |
+ virtio_rng_process(vrng);
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
|
|
ae23c9 |
@@ -261,6 +274,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data)
|
|
|
ae23c9 |
vdc->realize = virtio_rng_device_realize;
|
|
|
ae23c9 |
vdc->unrealize = virtio_rng_device_unrealize;
|
|
|
ae23c9 |
vdc->get_features = get_features;
|
|
|
ae23c9 |
+ vdc->set_status = virtio_rng_set_status;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
static const TypeInfo virtio_rng_info = {
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|