aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2010-07-07 13:34:22 +0100
committerKevin O'Connor <kevin@koconnor.net>2010-07-08 08:42:05 -0400
commit4e0daae583aeaac8e2a7fb25d02533bf40ecf29b (patch)
tree7953a958de7a4e914777895eeb9f91066fdca5f3
parentaf0963d3c5c0f255ffde1dbcb7a8bc68b79f86b2 (diff)
downloadseabios-hppa-4e0daae583aeaac8e2a7fb25d02533bf40ecf29b.zip
seabios-hppa-4e0daae583aeaac8e2a7fb25d02533bf40ecf29b.tar.gz
seabios-hppa-4e0daae583aeaac8e2a7fb25d02533bf40ecf29b.tar.bz2
virtio: Clear interrupt status register in virtio-blk
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>
-rw-r--r--src/virtio-blk.c6
-rw-r--r--src/virtio-pci.h4
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)
{