hi_cma: synthesize fallback zone from default CMA when no mmz= passed#37
Merged
widgetii merged 1 commit intohisilicon-hi3516cv500from May 7, 2026
Merged
Conversation
openhisilicon's V3.5 cma_allocator (in user-side open_osal.ko) calls
hisi_get_cma_zone("anonymous") to look up a CMA region registered via
the kernel cmdline `mmz=` early_param. On stock OpenIPC firmware where
the U-Boot bootargs were never customised, no `mmz=` is present,
hisi_get_cma_zone returns NULL, and the OSAL allocator fails to register
any zone. After OpenIPC/openhisilicon#73 propagated -ENODEV from the
empty-zone case, `insmod hi_osal.ko` started failing loud, and
load_hisilicon's `|| report_error` aborts the whole module load chain.
Existing hi3516av300 / hi3516cv500 / hi3516dv300 cameras that "worked
for years" stopped loading any vendor module after a sysupgrade.
Fix: when the named lookup misses, synthesize a single fallback zone
that points to the kernel's default CMA pool (set by
CONFIG_CMA_SIZE_MBYTES or `cma=` in cmdline). The fallback is one-shot
(cached in a static struct) so subsequent get-by-name calls reuse it.
Verified on hi3516av300_imx415 with default OpenIPC bootargs (no mmz=,
no cma=) and CONFIG_CMA_SIZE_MBYTES=256: all 37 OSDRV modules load,
IMX415 4K2K_30FPS init succuss, RTSP server on :554, HTTP /image.jpg
returns a valid 3840x2160 baseline JPEG. No bootargs change required.
Boards that DO put `mmz=anonymous,...` in bootargs keep their per-zone
intent (named lookup is still tried first).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
openhisilicon's V3.5 `cma_allocator` (in user-side `open_osal.ko`) calls
`hisi_get_cma_zone("anonymous")` to look up a CMA region registered via
the kernel cmdline `mmz=` early_param. On stock OpenIPC firmware where
the U-Boot bootargs were never customised, no `mmz=` is present,
`hisi_get_cma_zone` returns NULL, the OSAL allocator fails to register
any zone, and after OpenIPC/openhisilicon#73 propagated `-ENODEV` from
the empty-zone case, `insmod hi_osal.ko` started failing loud.
Existing hi3516av300 / hi3516cv500 / hi3516dv300 cameras that worked
for years stopped loading any vendor module after a sysupgrade.
Fix
When the named lookup misses, synthesize a single fallback zone that
points to the kernel's default CMA pool (set by `CONFIG_CMA_SIZE_MBYTES`
or `cma=` in cmdline). The fallback is one-shot (cached in a `static`
struct) so subsequent get-by-name calls reuse it.
Boards that DO put `mmz=anonymous,...` in bootargs keep their per-zone
intent — named lookup is still tried first.
Test plan (verified on hi3516av300_imx415)
With default OpenIPC bootargs (no mmz=, no cma=) and
`CONFIG_CMA_SIZE_MBYTES=256`:
baseline JPEG (368 KB)
Companion firmware-side change: openipc/firmware bumps
`CONFIG_CMA_SIZE_MBYTES` to 256 and disables `CONFIG_HIGHMEM` in the
cv500-family generic configs (av300/cv500/dv300). HIGHMEM=y created the
lowmem/highmem boundary at `0xb0000000` that broke any CMA region
spanning it; HIGHMEM=n matches what hi3516ev300 has shipped for years.
🤖 Generated with Claude Code