Skip to content

Allocator + CMA settings: umbrella tracker for all platforms #89

@widgetii

Description

@widgetii

Overview

Tracking the unification of the MMZ allocator selection, CMA reservation, and OSAL module-loading conventions across every HiSilicon / Goke platform supported by openhisilicon + OpenIPC/firmware. Companion to #58 (ISP) and #82 (sensors).

The hi3516cv500 family was just brought in line with the hi3516ev200/ev300 reference shape — kernel-side CMA fallback, HIGHMEM disabled, 256 MiB CMA, open_* module naming, modprobe driven from load_hisilicon. The same modernisation applies to the rest of the family tree, with a couple of legacy V1/V2A platforms that need a different (mmz/) approach.

The pattern was established across these landed PRs:

  • OpenIPC/linux#37 — kernel-side hi_cma.c fallback: when load_hisilicon doesn't pass an mmz= zone in cmdline, synthesise one from dma_contiguous_default_area. Lets stock OpenIPC firmware with no U-Boot tweaks sysupgrade cleanly into the new world.
  • OpenIPC/firmware#2050 — cv500 osdrv: switch to DT-defined CMA-default allocator.
  • OpenIPC/firmware#2058 — load open_hwrng early so userspace getrandom() doesn't block.
  • OpenIPC/firmware#2060load_hisilicon: skip cmdline mem= when it equals total RAM (V4+CMA).
  • OpenIPC/firmware#2064 — cv500: align module naming with EV300 (open_*); rewrite load_hisilicon to modprobe open_*.
  • OpenIPC/firmware#2067 — cv500: disable HIGHMEM, bump default CMA to 256 MiB.

End-to-end verified on hi3516av300 + IMX415 (CV500 family) at master+101d778: 33 open_* modules loaded, IMX415 detected, RTSP/HTTP serve 4K JPEG snapshots.

Per-platform state

Numbers from current master (firmware) / upstream-patches+vendor branches (openipc/linux) / master (openhisilicon) on 2026-05-07.

