git: 8506352dd517 - stable/13 - bhyve: Pass a vCPU ID of 0 to vm_setup_pptdev_msi*.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 26 Jan 2023 22:34:54 UTC
The branch stable/13 has been updated by jhb:

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

commit 8506352dd517c0a6df4dac434929d4ee40ecc5f7
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-12-09 18:28:11 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 22:16:35 +0000

    bhyve: Pass a vCPU ID of 0 to vm_setup_pptdev_msi*.
    
    These ioctls are not vCPU-specific and the ioctl now ignores the vCPU
    ID.  0 is used instead of -1 to provide limited forwards
    compatibility.
    
    Reviewed by:    corvink, markj
    Differential Revision:  https://reviews.freebsd.org/D37651
    
    (cherry picked from commit 0857e5555d77357e34ea6d70b28ead6335e41d33)
---
 usr.sbin/bhyve/pci_passthru.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index 285874f3925d..65df3a0a162b 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -386,7 +386,7 @@ msix_table_read(struct passthru_softc *sc, uint64_t offset, int size)
 }
 
 static void
-msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc,
+msix_table_write(struct vmctx *ctx, struct passthru_softc *sc,
 		 uint64_t offset, int size, uint64_t data)
 {
 	struct pci_devinst *pi;
@@ -445,7 +445,7 @@ msix_table_write(struct vmctx *ctx, int vcpu, struct passthru_softc *sc,
 		/* If the entry is masked, don't set it up */
 		if ((entry->vector_control & PCIM_MSIX_VCTRL_MASK) == 0 ||
 		    (vector_control & PCIM_MSIX_VCTRL_MASK) == 0) {
-			(void)vm_setup_pptdev_msix(ctx, vcpu,
+			(void)vm_setup_pptdev_msix(ctx, 0,
 			    sc->psc_sel.pc_bus, sc->psc_sel.pc_dev,
 			    sc->psc_sel.pc_func, index, entry->addr,
 			    entry->msg_data, entry->vector_control);
@@ -955,7 +955,7 @@ passthru_cfgread(struct vmctx *ctx __unused, int vcpu __unused,
 }
 
 static int
-passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
+passthru_cfgwrite(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi,
 		  int coff, int bytes, uint32_t val)
 {
 	int error, msix_table_entries, i;
@@ -976,7 +976,7 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
 	if (msicap_access(sc, coff)) {
 		pci_emul_capwrite(pi, coff, bytes, val, sc->psc_msi.capoff,
 		    PCIY_MSI);
-		error = vm_setup_pptdev_msi(ctx, vcpu, sc->psc_sel.pc_bus,
+		error = vm_setup_pptdev_msi(ctx, 0, sc->psc_sel.pc_bus,
 			sc->psc_sel.pc_dev, sc->psc_sel.pc_func,
 			pi->pi_msi.addr, pi->pi_msi.msg_data,
 			pi->pi_msi.maxmsgnum);
@@ -991,7 +991,7 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
 		if (pi->pi_msix.enabled) {
 			msix_table_entries = pi->pi_msix.table_count;
 			for (i = 0; i < msix_table_entries; i++) {
-				error = vm_setup_pptdev_msix(ctx, vcpu,
+				error = vm_setup_pptdev_msix(ctx, 0,
 				    sc->psc_sel.pc_bus, sc->psc_sel.pc_dev,
 				    sc->psc_sel.pc_func, i,
 				    pi->pi_msix.table[i].addr,
@@ -1036,8 +1036,8 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
 }
 
 static void
-passthru_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx,
-	       uint64_t offset, int size, uint64_t value)
+passthru_write(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi,
+    int baridx, uint64_t offset, int size, uint64_t value)
 {
 	struct passthru_softc *sc;
 	struct pci_bar_ioreq pio;
@@ -1045,7 +1045,7 @@ passthru_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx,
 	sc = pi->pi_arg;
 
 	if (baridx == pci_msix_table_bar(pi)) {
-		msix_table_write(ctx, vcpu, sc, offset, size, value);
+		msix_table_write(ctx, sc, offset, size, value);
 	} else {
 		assert(pi->pi_bar[baridx].type == PCIBAR_IO);
 		assert(size == 1 || size == 2 || size == 4);