git: 78c2cd83ecca - main - bhyve: Remove unused vcpu argument from PCI read/write methods.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Dec 2022 18:36:44 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=78c2cd83eccac0ebd23ebd15df77ee33a5781a6e commit 78c2cd83eccac0ebd23ebd15df77ee33a5781a6e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-12-09 18:35:28 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-12-09 18:35:28 +0000 bhyve: Remove unused vcpu argument from PCI read/write methods. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37652 --- usr.sbin/bhyve/pci_ahci.c | 4 ++-- usr.sbin/bhyve/pci_e82545.c | 4 ++-- usr.sbin/bhyve/pci_emul.c | 50 +++++++++++++++++++++---------------------- usr.sbin/bhyve/pci_emul.h | 8 +++---- usr.sbin/bhyve/pci_fbuf.c | 4 ++-- usr.sbin/bhyve/pci_hda.c | 8 +++---- usr.sbin/bhyve/pci_lpc.c | 6 +++--- usr.sbin/bhyve/pci_nvme.c | 4 ++-- usr.sbin/bhyve/pci_passthru.c | 16 +++++++------- usr.sbin/bhyve/pci_uart.c | 4 ++-- usr.sbin/bhyve/pci_xhci.c | 4 ++-- usr.sbin/bhyve/virtio.c | 4 ++-- usr.sbin/bhyve/virtio.h | 4 ++-- 13 files changed, 60 insertions(+), 60 deletions(-) diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 09b996476774..700170885a13 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -2197,7 +2197,7 @@ pci_ahci_host_write(struct pci_ahci_softc *sc, uint64_t offset, uint64_t value) } 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 @@ pci_ahci_port_read(struct pci_ahci_softc *sc, uint64_t offset) } 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 index 9d991b124965..49c5f986a341 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -2112,7 +2112,7 @@ e82545_read_register(struct e82545_softc *sc, uint32_t offset) } 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 @@ e82545_write(struct vmctx *ctx __unused, int vcpu __unused, } 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.c b/usr.sbin/bhyve/pci_emul.c index b22238ab37fd..74a648799757 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -140,7 +140,7 @@ SYSRES_MEM(PCI_EMUL_ECFG_BASE, PCI_EMUL_ECFG_SIZE); 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 @@ pci_msix_pba_bar(struct pci_devinst *pi) } 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 @@ pci_emul_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, 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 @@ pci_emul_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, } 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 @@ pci_emul_mem_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr, 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 @@ pci_emul_fallback_handler(struct vmctx *ctx __unused, int vcpu __unused, } 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 @@ pci_emul_ecfg_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr, 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 @@ pci_emul_cmdsts_write(struct pci_devinst *pi, int coff, uint32_t new, int bytes) } 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 @@ pci_cfgrw(struct vmctx *ctx, int vcpu, int in, int bus, int slot, int func, 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 @@ pci_cfgrw(struct vmctx *ctx, int vcpu, int in, int bus, int slot, int func, } 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 @@ pci_emul_cfgaddr(struct vmctx *ctx __unused, int vcpu __unused, int in, 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 @@ pci_emul_cfgdata(struct vmctx *ctx, int vcpu, int in, int port, int bytes, 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 @@ pci_emul_dinit(struct vmctx *ctx __unused, struct pci_devinst *pi, } 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 @@ pci_emul_diow(struct vmctx *ctx __unused, int vcpu __unused, } 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_emul.h b/usr.sbin/bhyve/pci_emul.h index 3d7b420e2bdf..8a7bcb7cc83a 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -63,18 +63,18 @@ struct pci_devemu { 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_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index d69e8254aa25..4cfe872bd934 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -117,7 +117,7 @@ static struct pci_fbuf_softc *fbuf_sc; #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 @@ pci_fbuf_write(struct vmctx *ctx __unused, int vcpu __unused, } 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 index e6e4ae4ca27d..a85935a5cae8 100644 --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -210,9 +210,9 @@ static uint64_t hda_get_clock_ns(void); * 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 @@ pci_hda_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) } 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 @@ pci_hda_write(struct vmctx *ctx __unused, int vcpu __unused, } 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 index 5425a7935973..7af8d6647edc 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -398,7 +398,7 @@ pci_lpc_uart_dsdt(void) 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 @@ pci_lpc_cfgwrite(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, } 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 index 46bf7ba7ec45..75e6f247501a 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -3062,7 +3062,7 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvme_softc* sc, } 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_bar_0(struct pci_nvme_softc* sc, 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 index 3a16e7bce0ae..3dbb80eec9fa 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -903,8 +903,8 @@ msixcap_access(struct passthru_softc *sc, int coff) } 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 @@ passthru_cfgread(struct vmctx *ctx __unused, int vcpu __unused, } 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 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, } 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 @@ passthru_write(struct vmctx *ctx, int vcpu __unused, struct pci_devinst *pi, } 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 index 2e4a0eac05f9..7ccc3c7b6c62 100644 --- a/usr.sbin/bhyve/pci_uart.c +++ b/usr.sbin/bhyve/pci_uart.c @@ -66,7 +66,7 @@ pci_uart_intr_deassert(void *arg) } 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 @@ pci_uart_write(struct vmctx *ctx __unused, int vcpu __unused, } 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 index f95f62fbf0e5..5bc9498a4eb4 100644 --- a/usr.sbin/bhyve/pci_xhci.c +++ b/usr.sbin/bhyve/pci_xhci.c @@ -2267,7 +2267,7 @@ pci_xhci_hostop_write(struct pci_xhci_softc *sc, uint64_t offset, 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 @@ pci_xhci_xecp_read(struct pci_xhci_softc *sc, uint64_t offset) 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.c b/usr.sbin/bhyve/virtio.c index dc3a2d10d5b5..87d49c2a5e4b 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -558,7 +558,7 @@ vi_find_cr(int offset) { * 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 @@ done: * 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) { diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index 7b50969e57a9..b6ef2bc8d9de 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -426,9 +426,9 @@ void vq_relchain_publish(struct vqueue_info *vq); 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);