From nobody Wed Aug 26 19:31:45 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hVZXK3GNvz6pYgx for ; Wed, 26 Aug 2026 19:31:45 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hVZXK1T4jz3Vy9 for ; Wed, 26 Aug 2026 19:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787772705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=muCuGpOwuckjBGcL3R1qTV0r3TUnIEDKnBvdM1Oo/xA=; b=TdW8DO9EXw0ps3jZEbQk+4ZJPgd6dKWKDErsTup8JIydPBddMQ0hDXzKH2J2uei6FsvJGz UZ6/OO6K4ubs2xTAjGb5+sHn7DzKsgPjIQO5Lmu+YiV3hlPGvF5u4eScDB+nBvy3VE/4fb gSMm3RLk6hZuI0thAbs28lWMMIofNtuAS5+B/ou8nK5oitykY8ZourlkiYmCD3+kKbjCXh vySDITFoQ/8QWpNE3wohOhd1qPAqSB9oWy5vcVjuf9kR5pEr5FW0Zf6IgAYQU6WshT0ILd oUH0JTUmXBocWFTmdLdiyFlbXkSej3CLtaE1Gpe5MaojAcdfJRrGnWBtka3tBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787772705; a=rsa-sha256; cv=none; b=D8wJbIie4YVlrOaY2D73Ug0XRwAarfL7tdwD1JepQKsrYT7tkUIZHYewbcrOR7fyOCOq/V JiIZh7ylaIb/05TFJbGaV0jY6b0Ov16+5KRUO0SJ+Vgv3DsDHP0tTr5VCGRowAuA39nUjV fQEdLCRHSnoDzI3YLUZ8yI3Jo9VypWfa8XP0dvNNL+VnI5Gp4V9n+7ft0VhQt6ppwD58Js HyLO4P5/oIV7cKcX4KSRooHp7le/AXXw8DrC6RVED2eQuY/WL9T80xV986d/TYQ974CEJy nDTuqLud3QgFQqLXNmhcPIRe6P/A0Mp5Y8faHvq+JwikDqBlGHAWjxzQxQRkxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787772705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=muCuGpOwuckjBGcL3R1qTV0r3TUnIEDKnBvdM1Oo/xA=; b=hxza3S6WR4L5ocaO7jzukj24PqYnlyFcxgOiqkZ9auMjJIbrJSYUHzrVP6EBl3NMH8y1xk 4DwH7Hs/cJDPOwY4gmBwRYbeSDAwZJ2l58eWF4EI4zqiAC+h5eTYywdSF309iTXzd4wp34 4dHIpgdVv7D+00leUPVj0/1f8qoeaIhBgkfvcLGogTgjsEGurgQJ2GWM5RkXENzYNXGymN cWYxSY44R0umzGHiIdXzM2x26+hpHEX+6UVJnIh4r9gd1hgZLiAkRZpbUc5qxF62NgoKjs kE93azAp/FB8GzA79G9HwOeP0+yID6APjxEw76qkUnjWuZeJv/BGcmCBrWYZTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hVZXK0MxVzrkP for ; Wed, 26 Aug 2026 19:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19352 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 26 Aug 2026 19:31:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b29dc5a30cce - main - bhyve: Return void from pci_emul_alloc_bar List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/main X-Git-Reftype: branch X-Git-Commit: b29dc5a30cce666896217a03a8067eba8b018eb6 Auto-Submitted: auto-generated Date: Wed, 26 Aug 2026 19:31:45 +0000 Message-Id: <6a8f3f21.19352.78e8314a@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b29dc5a30cce666896217a03a8067eba8b018eb6 commit b29dc5a30cce666896217a03a8067eba8b018eb6 Author: John Baldwin AuthorDate: 2026-08-26 19:30:17 +0000 Commit: John Baldwin CommitDate: 2026-08-26 19:30:17 +0000 bhyve: Return void from pci_emul_alloc_bar This function never fails. Reviewed by: bnovkov, chuck, markj Differential Revision: https://reviews.freebsd.org/D58579 --- usr.sbin/bhyve/pci_emul.c | 22 ++++++---------------- usr.sbin/bhyve/pci_emul.h | 2 +- usr.sbin/bhyve/pci_fbuf.c | 7 ++----- usr.sbin/bhyve/pci_nvme.c | 6 +----- usr.sbin/bhyve/pci_passthru.c | 6 ++---- 5 files changed, 12 insertions(+), 31 deletions(-) diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 538e4f284bec..7637049f0dd9 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -795,7 +795,7 @@ update_bar_address(struct pci_devinst *pi, uint64_t addr, int idx, int type) register_bar(pi, idx); } -int +void pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, uint64_t size) { @@ -863,7 +863,7 @@ pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, * ROM to handle this. */ if (!get_config_bool_default("pci.enable_bars", !bootrom_boot())) - return (0); + return; /* * pci_passthru devices synchronize their physical and virtual command @@ -886,8 +886,6 @@ pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, const uint16_t cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND); pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit); - - return (0); } static int @@ -1027,10 +1025,7 @@ pci_emul_alloc_rom(struct pci_devinst *const pdi, const uint64_t size, } /* allocate ROM BAR */ - const int error = pci_emul_alloc_bar(pdi, PCI_ROM_IDX, PCIBAR_ROM, - rom_size); - if (error) - return error; + pci_emul_alloc_bar(pdi, PCI_ROM_IDX, PCIBAR_ROM, rom_size); /* return address */ *addr = pci_emul_rombase + pci_emul_romoffset; @@ -2620,14 +2615,9 @@ pci_emul_dinit(struct pci_devinst *pi, nvlist_t *nvl __unused) error = pci_emul_add_msicap(pi, PCI_EMUL_MSI_MSGS); assert(error == 0); - error = pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ); - assert(error == 0); - - error = pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ); - assert(error == 0); - - error = pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ); - assert(error == 0); + pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ); + pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ); + pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ); return (0); } diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 4bf617dc3219..9aeb11496943 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -233,7 +233,7 @@ int init_pci(struct vmctx *ctx); void pci_callback(void); uint32_t pci_config_read_reg(const struct pci_conf *host_conf, nvlist_t *nvl, uint32_t reg, uint8_t size, uint32_t def); -int pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, +void pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type, uint64_t size); int pci_emul_alloc_rom(struct pci_devinst *const pdi, const uint64_t size, void **const addr); diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 560c2bc839d6..011bb606d708 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -409,11 +409,8 @@ pci_fbuf_init(struct pci_devinst *pi, nvlist_t *nvl) goto done; } - error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, DMEMSZ); - assert(error == 0); - - error = pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, FB_SIZE); - assert(error == 0); + pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, DMEMSZ); + pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, FB_SIZE); error = pci_emul_add_msicap(pi, PCI_FBUF_MSI_MSGS); assert(error == 0); diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 0e20122648a6..7e6768de8550 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -3342,11 +3342,7 @@ pci_nvme_init(struct pci_devinst *pi, nvlist_t *nvl) DPRINTF("nvme membar size: %u", pci_membar_sz); - error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM64, pci_membar_sz); - if (error) { - WPRINTF("%s pci alloc mem bar failed", __func__); - goto done; - } + pci_emul_alloc_bar(pi, 0, PCIBAR_MEM64, pci_membar_sz); error = pci_emul_add_msixcap(pi, sc->max_queues + 1, NVME_MSIX_BAR); if (error) { diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index 24d96764964d..740d9ad45d03 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -627,7 +627,7 @@ init_msix_table(struct passthru_softc *sc) static int cfginitbar(struct passthru_softc *sc) { - int i, error; + int i; struct pci_devinst *pi; struct pci_bar_io bar; enum pcibar_type bartype; @@ -681,9 +681,7 @@ cfginitbar(struct passthru_softc *sc) sc->psc_bar[i].lobits = 0; /* Allocate the BAR in the guest I/O or MMIO space */ - error = pci_emul_alloc_bar(pi, i, bartype, size); - if (error) - return (-1); + pci_emul_alloc_bar(pi, i, bartype, size); /* Use same lobits as physical bar */ lobits = (uint8_t)passthru_read_config(&sc->psc_sel,