virtio: generation counter support

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
master
Michael S. Tsirkin 2015-06-04 12:34:23 +02:00
parent dfb8e184db
commit b8f059081d
3 changed files with 3 additions and 1 deletions

View File

@ -977,7 +977,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;

View File

@ -930,6 +930,7 @@ void virtio_notify_config(VirtIODevice *vdev)
return;
vdev->isr |= 0x03;
vdev->generation++;
virtio_notify_vector(vdev, vdev->config_vector);
}

View File

@ -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;