kernel/ive_neo: support hi3516cv500 alongside hi3516ev200#105
Merged
Conversation
Extend ive_neo to build and run on cv500 (CHIPARCH=hi3516cv500, board hi3516av300) in addition to the existing V4 family (hi3516ev200/ev300, gk7205v200/v300). cv500 has a classic-only IVE block at 0x11230000 — no fused NEO/XNN unit like V4 has at 0x11320000 — so XNN ioctls return -EOPNOTSUPP and the 24 classic IVE ops (DMA, Filter, Sobel, Thresh, CCL, SAD, CannyHysEdge, GMM2, ...) work as on V4. CNN inference on cv500 lives on a separate NNIE block at 0x11100000 and is out of scope for this PR (will land as a separate NNIE backend later). The port introduces a compile-time chip-ops table in ive_neo.c (has_xnn flag, standalone_base, setup_mem_speed function pointer) and splits the OSAL/CMPI ABI by chip: V4 uses CMPI_GetModuleFuncById + SYS_EXPORT_FUNC_S->pfnSysDrvIoCtrl with cmds 144/145; cv500 uses cmpi_get_module_func_by_id + sys_export_func->pfn_sys_drv_ioctrl with SYS_IVE_RESET_SEL/SYS_IVE_CLK_EN. The four ev200-only register writes in ive_hw_init (offsets 0x34/0x54/0x60/0x8C — outside cv500's IVE window) are gated out on cv500, and the [0x90] DRAM-arbitration sequence is skipped (only Conv needs it, and cv500's IVE has no Conv). Two on-target bugs caught during verification and fixed: - cv500 register writes outside its IVE window faulted with sync-abort (gated with #if !defined(hi3516cv500)) - ive_svp_init pre-read at regs+0x80 hung the board on cv500 because cv500 boots with the IVE clock gated off; reorder to run hw_init (which calls ive_assert_clock_cv500) before any IVE register read cv500 reuses the kmalloc+virt_to_phys MMZ path from the QEMU standalone build because cv500's vendor headers don't expose the CMPI MMZ symbols. ive_init.c switches to plain Linux kernel types and picks hi_osal.h on cv500 vs osal.h+common.h on V4 so the same source tree builds for both families. CI: extend the toolchain matrix step to verify open_ive_neo.ko is actually produced for ev200/gk7205v200/cv500 and that the chip-ops backend selection baked the right name in. Also assert that cv500 builds DCE the XNN dispatch (no "FC layer using non-tiled" string in the .ko) — a sanity check that the has_xnn=false guard isn't bypassed in future refactors. Verified on lab boards 2026-05-13: - ev300 (CHIPARCH=hi3516ev200): chip=hi3516ev200 xnn=yes, HW ID 0x11e1a300, [0x90]=0x01ab5159, SVP_INIT returns 0. - av300 (CHIPARCH=hi3516cv500): chip=hi3516cv500 xnn=no, [0x90] skipped, HW ID 0x11e1a300, SVP_INIT returns 0. - QEMU ive_ops regression (hi3516ev300 model): 19/19 ops pass. A board-side smoke test script at kernel/ive_neo/test/board/ verify-on-target.sh runs the same checks across both lab boards via ssh; the firmware build artefacts in kernel/ive_neo/test/qemu/ now have a .gitignore. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The first CI run on PR #105 hit FAIL: open_ive_neo.ko not built for hi3516ev200 even though the build step succeeded. With HISILICON_OPENSDK_SITE_METHOD=local and HISILICON_OPENSDK_VERSION cleared, buildroot's per-package build dir name isn't deterministic across versions — locally it lands at hisilicon-opensdk-custom/ but in CI the pkg-generic.mk fallback uses a different suffix. Walk the entire output/ tree instead, and on failure dump candidate dir names + any other open_*.ko found so future regressions surface the actual path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 13, 2026
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
ive_neoto build and run on cv500 (CHIPARCH=hi3516cv500, boardhi3516av300) in addition to the existing V4 family (ev200/ev300, gk7205v200/v300).0x11230000— no fused NEO/XNN unit like V4 has at0x11320000— so XNN ioctls return-EOPNOTSUPPon cv500 and the 24 classic IVE ops (DMA, Filter, Sobel, Thresh, CCL, SAD, CannyHysEdge, GMM2, …) work as on V4. CNN inference on cv500 lives on a separate NNIE block at0x11100000and is out of scope for this PR (NNIE backend will land later).What's in
kernel/ive_neo/ive_neo.cive_neo_chiptable (has_xnn,standalone_base,setup_mem_speed), selected via$(CHIPARCH).CMPI_GetModuleFuncById(2)→SYS_EXPORT_FUNC_S→pfnSysDrvIoCtrl(chn, 144=reset, 145=clk_en),MPP_CHN_S.cmpi_get_module_func_by_id(HI_ID_SYS)→sys_export_func→pfn_sys_drv_ioctrl(chn, SYS_IVE_RESET_SEL, SYS_IVE_CLK_EN),hi_mpp_chn.ive_hw_init(offsets0x34/0x54/0x60/0x8C— outside cv500's IVE window) gated with#if !defined(hi3516cv500).[0x90]DRAM-arbitration sequence skipped on cv500 (only Conv needs it; cv500's IVE has no Conv).loadmodel,unloadmodel,forward,fwd_slice,query,open_dev) early-return-EOPNOTSUPPwhen!ive_neo_chip.has_xnn.ioremap(0x11320000, …)paths inive_svp_init/ive_submit_nonxnn/ive_op_canny_hys— OSAL mode now hard-fails-ENODEVif DT probe didn't run, standalone usesive_neo_chip.standalone_base.ive_init.cswitches to plain Linux kernel types and pickshi_osal.hon cv500 vsosal.h+common.hon V4 so the same source compiles for both families.kmalloc + virt_to_phys + osal_flush_dcache_areaMMZ path from the QEMU standalone build (cv500 vendor headers don't exposeCMPI_*MMZ symbols).Build wiring
kernel/hi3516cv500.kbuildnow includesive_neo/Kbuildalongside the vendor\$(PREFIX)ive.oblob. Bothopen_ive.ko(vendor) andopen_ive_neo.ko(clean-room) ship — init scripts pick one at runtime, same coexistence pattern as on ev200.Two cv500 bugs caught during on-target verification
0x34/0x54/0x60/0x8Cto V4 only.ive_svp_init(readingregs+0x80andregs+0x04to decide whether to re-init) hung cv500 because the IVE clock is gated off at boot —ive_assert_clock_cv500runs insidehw_init, so the pre-read fired before clocks. Fixed by going straight tohw_initon the first call; the cheap pre-check only fires on subsequent calls.CI additions
Extended the toolchain matrix step (
Verify ive_neo built for this platform) to gate ev200/gk7205v200/cv500 rows on:open_ive_neo.koexists in the build output.chip=%s xnn=%s base=0x%xis present in the.ko.hi3516cv500for the cv500 row,hi3516ev200for the V4 rows).FC layer using non-tiledstring in the.ko) — sanity check that thehas_xnn=falseguard isn't bypassed in future refactors. The XNN-reject log line is kept as a positive guard.The
qemu-ive-opsjob continues to run the existing 19-op register regression against thehi3516ev300QEMU machine model (cv500 doesn't model the clock-gate cleanly enough to be a useful end-to-end test for this driver — that's why the bug only surfaced on hardware).Test plan
make BOARD=hi3516ev300_lite … br-hisilicon-opensdk-rebuild—open_ive_neo.ko29132 B, containshi3516ev200+ new chip-ops log strings.make BOARD=hi3516av300_lite … br-hisilicon-opensdk-rebuild—open_ive_neo.ko26432 B (smaller, XNN code DCE'd), containshi3516cv500+skipping [0x90] mem-speedstrings.kernel/ive_neo/test/qemu/run-qemu.sh): 19/19 ops pass underhi3516ev300model./dev/ivepresent,ioctl(SVP_INIT)returns 0, dmesg showschip=hi3516ev200 xnn=yes base=0x11320000,HW ID=0x11e1a300,[0x90]=0x01ab5159./dev/ivepresent,ioctl(SVP_INIT)returns 0, dmesg showschip=hi3516cv500 xnn=no base=0x11230000,skipping [0x90] mem-speed,HW ID=0x11e1a300,svp_init: svp_alg phys=0x9dc6e000. Board stays up across reload cycles.Verify ive_neo built for this platform) green on the matrix.The on-target smoke test driver lives at
kernel/ive_neo/test/board/verify-on-target.shfor anyone with ssh to the same lab boards.🤖 Generated with Claude Code