From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLh8d-0002sv-Ml for qemu-devel@nongnu.org; Wed, 02 Nov 2011 16:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLh8c-0000OX-JP for qemu-devel@nongnu.org; Wed, 02 Nov 2011 16:10:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLh8c-0000Nu-BX for qemu-devel@nongnu.org; Wed, 02 Nov 2011 16:10:18 -0400 Date: Wed, 2 Nov 2011 22:11:17 +0200 From: "Michael S. Tsirkin" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH (repost) RFC 1/2] virtio: ISR bit constants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anthony Liguori , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Jan Kiszka , Rusty Russell , Alexander Graf , virtualization@lists.linux-foundation.org, Blue Swirl , Stefan Weil , Avi Kivity , Richard Henderson Add constants for ISR bits values, and use them in virtio. Signed-off-by: Michael S. Tsirkin --- hw/virtio.c | 7 ++++--- hw/virtio.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 7011b5b..74627e4 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -672,7 +672,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, void virtio_irq(VirtQueue *vq) { trace_virtio_irq(vq); - vq->vdev->isr |= 0x01; + vq->vdev->isr |= VIRTIO_ISR_VQ; virtio_notify_vector(vq->vdev, vq->vector); } @@ -717,7 +717,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) } trace_virtio_notify(vdev, vq); - vdev->isr |= 0x01; + vdev->isr |= VIRTIO_ISR_VQ; virtio_notify_vector(vdev, vq->vector); } @@ -726,7 +726,8 @@ void virtio_notify_config(VirtIODevice *vdev) if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) return; - vdev->isr |= 0x03; + /* TODO: why do we set VIRTIO_ISR_VQ here? */ + vdev->isr |= VIRTIO_ISR_VQ | VIRTIO_ISR_CONFIG; virtio_notify_vector(vdev, vdev->config_vector); } diff --git a/hw/virtio.h b/hw/virtio.h index 2d18209..1bb6210 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -54,6 +54,11 @@ /* A guest should never accept this. It implies negotiation is broken. */ #define VIRTIO_F_BAD_FEATURE 30 +/* The bit of the ISR which indicates a device vq event. */ +#define VIRTIO_ISR_VQ 0x1 +/* The bit of the ISR which indicates a device configuration change. */ +#define VIRTIO_ISR_CONFIG 0x2 + /* from Linux's linux/virtio_ring.h */ /* This marks a buffer as continuing via the next field. */ -- 1.7.5.53.gc233e