From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57888 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWlOr-0005jm-LH for qemu-devel@nongnu.org; Thu, 08 Jul 2010 03:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWlOq-0004Rw-DM for qemu-devel@nongnu.org; Thu, 08 Jul 2010 03:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10615) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWlOq-0004Rc-2D for qemu-devel@nongnu.org; Thu, 08 Jul 2010 03:20:00 -0400 Date: Thu, 8 Jul 2010 10:19:53 +0300 From: Gleb Natapov Message-ID: <20100708071953.GQ4689@redhat.com> References: <1278506062-4799-1-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1278506062-4799-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] Re: [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: seabios@seabios.org, qemu-devel@nongnu.org On Wed, Jul 07, 2010 at 01:34:22PM +0100, Stefan Hajnoczi wrote: > The VRING_AVAIL_F_NO_INTERRUPT flag is a hint that interrupts should be > suppressed. It does not guarantee that interrupts will not be raised. > Therefore, make sure to clear the interrupt after each virtio-blk read. > This avoids a stuck interrupt interfering with the OS loaded later in > the boot process. > > Signed-off-by: Stefan Hajnoczi Acked-by: Gleb Natapov > --- > src/virtio-blk.c | 6 ++++++ > src/virtio-pci.h | 4 ++++ > 2 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/src/virtio-blk.c b/src/virtio-blk.c > index 16d9ad8..74af488 100644 > --- a/src/virtio-blk.c > +++ b/src/virtio-blk.c > @@ -62,6 +62,12 @@ virtio_blk_read(struct disk_op_s *op) > > /* Reclaim virtqueue element */ > vring_get_buf(vq, NULL); > + > + /* Clear interrupt status register. Avoid leaving interrupts stuck if > + * VRING_AVAIL_F_NO_INTERRUPT was ignored and interrupts were raised. > + */ > + vp_get_isr(GET_GLOBAL(vdrive_g->ioaddr)); > + > return status == VIRTIO_BLK_S_OK ? DISK_RET_SUCCESS : DISK_RET_EBADTRACK; > } > > diff --git a/src/virtio-pci.h b/src/virtio-pci.h > index 9da761d..d21d5a5 100644 > --- a/src/virtio-pci.h > +++ b/src/virtio-pci.h > @@ -71,6 +71,10 @@ static inline void vp_set_status(unsigned int ioaddr, u8 status) > outb(status, ioaddr + VIRTIO_PCI_STATUS); > } > > +static inline u8 vp_get_isr(unsigned int ioaddr) > +{ > + return inb(ioaddr + VIRTIO_PCI_ISR); > +} > > static inline void vp_reset(unsigned int ioaddr) > { > -- > 1.7.1 -- Gleb.