git: 92991e8f8d31 - stable/14 - new-bus: Disable assertions for rman mismatches for activate/deactivate

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 03 Jan 2024 22:02:45 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=92991e8f8d319981c7f9b0ad1fc3855b6dfdfe3a

commit 92991e8f8d319981c7f9b0ad1fc3855b6dfdfe3a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-11-25 18:32:19 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-03 20:47:24 +0000

    new-bus: Disable assertions for rman mismatches for activate/deactivate
    
    Bus drivers which use an rman to sub-divide a resource allocated from
    a parent bus should handle mapping requests (and activate/deactivate
    requests) for those sub-allocated resources by doing a subset mapping
    of the resource allocated from the parent (and then using this to
    handle activate/deactivate requests).
    
    However, not all bus drivers which use internal rmans (such as acpi(4)
    and pci_pci(4)) do that since not all nexus drivers support
    bus_map/unmap.  Eventually bus drivers should be updated to do this
    properly at which point these assertions can be reenabled.
    
    Reported by:    delphij, kib
    
    (cherry picked from commit ed88eef140a1c3d57d546f409c216806dd3da809)
---
 sys/kern/subr_bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 4d21382f2de7..040b3556d156 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -4305,12 +4305,12 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
 	struct resource_map map;
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	struct rman *rm;
 #endif
 	int error;
 
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
 	KASSERT(rman_is_region_manager(r, rm),
 	    ("%s: rman %p doesn't match for resource %p", __func__, rm, r));
@@ -4344,12 +4344,12 @@ bus_generic_rman_deactivate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
 	struct resource_map map;
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	struct rman *rm;
 #endif
 	int error;
 
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
 	KASSERT(rman_is_region_manager(r, rm),
 	    ("%s: rman %p doesn't match for resource %p", __func__, rm, r));