hisilicon: load open_hwrng early in load_hisilicon (entropy)#2058
Merged
hisilicon: load open_hwrng early in load_hisilicon (entropy)#2058
Conversation
OpenIPC/openhisilicon#85 redesigns the on-die TRNG driver so it builds across V2/V3/V3A/V3.5/V4 and lands as open_hwrng.ko. Wire it into the boot path so the kernel entropy pool is primed before majestic / dropbear / openssl run getrandom(). For the 4 cv-family / V3A SoCs whose lib/modules/.../extra/open_*.ko files get wiped at finalize (see opensdk.mk's per-platform rename pass for hi3516cv500/cv300/cv200/3519v101), copy open_hwrng.ko verbatim into hisilicon/ so modprobe can find it via modules.dep. V4 (ev200/gk7205v200) already keeps modules in extra/ — no .mk change needed there. In each load_hisilicon, drop a single canonical: if [ "$b_arg_insmod" = "1" ]; then modprobe open_hwrng 2>/dev/null fi right after #parse arg end#. That's BEFORE the os_mem-vs-total_mem check (which exits when QEMU's mem= disagrees with U-Boot totalmem env) and BEFORE the SENSOR=unknown gate (which exits when sensor probe fails). Both paths previously silently skipped vendor module load; HWRNG must not be coupled to that, since entropy is platform-essential, not sensor-dependent. Verified end-to-end in QEMU under widgetii/qemu-hisilicon (HWRNG block emulation from its PR #54) on all five enabled platforms — every one boots to /dev/random returning entropy immediately, no getrandom() stall in userspace. Pairs with OpenIPC/openhisilicon#85. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Picks up OpenIPC/openhisilicon#85 — hybrid hwrng_register/pump driver universal across V2..V4 — needed for this PR's modprobe open_hwrng to have a module to load and for opensdk.mk's verbatim install of open_hwrng.ko to find the artifact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
open_hwrng.ko(from hisi-hwrng: hybrid hwrng_register/pump driver, universal V2..V4 openhisilicon#85) before any conditional exit inload_hisilicon. Previously the module wasn't loaded at all; once it lands as part of the openhisilicon PR it would get skipped by every existingos_mem >= total_memexit andSENSOR=unknowngate. Entropy is platform-essential, not sensor-dependent.#parse arg end#in all 5 scripts (cv200/cv300/cv500/3519v101/ev200):hisilicon-opensdk.mkremoveslib/modules/*/extra/open_*.ko. Add an explicit verbatim install ofopen_hwrng.kointo the per-platformhisilicon/dir somodprobefinds it viamodules.dep. ev200/gk7205v200 (V4 fall-through) keep modules inextra/— no.mkchange needed for those.hwrng_base = 0).Test plan
End-to-end QEMU runs under widgetii/qemu-hisilicon (HWRNG block emulation from its PR #54) for every supported platform. Each boots its released firmware tarball, loads
open_hwrngautomatically viaS70vendor→load_hisilicon -i, and reaches login with the entropy pool primed:hwrng-corehwrng-core + pumppumppumppump/dev/randomreturns immediately on every platform — Majestic / dropbear / openssl no longer block ongetrandom().dmesgshowshisi-hwrng: TRNG at <per-SoC base> registered (<mode>)on each/proc/sys/kernel/random/entropy_availnon-zero immediatelydd if=/dev/random bs=32 count=1returns instantly with random bytesrmmod can't unloadregressions (existing CI assertion)Pairs with
open_hwrng.komodule this PR loads.🤖 Generated with Claude Code