diff options
author | John Baldwin <jhb@FreeBSD.org> | 2021-06-12 00:59:35 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2021-06-12 01:00:25 +0000 |
commit | c06676bee3d228ac18c5ed3604304e932eb84c1e (patch) | |
tree | 538308da5bfb4434cf2e6f09bc417717631cde7b | |
parent | 8794846a91c5429c612ba939c61ebf8f1ff1a628 (diff) | |
download | src-c06676bee3d228ac18c5ed3604304e932eb84c1e.tar.gz src-c06676bee3d228ac18c5ed3604304e932eb84c1e.zip |
bhyve: Split out a lower-level helper for VirtIO interrupts.
This allows device models to assert VirtIO interrupts for reasons
other than publishing changes to a VirtIO ring such as configuration
changes.
Reviewed by: grehan, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D30505
-rw-r--r-- | usr.sbin/bhyve/virtio.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index 4c7b9de83125..5731baa0dd0d 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -348,24 +348,35 @@ vq_has_descs(struct vqueue_info *vq) } /* - * Deliver an interrupt to guest on the given virtual queue - * (if possible, or a generic MSI interrupt if not using MSI-X). + * Deliver an interrupt to the guest for a specific MSI-X queue or + * event. */ static inline void -vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq) +vi_interrupt(struct virtio_softc *vs, uint8_t isr, uint16_t msix_idx) { if (pci_msix_enabled(vs->vs_pi)) - pci_generate_msix(vs->vs_pi, vq->vq_msix_idx); + pci_generate_msix(vs->vs_pi, msix_idx); else { VS_LOCK(vs); - vs->vs_isr |= VIRTIO_PCI_ISR_INTR; + vs->vs_isr |= isr; pci_generate_msi(vs->vs_pi, 0); pci_lintr_assert(vs->vs_pi); VS_UNLOCK(vs); } } +/* + * Deliver an interrupt to the guest on the given virtual queue (if + * possible, or a generic MSI interrupt if not using MSI-X). + */ +static inline void +vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq) +{ + + vi_interrupt(vs, VIRTIO_PCI_ISR_INTR, vq->vq_msix_idx); +} + static inline void vq_kick_enable(struct vqueue_info *vq) { |