hisilicon-osdrv-hi3516cv200: rmmod openhisilicon source modules by open_* name#2029
Conversation
…en_* name load_hisilicon issued `rmmod -w` against vendor file names (`mmz`, `hi_media`, `sys_config`, `sensor_i2c`, `sensor_spi`, `hi3518e_isp`, `hi_mipi`, `pwm`, `wdt`) for modules openhisilicon ships with `KBUILD_MODNAME=open_*`. Those rmmods miss silently with "No such file or directory", and on cv200 specifically that breaks the insert_detect → remove_detect → insert_ko chain: when fw_env.config isn't readable (or the env has no `sensor` key), load_hisilicon falls through to autodetect — partial unload from name-mismatched rmmods leaves `open_mmz` loaded; insert_ko's `insmod mmz.ko ... || report_error` then hits "module already loaded", calls report_error, exits the script. /dev/sys never re-appears, majestic dies with "Cannot get chip id". This is exactly the user-reported regression on hi3518ev200 / JXF22 in OpenIPC 2.6.04.27-lite that prompted #62 / #63. cv200 is partly-aligned: Strategy B blob-wrapped modules (hi3518e_base, hi3518e_sys, hi3518e_<video>, hi3518e_<audio>, acodec) keep their vendor names because the vendor blob's .gnu.linkonce.this_module wins the link, so their `rmmod -w` calls don't change. Only the Strategy C source-built modules need the rename. Verified live on real hi3516cv200 / hi3518ev200 hardware (camera at 10.216.128.43, OpenIPC 2.6.04.28, JXF22 sensor): $ load_hisilicon -r 2>&1 ... rmmod: can't unload module 'tlv_320aic31': No such file or directory # expected rmmod: can't unload module 'hifb': No such file or directory # expected $ lsmod | grep -v '^(8188fu|cfg80211|vfat|fat)' | wc -l 5 # all camera modules unloaded $ load_hisilicon -i 2>&1 ==== Your input Sensor type is jxf22 ==== $ ls /dev/sys /dev/sys $ lsmod | wc -l 32 $ majestic ... [sdk] start_sdk@557: HiSilicon SDK started ... [rtsp] rtsp_init@28: RTSP server started on port 554 Two consecutive -r/-i cycles ran without errors. With the original script, the same -r leaves open_mmz/open_himedia/open_sys_config/ open_sensor_i2c/open_isp/open_mipi_rx/open_pwm/open_wdt loaded under their KBUILD_MODNAME, and the next -i hits report_error. Refs OpenIPC/openhisilicon#62, OpenIPC/openhisilicon#63.
Autodetect-path verification on real hi3516cv200 hardwareUpdated my testing to exercise the actual user-bug code path ( SetupCamera: Procedure
Result
Why this validates the user's reportThe original report had This test reproduced that exact failure path in a controlled way (stub fw_printenv → guaranteed autodetect entry) and confirmed the patched script lands in a working state instead. The earlier "verified live" claim only covered the |
Summary
load_hisiliconfor hi3516cv200 (V2; covers hi3516cv200 / hi3518ev200 / hi3518ev201) issuedrmmod -wagainst vendor file names (mmz,hi_media,sys_config,sensor_i2c,sensor_spi,hi3518e_isp,hi_mipi,pwm,wdt) for modules openhisilicon ships withKBUILD_MODNAME=open_*. Those rmmods miss silently with "No such file or directory".The cv200 failure path is more visible than other platforms: when
fw_env.configisn't readable (or the env has nosensorkey),load_hisiliconfalls through to autodetect. Partial unload from name-mismatched rmmods leavesopen_mmzloaded;insert_ko'sinsmod mmz.ko … || report_errorthen hits "module already loaded", callsreport_error, exits the script./dev/sysnever re-appears,majesticdies withCannot get chip id.This is exactly the regression originally reported by a XiongMai X50H20L_18EV200_S38 user on OpenIPC 2.6.04.27-lite — see
OpenIPC/openhisilicon#62for the full investigation.Why cv200 needs only a partial rename
Verified by extracting
.gnu.linkonce.this_modulefrom a live cv200 rootfs:mmz.koopen_mmzhi_media.koopen_himediasys_config.koopen_sys_configsensor_i2c.koopen_sensor_i2csensor_spi.koopen_sensor_spihi3518e_isp.koopen_isphi_mipi.koopen_mipi_rxpwm.koopen_pwmwdt.koopen_wdthi3518e_base.kohi3518e_basehi3518e_sys.kohi3518e_syshi3518e_{adec,aenc,ai,ao,aio}.kohi3518e_{...}hi3518e_{venc,h264e,...,vpss,viu,vgs,region,tde,ive,chnl,jpege,rc}.kohi3518e_{...}acodec.koacodecStrategy B blob-wrapped modules (everything in bold) keep their vendor names because the vendor
.o's.gnu.linkonce.this_modulewins the link, so theirrmmod -wcalls don't change. Only Strategy C source-built modules need the rename.Live verification
Tested on real hi3516cv200 hardware (
hi3518ev200, OpenIPC 2.6.04.28, JXF22 sensor, MMZ 32M):Two consecutive
-r/-icycles ran without errors.For comparison, with the original script the same
-rleavesopen_mmz/open_himedia/open_sys_config/open_sensor_i2c/open_isp/open_mipi_rx/open_pwm/open_wdtorphaned inlsmod, and the next-ihitsreport_erroratinsert_mmz'sinsmod mmz.ko ... || report_error— bricking majestic.Refs
OpenIPC/openhisilicon#62— root-cause investigation, includes the user's original XiongMai X50H20L_18EV200_S38 failure log.OpenIPC/openhisilicon#63— CI assertions PR. CV200 stays masked there byOpenIPC/openhisilicon#64(sys.ko EPERM in qemu-hisilicon's cv200 emulation), so the QEMU CI loop won't catch this — real-hardware test above is the validation.OpenIPC/firmware#2026(cv500),#2027(cv100),#2028(3519v101).Scope and follow-ups
15 rmmod call sites updated. Strategy B blobs and external modules (
tlv_320aic31,hifb, audio Strategy B, video Strategy B,acodec) preserved.Sibling cv200-family platforms still TODO:
hi3516av100(V2A; blocked by#65in CI but the rename pattern should mirror this).hi3516cv300(V3; blocked by#66).