diff mbox series

[3/3] virtio/pci: Use consistent naming for the PCI ISR bit flags

Message ID 20230912151623.2558794-4-keirf@google.com (mailing list archive)
State New, archived
Headers show
Series Fixes for virtio PCI interrupt handling | expand

Commit Message

Keir Fraser Sept. 12, 2023, 3:16 p.m. UTC
Avoid using VIRTIO_IRQ_{HIGH,LOW} which belong to a different
namespace.  Instead define VIRTIO_PCI_ISR_QUEUE as a logical extension
of the VIRTIO_PCI_ISR_* namespace. Since this bit flag is missing from
a header imported verbatim from Linux, define it directly in pci.c.

Signed-off-by: Keir Fraser <keirf@google.com>
---
 virtio/pci-legacy.c | 2 +-
 virtio/pci.c        | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/virtio/pci-legacy.c b/virtio/pci-legacy.c
index 5804796..02a8f8c 100644
--- a/virtio/pci-legacy.c
+++ b/virtio/pci-legacy.c
@@ -61,7 +61,7 @@  static bool virtio_pci__data_in(struct kvm_cpu *vcpu, struct virtio_device *vdev
 	case VIRTIO_PCI_ISR:
 		ioport__write8(data, vpci->isr);
 		kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_LOW);
-		vpci->isr = VIRTIO_IRQ_LOW;
+		vpci->isr = 0;
 		break;
 	default:
 		ret = virtio_pci__specific_data_in(kvm, vdev, data, size, offset);
diff --git a/virtio/pci.c b/virtio/pci.c
index 74bc9a4..8a34cec 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -14,6 +14,9 @@ 
 #include <assert.h>
 #include <string.h>
 
+/* The bit of the ISR which indicates a queue change. */
+#define VIRTIO_PCI_ISR_QUEUE	0x1
+
 int virtio_pci__add_msix_route(struct virtio_pci *vpci, u32 vec)
 {
 	int gsi;
@@ -239,7 +242,7 @@  int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
 		else
 			kvm__irq_trigger(kvm, vpci->gsis[vq]);
 	} else {
-		vpci->isr |= VIRTIO_IRQ_HIGH;
+		vpci->isr |= VIRTIO_PCI_ISR_QUEUE;
 		kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
 	}
 	return 0;