diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -2197,7 +2197,7 @@ } static void -pci_ahci_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_ahci_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -2292,7 +2292,7 @@ } static uint64_t -pci_ahci_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_ahci_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t regoff, int size) { struct pci_ahci_softc *sc = pi->pi_arg; diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -2112,7 +2112,7 @@ } static void -e82545_write(struct vmctx *ctx __unused, int vcpu __unused, +e82545_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -2163,7 +2163,7 @@ } static uint64_t -e82545_read(struct vmctx *ctx __unused, int vcpu __unused, +e82545_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct e82545_softc *sc; diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -63,18 +63,18 @@ void (*pe_write_dsdt)(struct pci_devinst *); /* config space read/write callbacks */ - int (*pe_cfgwrite)(struct vmctx *ctx, int vcpu, + int (*pe_cfgwrite)(struct vmctx *ctx, struct pci_devinst *pi, int offset, int bytes, uint32_t val); - int (*pe_cfgread)(struct vmctx *ctx, int vcpu, + int (*pe_cfgread)(struct vmctx *ctx, struct pci_devinst *pi, int offset, int bytes, uint32_t *retval); /* BAR read/write callbacks */ - void (*pe_barwrite)(struct vmctx *ctx, int vcpu, + void (*pe_barwrite)(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value); - uint64_t (*pe_barread)(struct vmctx *ctx, int vcpu, + uint64_t (*pe_barread)(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size); diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -140,7 +140,7 @@ static struct pci_devemu *pci_emul_finddev(const char *name); static void pci_lintr_route(struct pci_devinst *pi); static void pci_lintr_update(struct pci_devinst *pi); -static void pci_cfgrw(struct vmctx *ctx, int vcpu, int in, int bus, int slot, +static void pci_cfgrw(struct vmctx *ctx, int in, int bus, int slot, int func, int coff, int bytes, uint32_t *val); static __inline void @@ -447,8 +447,8 @@ } static int -pci_emul_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, - uint32_t *eax, void *arg) +pci_emul_io_handler(struct vmctx *ctx, int vcpu __unused, int in, int port, + int bytes, uint32_t *eax, void *arg) { struct pci_devinst *pdi = arg; struct pci_devemu *pe = pdi->pi_d; @@ -464,10 +464,10 @@ pdi->pi_bar[i].addr + pdi->pi_bar[i].size) { offset = port - pdi->pi_bar[i].addr; if (in) - *eax = (*pe->pe_barread)(ctx, vcpu, pdi, i, + *eax = (*pe->pe_barread)(ctx, pdi, i, offset, bytes); else - (*pe->pe_barwrite)(ctx, vcpu, pdi, i, offset, + (*pe->pe_barwrite)(ctx, pdi, i, offset, bytes, *eax); return (0); } @@ -476,8 +476,8 @@ } static int -pci_emul_mem_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr, - int size, uint64_t *val, void *arg1, long arg2) +pci_emul_mem_handler(struct vmctx *ctx, int vcpu __unused, int dir, + uint64_t addr, int size, uint64_t *val, void *arg1, long arg2) { struct pci_devinst *pdi = arg1; struct pci_devemu *pe = pdi->pi_d; @@ -494,22 +494,22 @@ if (dir == MEM_F_WRITE) { if (size == 8) { - (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset, + (*pe->pe_barwrite)(ctx, pdi, bidx, offset, 4, *val & 0xffffffff); - (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset + 4, + (*pe->pe_barwrite)(ctx, pdi, bidx, offset + 4, 4, *val >> 32); } else { - (*pe->pe_barwrite)(ctx, vcpu, pdi, bidx, offset, + (*pe->pe_barwrite)(ctx, pdi, bidx, offset, size, *val); } } else { if (size == 8) { - *val = (*pe->pe_barread)(ctx, vcpu, pdi, bidx, + *val = (*pe->pe_barread)(ctx, pdi, bidx, offset, 4); - *val |= (*pe->pe_barread)(ctx, vcpu, pdi, bidx, + *val |= (*pe->pe_barread)(ctx, pdi, bidx, offset + 4, 4) << 32; } else { - *val = (*pe->pe_barread)(ctx, vcpu, pdi, bidx, + *val = (*pe->pe_barread)(ctx, pdi, bidx, offset, size); } } @@ -1294,8 +1294,9 @@ } static int -pci_emul_ecfg_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr, - int bytes, uint64_t *val, void *arg1 __unused, long arg2 __unused) +pci_emul_ecfg_handler(struct vmctx *ctx, int vcpu __unused, int dir, + uint64_t addr, int bytes, uint64_t *val, void *arg1 __unused, + long arg2 __unused) { int bus, slot, func, coff, in; @@ -1306,7 +1307,7 @@ in = (dir == MEM_F_READ); if (in) *val = ~0UL; - pci_cfgrw(ctx, vcpu, in, bus, slot, func, coff, bytes, (uint32_t *)val); + pci_cfgrw(ctx, in, bus, slot, func, coff, bytes, (uint32_t *)val); return (0); } @@ -2053,7 +2054,7 @@ } static void -pci_cfgrw(struct vmctx *ctx, int vcpu, int in, int bus, int slot, int func, +pci_cfgrw(struct vmctx *ctx, int in, int bus, int slot, int func, int coff, int bytes, uint32_t *eax) { struct businfo *bi; @@ -2107,8 +2108,7 @@ if (in) { /* Let the device emulation override the default handler */ if (pe->pe_cfgread != NULL) { - needcfg = pe->pe_cfgread(ctx, vcpu, pi, coff, bytes, - eax); + needcfg = pe->pe_cfgread(ctx, pi, coff, bytes, eax); } else { needcfg = 1; } @@ -2120,7 +2120,7 @@ } else { /* Let the device emulation override the default handler */ if (pe->pe_cfgwrite != NULL && - (*pe->pe_cfgwrite)(ctx, vcpu, pi, coff, bytes, *eax) == 0) + (*pe->pe_cfgwrite)(ctx, pi, coff, bytes, *eax) == 0) return; /* @@ -2247,8 +2247,8 @@ INOUT_PORT(pci_cfgaddr, CONF1_ADDR_PORT, IOPORT_F_INOUT, pci_emul_cfgaddr); static int -pci_emul_cfgdata(struct vmctx *ctx, int vcpu, int in, int port, int bytes, - uint32_t *eax, void *arg __unused) +pci_emul_cfgdata(struct vmctx *ctx, int vcpu __unused, int in, int port, + int bytes, uint32_t *eax, void *arg __unused) { int coff; @@ -2256,7 +2256,7 @@ coff = cfgoff + (port - CONF1_DATA_PORT); if (cfgenable) { - pci_cfgrw(ctx, vcpu, in, cfgbus, cfgslot, cfgfunc, coff, bytes, + pci_cfgrw(ctx, in, cfgbus, cfgslot, cfgfunc, coff, bytes, eax); } else { /* Ignore accesses to cfgdata if not enabled by cfgaddr */ @@ -2499,7 +2499,7 @@ } static void -pci_emul_diow(struct vmctx *ctx __unused, int vcpu __unused, +pci_emul_diow(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -2567,7 +2567,7 @@ } static uint64_t -pci_emul_dior(struct vmctx *ctx __unused, int vcpu __unused, +pci_emul_dior(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct pci_emul_dsoftc *sc = pi->pi_arg; diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -117,7 +117,7 @@ #define PCI_FBUF_MSI_MSGS 4 static void -pci_fbuf_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_fbuf_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -172,7 +172,7 @@ } static uint64_t -pci_fbuf_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_fbuf_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct pci_fbuf_softc *sc; diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -210,9 +210,9 @@ * PCI HDA function declarations */ static int pci_hda_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl); -static void pci_hda_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, +static void pci_hda_write(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value); -static uint64_t pci_hda_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, +static uint64_t pci_hda_read(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size); /* * HDA global data @@ -1256,7 +1256,7 @@ } static void -pci_hda_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_hda_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -1274,7 +1274,7 @@ } static uint64_t -pci_hda_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_hda_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct hda_softc *sc = pi->pi_arg; diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -398,7 +398,7 @@ LPC_DSDT(pci_lpc_uart_dsdt); static int -pci_lpc_cfgwrite(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, +pci_lpc_cfgwrite(struct vmctx *ctx, struct pci_devinst *pi, int coff, int bytes, uint32_t val) { int pirq_pin; @@ -419,14 +419,14 @@ } static void -pci_lpc_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_lpc_write(struct vmctx *ctx __unused, struct pci_devinst *pi __unused, int baridx __unused, uint64_t offset __unused, int size __unused, uint64_t value __unused) { } static uint64_t -pci_lpc_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_lpc_read(struct vmctx *ctx __unused, struct pci_devinst *pi __unused, int baridx __unused, uint64_t offset __unused, int size __unused) { diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -3062,7 +3062,7 @@ } static void -pci_nvme_write(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, +pci_nvme_write(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { struct pci_nvme_softc* sc = pi->pi_arg; @@ -3125,7 +3125,7 @@ static uint64_t -pci_nvme_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_nvme_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct pci_nvme_softc* sc = pi->pi_arg; diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -903,8 +903,8 @@ } static int -passthru_cfgread(struct vmctx *ctx __unused, int vcpu __unused, - struct pci_devinst *pi, int coff, int bytes, uint32_t *rv) +passthru_cfgread(struct vmctx *ctx __unused, struct pci_devinst *pi, int coff, + int bytes, uint32_t *rv) { struct passthru_softc *sc; @@ -948,8 +948,8 @@ } static int -passthru_cfgwrite(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, - int coff, int bytes, uint32_t val) +passthru_cfgwrite(struct vmctx *ctx, struct pci_devinst *pi, int coff, + int bytes, uint32_t val) { int error, msix_table_entries, i; struct passthru_softc *sc; @@ -1029,8 +1029,8 @@ } static void -passthru_write(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, - int baridx, uint64_t offset, int size, uint64_t value) +passthru_write(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + uint64_t offset, int size, uint64_t value) { struct passthru_softc *sc; struct pci_bar_ioreq pio; @@ -1057,8 +1057,8 @@ } static uint64_t -passthru_read(struct vmctx *ctx __unused, int vcpu __unused, - struct pci_devinst *pi, int baridx, uint64_t offset, int size) +passthru_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, + uint64_t offset, int size) { struct passthru_softc *sc; struct pci_bar_ioreq pio; diff --git a/usr.sbin/bhyve/pci_uart.c b/usr.sbin/bhyve/pci_uart.c --- a/usr.sbin/bhyve/pci_uart.c +++ b/usr.sbin/bhyve/pci_uart.c @@ -66,7 +66,7 @@ } static void -pci_uart_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_uart_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -77,7 +77,7 @@ } static uint64_t -pci_uart_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_uart_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { uint8_t val; diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -2267,7 +2267,7 @@ static void -pci_xhci_write(struct vmctx *ctx __unused, int vcpu __unused, +pci_xhci_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size __unused, uint64_t value) { @@ -2489,7 +2489,7 @@ static uint64_t -pci_xhci_read(struct vmctx *ctx __unused, int vcpu __unused, +pci_xhci_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct pci_xhci_softc *sc; diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -426,9 +426,9 @@ void vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen); void vq_endchains(struct vqueue_info *vq, int used_all_avail); -uint64_t vi_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, +uint64_t vi_pci_read(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size); -void vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, +void vi_pci_write(struct vmctx *ctx, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value); #ifdef BHYVE_SNAPSHOT int vi_pci_snapshot(struct vm_snapshot_meta *meta); diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -558,7 +558,7 @@ * Otherwise dispatch to the actual driver. */ uint64_t -vi_pci_read(struct vmctx *ctx __unused, int vcpu __unused, +vi_pci_read(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { struct virtio_softc *vs = pi->pi_arg; @@ -678,7 +678,7 @@ * Otherwise dispatch to the actual driver. */ void -vi_pci_write(struct vmctx *ctx __unused, int vcpu __unused, +vi_pci_write(struct vmctx *ctx __unused, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) {