Skip to contentSkip to conversation

virtio/pci: Signal INTx interrupts as level instead of edge

PATCH Applied Marc Zyngier 4 participants 5 messages Jan 31, 2022 – Feb 16, 2022 KVM arm64

lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

PATCH 1/1 virtio/pci: Signal INTx interrupts as level instead of edge

It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level.

This doesn't change much for either the guest or userspace (only KVM will have a bit more work tracking the EOI), but at least this is correct.

---
 pci.c        | 2 +-
 virtio/pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
pci.c +1 -1
index e5930331..a769ae27 100644
@@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
 	pci_hdr->irq_line	= irq__alloc_line();
 
 	if (!pci_hdr->irq_type)
-		pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
+		pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
 
 	return pci_hdr->irq_line;
 }
virtio/pci.c +1 -1
index 41085291..2777d1c8 100644
@@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
 			kvm__irq_trigger(kvm, vpci->gsis[vq]);
 	} else {
 		vpci->isr = VIRTIO_IRQ_HIGH;
-		kvm__irq_trigger(kvm, vpci->legacy_irq_line);
+		kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
 	}
 	return 0;
 }
Signature · 6 lines
2.34.1

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Marc Zyngier

It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level.

This doesn't change much for either the guest or userspace (only KVM will have a bit more work tracking the EOI), but at least this is correct.

Quoted 5 lines
Quoted 32 lines
---
 pci.c        | 2 +-
 virtio/pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
pci.c +1 -1
index e5930331..a769ae27 100644
@@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
        pci_hdr->irq_line       = irq__alloc_line();
 
        if (!pci_hdr->irq_type)
-               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
+               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
 
        return pci_hdr->irq_line;
 }
virtio/pci.c +1 -2
index 41085291..2777d1c8 100644
@@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
                        kvm__irq_trigger(kvm, vpci->gsis[vq]);
        } else {
                vpci->isr = VIRTIO_IRQ_HIGH;
-               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
+               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
        }
        return 0;
 }
--
Quoted 2 lines

2.34.1

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

#2 lore raw
Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines · Marc Zyngier

It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level.

This doesn't change much for either the guest or userspace (only KVM will have a bit more work tracking the EOI), but at least this is correct.

Quoted 7 lines
Quoted 5 lines

Hi,
Just to confirm, I tried it and it was working well, Regards,
Pierre

Quoted 27 lines
Quoted 27 lines
---
  pci.c        | 2 +-
  virtio/pci.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
pci.c +1 -1
index e5930331..a769ae27 100644
@@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
         pci_hdr->irq_line       = irq__alloc_line();
 
         if (!pci_hdr->irq_type)
-               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
+               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
 
         return pci_hdr->irq_line;
  }
virtio/pci.c +0 -0
index 41085291..2777d1c8 100644
@@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
                         kvm__irq_trigger(kvm, vpci->gsis[vq]);
         } else {
                 vpci->isr = VIRTIO_IRQ_HIGH;
Quoted 8 lines
Quoted 8 lines
virtio/pci.c +1 -2
-               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
+               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
         }
         return 0;
  }
--

2.34.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
In reply to Ard Biesheuvel
Quoted 10 lines · Ard Biesheuvel
Quoted 9 lines · Marc Zyngier

It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level.

This doesn't change much for either the guest or userspace (only KVM will have a bit more work tracking the EOI), but at least this is correct.

Quoted 7 lines
Quoted 5 lines

Hi,
Just to confirm, I tried the patch and everything is working for me, Regards,
Pierre

Quoted 27 lines
Quoted 27 lines
---
  pci.c        | 2 +-
  virtio/pci.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
pci.c +1 -1
index e5930331..a769ae27 100644
@@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
         pci_hdr->irq_line       = irq__alloc_line();
 
         if (!pci_hdr->irq_type)
-               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
+               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
 
         return pci_hdr->irq_line;
  }
virtio/pci.c +0 -0
index 41085291..2777d1c8 100644
@@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
                         kvm__irq_trigger(kvm, vpci->gsis[vq]);
         } else {
                 vpci->isr = VIRTIO_IRQ_HIGH;
Quoted 8 lines
Quoted 8 lines
virtio/pci.c +1 -2
-               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
+               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
         }
         return 0;
  }
--

2.34.1

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Applied
#4 lore raw
In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level.

This doesn't change much for either the guest or userspace (only KVM will have a bit more work tracking the EOI), but at least this is correct.

[...]

Applied to kvmtool (master), thanks!

[1/1] virtio/pci: Signal INTx interrupts as level instead of edge

      https://git.kernel.org/will/kvmtool/c/2108c86d0623

Cheers,

Signature · 9 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm