qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 14/33] virtio: generation counter support


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 14/33] virtio: generation counter support
Date: Thu, 4 Jun 2015 12:34:23 +0200

From: "Michael S. Tsirkin" <address@hidden>

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 hw/virtio/virtio-pci.c     | 2 +-
 hw/virtio/virtio.c         | 1 +
 include/hw/virtio/virtio.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 7bd31d9..c8c2b46 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -970,7 +970,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr 
addr,
         val = vdev->status;
         break;
     case VIRTIO_PCI_COMMON_CFGGENERATION:
-        val = 0; /* TODO */
+        val = vdev->generation;
         break;
     case VIRTIO_PCI_COMMON_Q_SELECT:
         val = vdev->queue_sel;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 8a6ebae..cae5eca 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -930,6 +930,7 @@ void virtio_notify_config(VirtIODevice *vdev)
         return;
 
     vdev->isr |= 0x03;
+    vdev->generation++;
     virtio_notify_vector(vdev, vdev->config_vector);
 }
 
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index df89913..b9e36f9 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -78,6 +78,7 @@ struct VirtIODevice
     size_t config_len;
     void *config;
     uint16_t config_vector;
+    uint32_t generation;
     int nvectors;
     VirtQueue *vq;
     uint16_t device_id;
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]