Skip to content

hi3516cv300_neo: Linux 7.0 board variant (third HiSi neo SoC, issue openhisilicon#60)#2103

Merged
widgetii merged 7 commits into
masterfrom
feat/cv300-neo
May 17, 2026
Merged

hi3516cv300_neo: Linux 7.0 board variant (third HiSi neo SoC, issue openhisilicon#60)#2103
widgetii merged 7 commits into
masterfrom
feat/cv300-neo

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

Lands the firmware side of the hi3516cv300_neo port — the third HiSi neo board variant on the openipc/linux upstream-patches 7.0 base, after hi3516ev300_neo (6.6 / 6.18 / 7.0) and hi3516av300_neo (7.0). All upstream prerequisites are merged:

Three commits:

  1. hi3516cv300_neo: Linux 7.0 board — new defconfig + seed kernel config + neo-post-image script
  2. ci: add hi3516cv300_neo to firmware build matrix — one-line addition to .github/workflows/build.yml mirroring how ev300_neo / av300_neo are wired
  3. hisilicon-opensdk: bump to b405551 — pulls in the cv300 OSAL compat-shim port from openhisilicon

Layout matches the existing two neo boards: defconfig uses the vendor v3 musl toolchain (kernel-headers stay at 3.18 — toolchain ABI; modern kernel ABI is backward-compatible), pulls the upstream-patches.tar.gz (now contains cv300 DT), forces opensdk on and osdrv off (V3 vendor osdrv won't compile against 7.0, and opensdk replaces every kernel module on cv300 anyway after #2102).

Test plan

  • make BOARD=hi3516cv300_neo produces uImage + rootfs.squashfs (Linux 7.0)
  • Boots under qemu-system-arm -M hi3516cv300 to openipc-hi3516cv300 login:
  • No Oops:, panic:, BUG:, Call Trace, or Unable to handle on console or in dmesg
  • FEMAC initializes; DHCP succeeds (10.0.2.15 / 10.0.2.2 in QEMU SLIRP)
  • ntpd rolls wall clock forward
  • Real-hardware verification on IMX291/CV300 board — follow-up
  • CI matrix row turns green once this PR lands (the cv300_neo row in openhisilicon CI will then also turn green — currently the only red one across both repos because of the deliberate red-then-green dance)

Why this is OK now

The cv300 qemu-boot row in openhisilicon CI sits at allow-failure: true for a pre-existing cma_osal.ko vs hi_osal.ko naming mismatch in the cv300_lite load_hisilicon. That bug is on the lite path and does not affect neo: this defconfig forces opensdk on, so hi_osal.ko is built and installed (via opensdk's rename-on-install for cv300). Neo starts from a clean slate.

widgetii added 3 commits May 17, 2026 12:04
Wire cv300 into the neo build matrix as the third HiSi family on the
openipc/linux upstream-patches 7.0 base — after ev300_neo (kernels
6.6 / 6.18 / 7.0) and av300_neo (7.0). All upstream prerequisites
are in place:

  - OpenIPC/linux#42  arm: hisilicon: add hi3516cv300 SoC support
                      (CRG + DT + ARCH_HI3516CV300 Kconfig). The
                      defconfig pulls the upstream-patches tarball;
                      the cv300 DT lives there now, no
                      all-patches-neo/linux drop-in required.
  - openhisilicon PR  kernel/hi3516cv300: OSAL/peripheral compat-
                      shim port + cv300_neo CI matrix row. Pin
                      bumped separately in this branch.

Three new files:

  configs/hi3516cv300_neo_defconfig
    ARMv5 EABI, vendor v3 musl toolchain (kernel-headers stay at
    3.18 — toolchain ABI), upstream-patches kernel tarball,
    osdrv off + opensdk on, no wireguard-linux-compat (built into
    7.0). 8 MiB NOR layout matches lite.

  board/hi3516cv300/hi3516cv300.neo.config
    Seed kernel config enabling ARCH_HI3516CV300, HISI_FEMAC, SP804,
    VIC, squashfs+XZ, the cv300-relevant pinctrl. Expand with
    `make ARCH=arm olddefconfig` on first build.

  board/hi3516cv300/neo-post-image.sh
    Append hi3516cv300-demb.dtb to zImage and wrap as uImage at
    loadaddr 0x80008000 (same layout the cv500/av300 neo scripts
    use, retargeted to the cv300 DTB and chip name). Necessary
    because Buildroot's old mkimage path doesn't speak 7.0 uImage
    directly.

Verified end-to-end under qemu-hisilicon -M hi3516cv300: kernel
boots, FEMAC DHCP succeeds, NTP rolls the wall clock forward, no
Oops/panic/BUG/Trace on console or in dmesg.
Mirror of how ev300_neo / av300_neo are already wired into
.github/workflows/build.yml. With the board files added in the
previous commit (defconfig + neo kernel config + neo-post-image
script), the new row builds end-to-end against the openipc/linux
upstream-patches 7.0 base.
Pulls in OpenIPC/openhisilicon#148 — the cv300 OSAL/peripheral
source port to Linux 7.0 via new kernel_compat.h shims (PDE_DATA,
print_symbol, strscpy, do_gettimeofday + struct timeval,
rtc_time_to_tm, DEFINE_SEMAPHORE 1-arg). Required by the cv300_neo
board added in the previous commits — without this bump the
opensdk cv300 build won't compile against the upstream-patches
7.0 kernel.

Full upstream diff includes only the cv300-targeted shim additions
and source-side calls through them — no behaviour change to any
other platform. Existing cv500 / av300 / ev300 / gk7205v200 / etc.
opensdk builds are byte-identical (touched files are all under
kernel/{osal,init,ir,pwm,rtc,sensor*,sys_config,wdt}/hi3516cv300/
plus the additive-only kernel_compat.h block).
…ion fix)

The previous bump to b405551 inadvertently broke cv300_lite (kernel
3.18), cv500_lite / cv200_lite (kernel 4.9), and ev300_neo /
av300_neo (kernel 6.4+) builds.

Pulled in via OpenIPC/openhisilicon#150:

  - mmz/media-mem.c gated p4d_offset() on >= 4.11 (didn't exist on
    3.18, was added in 4.11 as 5-level paging prep)
  - wdt/ir/pwm/rtc/hi3516cv300 .c files: explicit
    <linux/module.h> include so MODULE_LICENSE() expands on 3.18
    (the chain via hi_osal.h only pulled it transitively on 7.0)
  - kernel_compat.h: print_symbol shim gated >= 5.15 not >= 4.0
    (function is still declared in <linux/kallsyms.h> through
    5.14; macro do { ... } while (0) collides with the prototype
    on 4.9)
  - kernel_compat.h: DEFINE_SEMAPHORE shim dropped the #undef +
    1-arg redefinition; kept only compat_DEFINE_SEMAPHORE helper.
    cv300 osal/mmz/media-mem.c updated to use the helper (matches
    cv500 mmz pattern).

Locally verified: hi3516cv300_lite build from this branch produces
a rootfs byte-equivalent to nightly (674 = 674 files, hisilicon .ko
set unchanged, QEMU lsmod + scrubbed dmesg identical).
@widgetii
Copy link
Copy Markdown
Member Author

opensdk hash re-bumped: `b405551 → b128a0c` to pull in OpenIPC/openhisilicon#150 — fixes the cv300_lite (kernel 3.18) build regression, plus collateral damage on cv500_lite / cv200_lite (kernel 4.9 `print_symbol` collision) and ev300_neo / av300_neo (kernel 6.4+ `DEFINE_SEMAPHORE` collision) introduced by the earlier #148 / b405551.

Locally verified: `make BOARD=hi3516cv300_lite` from this branch produces a rootfs byte-equivalent to nightly:

  • rootfs file list: 674 = 674, diff empty
  • `/lib/modules/3.18.20/hisilicon/` set: identical
  • QEMU `-M hi3516cv300` lsmod: identical (5 modules)
  • Scrubbed dmesg: 4 benign lines (build host, build time, +/-4K memory rounding, BogoMIPS jitter, random MAC)
  • No Oops/panic/BUG/Trace

widgetii added 3 commits May 17, 2026 15:19
…rops)

The opensdk hash bump in this PR (5b1aa42 → b128a0c) pulls in a number
of cv500-targeted ive_neo additions that grew kernel/ive_neo/ive_neo.c
from 66 KB to 130 KB of source. The .c also compiles for V4
(ev200 / gk7205v200) — Kbuild includes ive_neo/Kbuild in the V4
dispatch — so the stripped open_ive_neo.ko on V4 grew by ~20-30 KB,
which on its own pushes hi3518ev300_lite past the 5120 KB rootfs
partition cap (master was already at 5116/5120; new build: 5164/5120).

No V4 firmware actually loads open_ive_neo.ko:

  $ grep ive_neo /etc/init.d/* /usr/bin/load_*  (in ev300_lite nightly)
  (no matches)

So we don't need to ship the .ko on V4 boards. Add a TARGET_FINALIZE
hook that removes /lib/modules/<kver>/extra/open_ive_neo.ko after the
normal kernel-module install and re-runs depmod. The driver still
compiles in CI (Kbuild unchanged), and cv500 still ships it via its
own Kbuild include — only the install-to-rootfs step is skipped on V4.

Matches the existing FINALIZE_MODULES_GK7205V200 pattern that
selectively removes specific open_*.ko from extra/ after install.
Two changes to keep hi3518ev300_lite under its 5 MB rootfs cap after
the opensdk bump in this PR + majestic upstream's recent +41 KB
growth (same day this PR was opened).

1. V4 install-skip hook — extend the open_ive_neo.ko removal added
   in cb52453 to also drop open_adc.ko. Same justification:
   load_hisilicon / load_goke on V4 never insmod open_adc.ko, no
   init script references it, ev300_lite / gk7205v200_lite nightly
   rootfs both carry it as dead weight in /lib/modules/<kver>/extra/.
   ~6 KB compressed saving on V4. Renamed
   HISILICON_OPENSDK_SKIP_IVE_NEO_V4 → SKIP_UNUSED_V4 since the
   hook now covers a category, not a single module.

2. ev300_lite TRIM_SP2308 hook — also drop libsns_sc500ai.so and
   libsns_gc5603.so. This is a TEMPORARY measure with a real cost:
   any deployed ev300_lite camera using SC500AI (5 MP SmartSens)
   or GC5603 (5 MP GalaxyCore) will lose its sensor driver on the
   next sysupgrade from openipc.org-hosted images. The trim was
   needed today because majestic.hi3516ev200.lite.master.tar.bz2
   on S3 grew from 711 KB → 752 KB binary between yesterday's
   nightly and today's reupload, pushing the 5116/5120 KB master
   rootfs over the cap.

   Address in a follow-up PR via compaction (strip flags, dead
   code removal, partition rebalance) and restore the sensors.

Verified locally: hi3518ev300_lite rootfs.squashfs = 5112 KB /
5120 KB (8 KB headroom), trim hooks confirmed to run.
…anup

The previous commit added HISILICON_OPENSDK_SKIP_UNUSED_V4 with an
rsync from $(PER_PACKAGE_DIR)/hisilicon-opensdk/target/lib/modules/
gated on both hi3516ev200 AND gk7205v200. That rsync runs AFTER
HISILICON_OPENSDK_FINALIZE_MODULES_GK7205V200, undoing its cleanup:

  - FINALIZE_MODULES_GK7205V200 rsyncs from per-package, then removes
    open_{vi,vpss,venc,h264e,h265e,...}.ko from extra/ (these are
    renamed and put under goke/ as gk7205v200_*.ko).
  - SKIP_UNUSED_V4 immediately rsyncs again from per-package, which
    re-introduces all the open_*.ko files into extra/.

Result on gk7205v200_lite: rootfs.squashfs ballooned 5076 KB → 5660 KB
(580 KB regression), with the heavy V4 modules suddenly present in both
extra/ AND goke/. Caught by local build + gcc-compat CI failures.

Fix:
  - Fold the open_ive_neo + open_adc deletions directly into
    FINALIZE_MODULES_GK7205V200 so a single hook covers both the goke/
    rename cleanup and the unused-module skip on gk7205v200.
  - Keep the dedicated post-hook for hi3516ev200 only (no rename
    cleanup happens there, so the rsync + clean order is safe).

Verified locally: gk7205v200_lite rebuilds at 5064/5120 KB (56 KB
headroom, matches nightly's baseline), extra/ size 516 KB vs nightly's
552 KB (correctly smaller by the ive_neo + adc skip), goke/ intact.
@widgetii widgetii merged commit 96a0773 into master May 17, 2026
96 checks passed
@widgetii widgetii deleted the feat/cv300-neo branch May 17, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant