hi3516cv6xx: disable CONFIG_IO_STRICT_DEVMEM#2170
Merged
Merged
Conversation
…regs The kernel defconfig added in #2167 ships with both CONFIG_STRICT_DEVMEM=y and CONFIG_IO_STRICT_DEVMEM=y. The latter rejects any /dev/mem mmap whose range overlaps a page that has been claimed by a driver via request_mem_region(), even for root. On Hi3516CV608 that blocks userspace access to every page driven by the kernel -- CRG/clocks @ 0x11010000, I2C @ 0x11060000, SPI @ 0x11070000, GPIO @ 0x11090000+, UART @ 0x11040000+ -- making ipctool, ipcinfo -s and similar hardware-discovery tools unable to read PLL configuration, probe sensors over I2C/SPI, or dump GPIO state. Every other HiSilicon board in the tree that uses CONFIG_STRICT_DEVMEM=y explicitly disables CONFIG_IO_STRICT_DEVMEM (hi3516av100, hi3516dv100, hi3516cv500, hi3516av300, hi3516dv300, hi3516ev200, hi3516ev300, hi3516dv200, hi3536dv100, ...). Align hi3516cv6xx with that convention. The basic devmem hardening (CONFIG_STRICT_DEVMEM=y, requiring CAP_SYS_RAWIO and gating non-RAM regions) is preserved. Only the stronger I/O lockout that conflicts with diagnostic userspace is dropped. Verified on hi3516cv6xx target with kernel 5.10.221: before, every ipctool probe of a claimed page returned EPERM; after, ipctool reads CRG/I2C/SPI/GPIO normally and prints a complete YAML report. Companion userspace patch in OpenIPC/ipctool#172 falls back from a 64 KiB to a single-page mmap on EPERM, which recovers chip-ID detection even on kernels that keep IO_STRICT_DEVMEM on. 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
Repro (before)
On OpenIPC `hi3516cv6xx` build, kernel 5.10.221:
```
ipctool
read_mem_reg mmap error: Operation not permitted (1)
ipcinfo -s
read_mem_reg mmap error: Operation not permitted (1)
busybox devmem 0x11010000 32
devmem: mmap: Operation not permitted # CRG/clock0, kernel-claimed
```
Same EPERM behaviour on 0x11040000 (UART), 0x11060000 (I2C), 0x11090000 (GPIO).
Related
Test plan
🤖 Generated with Claude Code