The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1e4086d05297b711081fe06933677925c5ee6232

commit 1e4086d05297b711081fe06933677925c5ee6232
Author:     John Baldwin <[email protected]>
AuthorDate: 2026-03-06 21:32:33 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2026-03-06 21:32:33 +0000

    sys: Don't pass RF_ALLOCATED to bus_alloc_resource*
    
    This is a nop as eventually these flags are passed to rman_reserve_resource
    which unconditionally sets RF_ALLOCATED in the new flags for a region.
    However, it's really a layering violation to use RF_ALLOCATED in relation
    to struct resource objects outside of subr_rman.c as subr_rman.c uses
    this flag to manage it's internal tracking of allocated vs free regions.
    
    In addition, don't document this as a valid flag in the manual.  I
    think the intention here was that if a caller didn't want to pass
    RF_ACTIVE or RF_SHAREABLE, they could pass RF_ALLOCATED instead of 0,
    but given the layering violation, I think it's best to just pass 0
    instead in that case.
    
    NB: The bhnd bus uses RF_ALLOCATED (along with RF_ACTIVE) in a
    separate API to manage resource regions that are not struct resource
    objects (but a separate wrapper object).  It would perhaps be cleaner
    if the chipc_retain_region and chipc_release_region functions used
    their own flag constants instead of reusing the rman(9) flags.
    
    Reviewed by:    imp, kib
    Differential Revision:  https://reviews.freebsd.org/D55683
---
 share/man/man9/bus_alloc_resource.9 | 10 +++-------
 sys/arm/nvidia/tegra_pcie.c         |  5 ++---
 sys/x86/iommu/amd_drv.c             |  2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/share/man/man9/bus_alloc_resource.9 
b/share/man/man9/bus_alloc_resource.9
index 210abb3074e1..d69917d17ffd 100644
--- a/share/man/man9/bus_alloc_resource.9
+++ b/share/man/man9/bus_alloc_resource.9
@@ -26,7 +26,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 30, 2025
+.Dd March 6, 2026
 .Dt BUS_ALLOC_RESOURCE 9
 .Os
 .Sh NAME
@@ -142,12 +142,8 @@ is used, if it is bigger than the default value.
 .It
 .Fa flags
 sets the flags for the resource.
-You can set one or more of these flags:
-.Bl -tag -width RF_SHAREABLE
-.It Dv RF_ALLOCATED
-resource has been reserved.
-The resource still needs to be activated with
-.Xr bus_activate_resource 9 .
+You can set zero or more of these flags:
+.Bl -tag -width RF_PREFETCHABLE
 .It Dv RF_ACTIVE
 activate resource atomically.
 .It Dv RF_PREFETCHABLE
diff --git a/sys/arm/nvidia/tegra_pcie.c b/sys/arm/nvidia/tegra_pcie.c
index ec272523df1b..c7a30965a5e5 100644
--- a/sys/arm/nvidia/tegra_pcie.c
+++ b/sys/arm/nvidia/tegra_pcie.c
@@ -1468,7 +1468,7 @@ tegra_pcib_attach(device_t dev)
        }
        /*
         * XXX - FIXME
-        * tag for config space is not filled when RF_ALLOCATED flag is used.
+        * tag for config space is not filled when RF_ACTIVE flag is not used.
         */
        sc->bus_tag = rman_get_bustag(sc->pads_mem_res);
 
@@ -1482,8 +1482,7 @@ tegra_pcib_attach(device_t dev)
        }
 
        rid = 2;
-       sc->cfg_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
-           RF_ALLOCATED);
+       sc->cfg_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 0);
        if (sc->cfg_mem_res == NULL) {
                device_printf(dev, "Cannot allocate config space memory\n");
                rv = ENXIO;
diff --git a/sys/x86/iommu/amd_drv.c b/sys/x86/iommu/amd_drv.c
index bf7ac4b157c4..3a7b2819cbdd 100644
--- a/sys/x86/iommu/amd_drv.c
+++ b/sys/x86/iommu/amd_drv.c
@@ -494,7 +494,7 @@ amdiommu_attach(device_t dev)
        }
        sc->mmio_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mmio_rid,
            sc->mmio_base, sc->mmio_base + sc->mmio_sz - 1, sc->mmio_sz,
-           RF_ALLOCATED | RF_ACTIVE | RF_SHAREABLE);
+           RF_ACTIVE | RF_SHAREABLE);
        if (sc->mmio_res == NULL) {
                device_printf(dev,
                    "bus_alloc_resource %#jx-%#jx failed\n",

Reply via email to