Platform Gen Module naming (load_hisilicon) HIGHMEM CMA size hi_cma fallback mmz_allocator branches Notes
hi3516cv500 V3.5 modprobe open_* (40) ✅ off ✅ 256 MiB ✅ in vendor 4.9 hisi+cma Reference shape (this PR series)
hi3516ev200 V4 modprobe open_* (36) ✅ off 0 (DT-cma) ❌ needs port hisi+cma Original reference; no fallback patch yet
hi3516ev300 V4 (shares ev200 osdrv) ✅ off 0 (DT-cma) ❌ needs port hisi+cma
hi3516cv300 V3 insmod legacy (33) ❌ on (none set) ❌ needs port hisi+cma 9 sensors source-built, modules still vendor-named
hi3519v101 V3A insmod legacy (38) ❌ on 16 MiB ❌ needs port hisi only
hi3516av200 V3A (shares v101) ❌ on 16 MiB ❌ needs port (n/a)
hi3516cv200 V2 insmod legacy (28) ✅ off (none set) ❌ needs port hisi only
hi3516av100 V2A insmod legacy (26) ✅ off (none set) n/a — no hi_cma hisi only Standalone mmz/, no CMA path
hi3516cv100 V1 insmod legacy (27) ✅ off (none set) n/a — no hi_cma hisi only Standalone mmz/, no CMA path
hi3536dv100 DVR insmod legacy (2) ✅ off (none set) n/a (none)
hi3520dv200 DVR insmod legacy (1) ✅ off (none set) n/a (none) Just landed (#2065), uses minimal load script

Counts: "modprobe open_*" / "insmod legacy" reflect the count of active (uncommented) module-loading lines in general/package/hisilicon-osdrv-<chip>/files/script/load_hisilicon.

What "unified" means per dimension

1. Module naming → open_* everywhere

  • Goal: hisilicon-opensdk.mk installs verbatim from $(@D)/kernel/open_*.ko into $(KMOD_DST); no rename to hi_*/hi3516cv500_*/sys_config.ko. Matches what was done for cv500 in firmware#2064.
  • Why: load_hisilicon can drive everything via modprobe open_X (the upstream convention) instead of legacy insmod hi_X.ko filenames; the rmmod side already used open_* names in many scripts and silently no-op'd because nothing matched.
  • Scope: cv200, cv300, v101, av100, cv100 (and dv100/dv200 small DVR scripts).

2. HIGHMEM disable + sized CMA reservation

  • Goal: # CONFIG_HIGHMEM is not set + CONFIG_CMA_SIZE_MBYTES=256 in every *.generic.config for boards with ≥ 256 MiB RAM and the cma_allocator path. HIGHMEM creates a low/high boundary at 0xb0000000 that CMA reservations spanning it can't satisfy — atomic_pool_init panics on boot.
  • Why: matches the cv500 fix from firmware#2067.
  • Scope: cv300, v101, av200 still have CONFIG_HIGHMEM=y. cv200 and lower don't have the cma_allocator path so HIGHMEM is moot for them.

3. Kernel-side CMA fallback default pool

  • Goal: port the hi_cma.c fallback — when no mmz= cmdline zone is registered, synthesise one from dma_contiguous_default_area so OSAL allocators don't return NULL. Lets sysupgrade work without U-Boot bootargs surgery.
  • Scope: ev200 (V4), cv300 (V3), v101 (V3A), cv200 (V2) vendor kernel branches in OpenIPC/linux. cv500 already done. av100/cv100 have no hi_cma.c (they use the standalone mmz/ path).

4. CMA-default reserved-memory in DT (V3.5+ kernels)

  • Already in cv500 / dv300 mainline-port DTSI via firmware#2050.
  • Will need to land for any future *_neo variants of other families when they materialise (cv300_neo, v101_neo, etc.).

5. set_allocator script (boot-time MMZ size negotiation)

  • ev200 + av100 ship a set_allocator helper that calls into U-Boot env to derive the MMZ zone string. Only those two; cv500 doesn't have one and works without (uses osmem/totalmem env vars directly in load_hisilicon).
  • Probably not worth unifying — cv500 simpler model is fine.

Recommended PR order

The work is mostly per-platform and parallelisable. Suggested order — easiest first, biggest blast radius last:

  1. hi3516cv300 — port hi_cma fallback + opensdk install (drop renames) + load_hisilicon → modprobe open_* + disable HIGHMEM. Closest analog to the cv500 work; well-tested userspace.
  2. hi3519v101 — same shape, fewer sensors, smaller module set.
  3. hi3516cv200 — needs hi_cma fallback (vendor kernel) + load_hisilicon rewrite. HIGHMEM already off.
  4. hi3516ev200 + hi3516ev300 — already have open_* naming; port hi_cma fallback into hisilicon-hi3516ev200 linux branch so first-boot after firmware update doesn't need bootargs change.
  5. hi3516av100, hi3516cv100 — different allocator (standalone mmz/, no hi_cma.c). Just the load_hisilicon → modprobe open_* rewrite + opensdk install simplification. Lower priority; legacy hardware.

Per-PR shape

Each platform's PR series follows the same template (mirror of cv500):

  • OpenIPC/linux (vendor branch): port hi_cma_get_zone() fallback patch — single commit, ~40 LOC. (feat: add hi3516cv200 SoC family support #37 for cv500 as reference.)
  • OpenIPC/firmware PR A: hisilicon-opensdk.mk — drop open_*.ko → hi_*/<chip>_* rename loop in the per-family install block; install verbatim. (#2064 cv500 example.)
  • OpenIPC/firmware PR B: general/package/hisilicon-osdrv-<chip>/files/script/load_hisilicon — rewrite insert_* chains from insmod hi_X.komodprobe open_X. The remove_* side typically already uses open_* names (silent no-op pre-fix). Bundled in same PR as A.
  • OpenIPC/firmware PR C (where HIGHMEM=y today): kernel config — flip HIGHMEM off, bump CONFIG_CMA_SIZE_MBYTES. (#2067 cv500 example.)

Sub-issue / sub-PR table

Platform hi_cma fallback (linux) naming + load_hisilicon (firmware) HIGHMEM/CMA (firmware) Status
hi3516cv500 linux#37 firmware#2064 firmware#2067 ✅ DONE
hi3516ev200 not yet already open_* already off / DT-cma partial — needs hi_cma fallback port
hi3516ev300 not yet (shares ev200) already off / DT-cma partial — needs hi_cma fallback port
hi3516cv300 not yet not yet needs HIGHMEM off not started
hi3519v101 not yet not yet needs HIGHMEM off + CMA bump not started
hi3516av200 not yet (shares v101) needs HIGHMEM off + CMA bump not started
hi3516cv200 not yet not yet already off not started
hi3516av100 n/a (no hi_cma) not yet already off not started
hi3516cv100 n/a (no hi_cma) not yet already off not started

Issues/PRs will be linked here as they're opened.

Out of scope (intentionally)

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions