Hi,
we are trying to debug some problems with a driver and we were trying to use the devmem2 utility to read memory adresses directly. But after mounting /proc/mem and printing the address it completely breaks the system (confirmed by the CPU hard lock-up printed by the UART interface). This is not a problem of the iomem configuration (that in Ubuntu has to be in “relaxed” mode, and we also tried) but trying to directly access memory completely makes the system to hung, which clearly shouldn’t happen. If anyone has experienced this problem and/or found a solution (we are now trying to figure it out) please let me know.
Hi,
maybe the utility tries to reference a memory address protected by PMP? It would explain the behavior you described.
You can see the PMP configuration printed out to a console early during boot process.
Are you accessing device MMIO through /dev/mem? If so, make sure you rebuild kernel with this patch (I think you are already aware of it) riscv: asm: fix EIC770X sys/mem port conversion by ganboing · Pull Request #9 · sifiveinc/riscv-linux · GitHub
Unfortunately SiFive//ESWIN haven’t merged this PR yet, so the latest kernel release is still buggy, and you need to manually patch the kernel tree and build the kernel yourself to avoid this bug.
Hi @japorod ,
Can you please help me for which address devmem2 is causing board hang?
Hi,
Actually it seems like in the last Linux Kernel Update they fixed it, so now the problem is solved (we were working with the previous to last kernel Release). @hiten It would basically happen with any address basically.