提交 b8f05908 编写于 作者: M Michael S. Tsirkin

virtio: generation counter support

Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
上级 dfb8e184
...@@ -977,7 +977,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, ...@@ -977,7 +977,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
val = vdev->status; val = vdev->status;
break; break;
case VIRTIO_PCI_COMMON_CFGGENERATION: case VIRTIO_PCI_COMMON_CFGGENERATION:
val = 0; /* TODO */ val = vdev->generation;
break; break;
case VIRTIO_PCI_COMMON_Q_SELECT: case VIRTIO_PCI_COMMON_Q_SELECT:
val = vdev->queue_sel; val = vdev->queue_sel;
......
...@@ -930,6 +930,7 @@ void virtio_notify_config(VirtIODevice *vdev) ...@@ -930,6 +930,7 @@ void virtio_notify_config(VirtIODevice *vdev)
return; return;
vdev->isr |= 0x03; vdev->isr |= 0x03;
vdev->generation++;
virtio_notify_vector(vdev, vdev->config_vector); virtio_notify_vector(vdev, vdev->config_vector);
} }
......
...@@ -78,6 +78,7 @@ struct VirtIODevice ...@@ -78,6 +78,7 @@ struct VirtIODevice
size_t config_len; size_t config_len;
void *config; void *config;
uint16_t config_vector; uint16_t config_vector;
uint32_t generation;
int nvectors; int nvectors;
VirtQueue *vq; VirtQueue *vq;
uint16_t device_id; uint16_t device_id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册