* [Qemu-devel] [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk
@ 2010-07-07 12:34 Stefan Hajnoczi
2010-07-08 7:19 ` [Qemu-devel] " Gleb Natapov
2010-07-08 12:44 ` [Qemu-devel] " Kevin O'Connor
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2010-07-07 12:34 UTC (permalink / raw)
To: seabios; +Cc: qemu-devel, Gleb Natapov, Stefan Hajnoczi
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 <stefanha@linux.vnet.ibm.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk
2010-07-07 12:34 [Qemu-devel] [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk Stefan Hajnoczi
@ 2010-07-08 7:19 ` Gleb Natapov
2010-07-08 12:44 ` [Qemu-devel] " Kevin O'Connor
1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2010-07-08 7:19 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: seabios, qemu-devel
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 <stefanha@linux.vnet.ibm.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
> ---
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk
2010-07-07 12:34 [Qemu-devel] [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk Stefan Hajnoczi
2010-07-08 7:19 ` [Qemu-devel] " Gleb Natapov
@ 2010-07-08 12:44 ` Kevin O'Connor
1 sibling, 0 replies; 3+ messages in thread
From: Kevin O'Connor @ 2010-07-08 12:44 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: seabios, qemu-devel, Gleb Natapov
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 <stefanha@linux.vnet.ibm.com>
Thanks. Commit 4e0daae5.
-Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-08 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-07 12:34 [Qemu-devel] [SeaBIOS] [PATCH] virtio: Clear interrupt status register in virtio-blk Stefan Hajnoczi
2010-07-08 7:19 ` [Qemu-devel] " Gleb Natapov
2010-07-08 12:44 ` [Qemu-devel] " Kevin O'Connor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).