kernel/osal_v2_shim,osal_v2a_shim: cover the full V2/V2A blob-symbol set#170
Merged
Conversation
PRs #162 and #165 landed the initial V2/V2A bring-up shims based on the issue #50 audit (4 symbols for cv200, 3 for av100). Exercising the real firmware build for the first time (hi3516cv200_neo via the upstream-patches 7.0 base) surfaced 8 more undefined symbols that issue #50 missed — the audit only covered blob source-imports, not the compiler-generated calls (memset → __memzero, kmalloc → __kmalloc internal slowpath, etc.) and not the symbols pulled in via inline- function expansion at blob-build time against the 4.9 kernel headers. This commit extends both shims (V2 cv200 + V2A av100) to cover every symbol modpost reports as undefined for the V2/V2A blob set on Linux 7.0. Verified empirically: hi3516cv200_neo now builds, boots in QEMU to a login prompt, and meets the openipc/firmware QEMU DoD (eth0 link, DHCP via SLIRP, ping 10.0.2.2). hi3516cv200_lite and hi3516av100_lite (kernel 4.9 production targets) rebuilt against this tree are byte-equivalent to nightly: - cv200_lite: 331/331 rootfs files, 68/68 hisilicon .ko, sets identical - av100_lite: 290/290 rootfs files, 61/61 hisilicon .ko, sets identical kernel/compat/kernel_compat.h adds: - pte_offset_map(pmd, addr) -> pte_offset_kernel(...) on >= 6.5. Modern pte_offset_map() inlines to __pte_offset_map() which is NOT EXPORT_SYMBOL'd, so modules can't link it. pte_offset_kernel is a static inline over pmd_page_vaddr() + pte_index() — same user-page-table lookup the legacy code already did without locking. Source-side fix because the call is in our own cv200/av100 mmz-userdev usr_virt_to_phys, not the blob. Both shim modules add the following exports (gated >= 5.0 so 4.9 lite stays a no-op shell): Symbol Modern equivalent we forward to ────────────────── ─────────────────────────────────────── _cond_resched __cond_resched __kmalloc __kmalloc_noprof (6.5+) kmem_cache_alloc kmem_cache_alloc_noprof (7.0 macro) __memzero memset(ptr, 0, n) PDE_DATA pde_data (5.17 rename) printk vprintk via _printk (6.0 rename) register_sysctl_paths register_sysctl_sz / register_sysctl jiffies_to_msecs (MSEC_PER_SEC / HZ) * j — header inline del_timer timer_delete (7.0 rename) vmalloc vmalloc_noprof (7.0 macro) dev_err dev_vprintk_emit at KERN_ERR sched_setscheduler sched_set_fifo / sched_set_normal — caller priority is dropped (sched_set_fifo doesn't accept one); SCHED_RR mapped to FIFO. Best- effort for legacy blobs that just want "raise above SCHED_NORMAL". Two header-collision cases needed a Kbuild-level macro rename (passed as -D... in CFLAGS_) so the static-inline definition in <linux/sched.h> / <linux/jiffies.h> doesn't conflict with our EXPORT_SYMBOL'd function under the same name: - _cond_resched (static inline since 5.10 preempt-dynamic rework; commit fe32d3cd5e8e) - jiffies_to_msecs (static inline when HZ | MSEC_PER_SEC — HZ=100 production config) For the macro-style conflicts (kmem_cache_alloc, vmalloc, PDE_DATA, printk, dev_err, del_timer) #undef in the shim source is sufficient. Out of scope for this commit (still tracked in issue #51): - struct timer_list .data ABI drift (chnl/viu/vpss blobs) — the shim resolves init_timer_key but timers don't fire with the correct argument until the blob is recompiled. Documented in both shim sources. Surfaces as broken video pipeline on cv200_neo / av100_neo; not a load-time error. - hi3516av100 mainline DT / CRG — av100_neo firmware target is blocked on a separate openipc/linux PR (av100 has no mainline Kconfig / DT / clock-driver support yet, unlike cv200 which landed in OpenIPC/linux#43). cv200_neo unblocked. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
widgetii
pushed a commit
that referenced
this pull request
May 22, 2026
Two follow-ups discovered while exercising the hi3516av100_neo firmware build for the first time (cv200 was unblocked by #170; av100 hit two further issues this commit closes): - kernel/hi3516av100.kbuild: gate open_pm.ko build behind DISABLE_PM (opensdk already passes DISABLE_PM=1 by default; matching the gate makes the directive effective). The vendor blob hi3516a_pm.o references dev_pm_opp_init_cpufreq_table, cpufreq_table_validate_and_show, cpufreq_generic_attr — all removed in mainline. Even with CONFIG_CPU_FREQ + REGULATOR enabled, modpost still fails. open_pm.ko is the AVS / CPU-DVFS blob; not needed for boot. Lite (4.9) is unaffected — the DISABLE_PM=1 default already applied there and the previous unconditional obj-m made it a no-op anyway. - osal_v2_shim/cv200_shim.c, osal_v2a_shim/av100_shim.c: add dev_warn export. Same shape as the dev_err shim landed in #170 — macro in <linux/dev_printk.h> that funnels through _dev_err; variadic wrapper via dev_vprintk_emit at KERN_WARNING (loglevel digit 4). av100 blobs reference dev_warn from open_pm (gated out above) and from other vendor sources; safer to ship the shim for symmetry. Verified end-to-end: hi3516av100_neo now builds and boots to login prompt with eth0 up via the new mainline higmac driver (openipc/linux feat/av100-mainline), DHCP from SLIRP, ping 10.0.2.2 succeeds. cv200_neo continues to meet the same DoD. cv200_lite and av100_lite (4.9 kernel) remain byte-equivalent to nightly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
4 tasks
widgetii
pushed a commit
that referenced
this pull request
May 22, 2026
Two follow-ups discovered while exercising the hi3516av100_neo firmware build for the first time (cv200 was unblocked by #170; av100 hit two further issues this commit closes): - kernel/hi3516av100.kbuild: gate open_pm.ko build behind DISABLE_PM (opensdk already passes DISABLE_PM=1 by default; matching the gate makes the directive effective). The vendor blob hi3516a_pm.o references dev_pm_opp_init_cpufreq_table, cpufreq_table_validate_and_show, cpufreq_generic_attr — all removed in mainline. Even with CONFIG_CPU_FREQ + REGULATOR enabled, modpost still fails. open_pm.ko is the AVS / CPU-DVFS blob; not needed for boot. Lite (4.9) is unaffected — the DISABLE_PM=1 default already applied there and the previous unconditional obj-m made it a no-op anyway. - osal_v2_shim/cv200_shim.c, osal_v2a_shim/av100_shim.c: add dev_warn export. Same shape as the dev_err shim landed in #170 — macro in <linux/dev_printk.h> that funnels through _dev_err; variadic wrapper via dev_vprintk_emit at KERN_WARNING (loglevel digit 4). av100 blobs reference dev_warn from open_pm (gated out above) and from other vendor sources; safer to ship the shim for symmetry. Verified end-to-end: hi3516av100_neo now builds and boots to login prompt with eth0 up via the new mainline higmac driver (openipc/linux feat/av100-mainline), DHCP from SLIRP, ping 10.0.2.2 succeeds. cv200_neo continues to meet the same DoD. cv200_lite and av100_lite (4.9 kernel) remain byte-equivalent to nightly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
widgetii
added a commit
that referenced
this pull request
May 22, 2026
…0/av100 neo unblock) (#171) * kernel/obj/hi3516cv200,hi3516av100: ship stub .o.cmd files for modpost Linux 7.0 modpost (scripts/mod/modpost.c) calls read_text_file() on the .<basename>.o.cmd sibling of every .o referenced from a module's .mod list, and exits non-zero if the file is missing. For prebuilt blob .o files (cv200's hi3518e_*.o, av100's hi3516a_*.o) there's no kbuild rule that generates the .cmd — they're committed binaries with no build metadata. cv500 already has these .cmd files committed (31 of them, dating back to the cv500 mainline-kernel bring-up). cv200 and av100 didn't — which worked fine on 4.9 lite (modpost was lax) and on standalone CI builds (actions/checkout fetches dotfiles), but breaks on firmware-tarball neo builds where the github-archive tarball strips them. Each .cmd is a one-line stub: savedcmd_kernel/obj/<chiparch>/<obj>.o := : satisfying modpost's read_text_file() without claiming any CRC info (no #SYMVER lines). Linker symbol resolution is unaffected. 47 files total (21 cv200 + 26 av100). Unblocks cv200_neo and av100_neo firmware builds end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * kernel/hi3516av100,osal_v2[a]_shim: gate open_pm + add dev_warn shim Two follow-ups discovered while exercising the hi3516av100_neo firmware build for the first time (cv200 was unblocked by #170; av100 hit two further issues this commit closes): - kernel/hi3516av100.kbuild: gate open_pm.ko build behind DISABLE_PM (opensdk already passes DISABLE_PM=1 by default; matching the gate makes the directive effective). The vendor blob hi3516a_pm.o references dev_pm_opp_init_cpufreq_table, cpufreq_table_validate_and_show, cpufreq_generic_attr — all removed in mainline. Even with CONFIG_CPU_FREQ + REGULATOR enabled, modpost still fails. open_pm.ko is the AVS / CPU-DVFS blob; not needed for boot. Lite (4.9) is unaffected — the DISABLE_PM=1 default already applied there and the previous unconditional obj-m made it a no-op anyway. - osal_v2_shim/cv200_shim.c, osal_v2a_shim/av100_shim.c: add dev_warn export. Same shape as the dev_err shim landed in #170 — macro in <linux/dev_printk.h> that funnels through _dev_err; variadic wrapper via dev_vprintk_emit at KERN_WARNING (loglevel digit 4). av100 blobs reference dev_warn from open_pm (gated out above) and from other vendor sources; safer to ship the shim for symmetry. Verified end-to-end: hi3516av100_neo now builds and boots to login prompt with eth0 up via the new mainline higmac driver (openipc/linux feat/av100-mainline), DHCP from SLIRP, ping 10.0.2.2 succeeds. cv200_neo continues to meet the same DoD. cv200_lite and av100_lite (4.9 kernel) remain byte-equivalent to nightly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Vasiliy Yakovlev <vixand@openipc.org> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 22, 2026
Merged
Open
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
Extends the V2 (cv200, #162) and V2A (av100, #165) blob-symbol shims to cover the full undefined-symbol set revealed by exercising the real firmware build for the first time. The original PRs based the shim contents on the issue #50 audit (4 symbols for cv200, 3 for av100), which only counted explicit blob source-imports. Modpost on the actual
hi3516cv200_neofirmware build surfaced 8 more undefined symbols pulled in via inline-expansion at blob-build time against 4.9 headers (e.g.memset → __memzero,kmalloc → __kmalloc).Plus one source-side compat shim for
pte_offset_map(its inline now calls the unexported__pte_offset_mapon 6.5+).Verification
Built end-to-end against the merged opensdk-bumped firmware tree:
hi3516cv200_neohi3516cv200_lite.koset — byte-equivalent to nightlyhi3516av100_lite.koset — byte-equivalent to nightlycv200_neo QEMU DoD report:
Symbols added to both shims (gated >= 5.0)
_cond_resched__cond_resched__kmalloc__kmalloc_noprof(6.5+)kmem_cache_allockmem_cache_alloc_noprof(7.0 macro)__memzeromemset(ptr, 0, n)PDE_DATApde_data(5.17 rename)printkvprintkvia_printk(6.0 rename)register_sysctl_pathsregister_sysctl_sz/register_sysctljiffies_to_msecs(MSEC_PER_SEC / HZ) * jdel_timertimer_delete(7.0 rename)vmallocvmalloc_noprof(7.0 macro)dev_errdev_vprintk_emitatKERN_ERRsched_setschedulersched_set_fifo/sched_set_normal— best-effort, drops caller prioritySource-side compat
kernel/compat/kernel_compat.haddspte_offset_map(pmd, addr) → pte_offset_kernel(...)on >= 6.5. Modernpte_offset_map()inlines to the unexported__pte_offset_map()so modules can't link it;pte_offset_kernelis a static inline overpmd_page_vaddr() + pte_index()— same lookup, no exported-symbol dep, matches the (unlocked) semantics of the legacy code.Header collisions
_cond_reschedandjiffies_to_msecsarestatic inlinein modern kernel headers — function definitions under the same name collide. Both Kbuilds (hi3516cv200.kbuild,hi3516av100.kbuild) pass a per-shim-D<sym>=...rename inCFLAGS_<obj>so the static-inline definition is suppressed during header processing; the shim source then#undefs the rename and provides the legacy export.Macro-style conflicts (
kmem_cache_alloc,vmalloc,PDE_DATA,printk,dev_err,del_timer— last one collides with our ownkernel_compat.hsource-side rename) handled with#undefin the shim source.Out of scope (still tracked in #51)
struct timer_list.dataABI drift (chnl/viu/vpss blobs) — the shim resolvesinit_timer_keybut timers don't fire with the correct argument until the blob is recompiled. Documented in both shim sources. Surfaces as broken video pipeline on cv200_neo / av100_neo; not a load-time error.Test plan
hi3516cv200_neoQEMU smoke meeting DoD (login + ping)hi3516cv200_lite(4.9) byte-equivalence vs nightlyhi3516av100_lite(4.9) byte-equivalence vs nightly🤖 Generated with Claude Code