From owner-dev-commits-src-branches@freebsd.org  Thu Aug 12 17:02:32 2021
Return-Path: <owner-dev-commits-src-branches@freebsd.org>
Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CB8D66F805;
 Thu, 12 Aug 2021 17:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4GltKN2HSBz3JQh;
 Thu, 12 Aug 2021 17:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:5])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 358A226AD0;
 Thu, 12 Aug 2021 17:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
 by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17CH2WMF018542;
 Thu, 12 Aug 2021 17:02:32 GMT (envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
 by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17CH2WWN018541;
 Thu, 12 Aug 2021 17:02:32 GMT (envelope-from git)
Date: Thu, 12 Aug 2021 17:02:32 GMT
Message-Id: <202108121702.17CH2WWN018541@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
 dev-commits-src-branches@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: e8b442c74c90 - stable/13 - bhyve: Split out a lower-level helper
 for VirtIO interrupts.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/stable/13
X-Git-Reftype: branch
X-Git-Commit: e8b442c74c903dfd020a83ebba7d1b3c2c281aba
Auto-Submitted: auto-generated
X-BeenThere: dev-commits-src-branches@freebsd.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Commits to the stable branches of the FreeBSD src repository
 <dev-commits-src-branches.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-branches>, 
 <mailto:dev-commits-src-branches-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-branches/>
List-Post: <mailto:dev-commits-src-branches@freebsd.org>
List-Help: <mailto:dev-commits-src-branches-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-branches>, 
 <mailto:dev-commits-src-branches-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Aug 2021 17:02:32 -0000

The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e8b442c74c903dfd020a83ebba7d1b3c2c281aba

commit e8b442c74c903dfd020a83ebba7d1b3c2c281aba
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-06-12 00:59:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-08-12 17:01:25 +0000

    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
    
    (cherry picked from commit c06676bee3d228ac18c5ed3604304e932eb84c1e)
---
 usr.sbin/bhyve/virtio.h | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h
index e03fd5f710d1..5b2cf6fe2cc8 100644
--- a/usr.sbin/bhyve/virtio.h
+++ b/usr.sbin/bhyve/virtio.h
@@ -332,24 +332,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)
 {