From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z318D-0007Tf-2f for qemu-devel@nongnu.org; Thu, 11 Jun 2015 07:58:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z318C-0006Z5-7i for qemu-devel@nongnu.org; Thu, 11 Jun 2015 07:58:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z318C-0006Z0-3G for qemu-devel@nongnu.org; Thu, 11 Jun 2015 07:58:48 -0400 Date: Thu, 11 Jun 2015 13:58:45 +0200 From: "Michael S. Tsirkin" Message-ID: <1434023714-30366-15-git-send-email-mst@redhat.com> References: <1434023714-30366-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434023714-30366-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 14/42] virtio: generation counter support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin --- include/hw/virtio/virtio.h | 1 + hw/virtio/virtio-pci.c | 2 +- hw/virtio/virtio.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) 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; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 8fc3c4e..7805bdd 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -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; 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); } -- MST