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