The branch main has been updated by jhb:

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

commit 0ffad4ce5655cbe412b79185d2b7924d0d72983e
Author:     John Baldwin <[email protected]>
AuthorDate: 2026-08-26 19:31:01 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2026-08-26 19:31:01 +0000

    bhyve: Tidy lobits handling in pci_passthru
    
    - The lobits field in the "physical" BAR settings is never used, so
      don't bother setting it.
    
    - Expand the comment explaining why the existing lobits are preserved
      (namely, to preserve the prefetch flag on memory BARs).
    
    Reviewed by:    bnovkov
    Differential Revision:  https://reviews.freebsd.org/D58894
---
 usr.sbin/bhyve/pci_passthru.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index 740d9ad45d03..615b0c639bbe 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -678,12 +678,14 @@ cfginitbar(struct passthru_softc *sc)
                sc->psc_bar[i].type = bartype;
                sc->psc_bar[i].size = size;
                sc->psc_bar[i].addr = base;
-               sc->psc_bar[i].lobits = 0;
 
                /* Allocate the BAR in the guest I/O or MMIO space */
                pci_emul_alloc_bar(pi, i, bartype, size);
 
-               /* Use same lobits as physical bar */
+               /*
+                * Use same lobits as physical BAR to preserve
+                * prefetch flag.
+                */
                lobits = (uint8_t)passthru_read_config(&sc->psc_sel,
                    PCIR_BAR(i), 0x01);
                if (bartype == PCIBAR_MEM32 || bartype == PCIBAR_MEM64) {
@@ -691,7 +693,6 @@ cfginitbar(struct passthru_softc *sc)
                } else {
                        lobits &= ~PCIM_BAR_IO_BASE;
                }
-               sc->psc_bar[i].lobits = lobits;
                pi->pi_bar[i].lobits = lobits;
 
                /*

Reply via email to