From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: dma: contiguous: Turn heap registration logic around Date: Fri, 27 Feb 2026 13:12:02 +1000 Message-ID: In-Reply-To: <20260225-dma-buf-heaps-as-modules-v1-1-2109225a090d@kernel.org> References: <20260225-dma-buf-heaps-as-modules-v1-0-2109225a090d@kernel.org> <20260225-dma-buf-heaps-as-modules-v1-1-2109225a090d@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the key architectural change. It moves the CMA reserved-region tracking from `cma_heap.c` into `kernel/dma/contiguous.c` and provides an iterator `dma_contiguous_get_reserved_region()` for the heap to use. **Positive:** - Clean inversion of the dependency. The old `dma_heap_cma_register_heap()` called from `contiguous.c` into heap code; now the heap calls into `contiguous.c`. This correctly eliminates the built-in-to-module dependency. - Proper `!CONFIG_DMA_CMA` stub provided in `dma-map-ops.h`. - `EXPORT_SYMBOL_GPL` used appropriately. **Issue - `rmem_cma_areas` is no longer `__initdata`:** ```c +static struct cma *rmem_cma_areas[MAX_CMA_AREAS]; +static unsigned int rmem_cma_areas_num; ``` The old `dma_areas` in `cma_heap.c` was marked `__initdata`, meaning it was discarded after init. The new `rmem_cma_areas` in `contiguous.c` is *not* marked `__initdata` -- and correctly so, because a module could be loaded after init. However, this means `MAX_CMA_AREAS` worth of pointers now persist for the lifetime of the kernel. This is intentional and correct for module support, but worth noting in the commit message. **Minor - no locking on `rmem_cma_areas`:** `rmem_cma_insert_area()` is called from `__init` context (`rmem_cma_setup`), and `dma_contiguous_get_reserved_region()` is called from `module_init`. Since all inserts happen during early boot (before modules load), there's no real race. This is fine. **Nit:** The function name `dma_contiguous_get_reserved_region` is a good choice and follows the existing naming convention in `contiguous.c`. --- Generated by Claude Code Patch Reviewer