Hey,
I’m currently working on a research project on RISC-V where I try to protect memory regions from either OpenSBI or the kernel. Unfortunately I can’t get PMP to work on the BeagleV Ahead.
Every time I boot up the system, the OpenSBI PMP detection prints:
Boot HART PMP Count : 0
Boot HART PMP Granularity : 0
Boot HART PMP Address Bits: 0
This detection simply checks if the PMP CSRs are writable, so I’m pretty confident that it should print 8 or 16 if the chip behaves correctly (The official C910 documentation states that there are options with either 8 or 16 PMP registers, so I assume my machine has at least 8).
My current guess is that either PMP is broken on the C910 (TH1520) or that some software I currently have no control of already sets the PMP registers and sets them locked so that I can’t change them later. What stands against this guess is that reading from the pmp registers returns 0, which I would not assume even in the locked case.
I already tried to patch the two projects I’m currently aware of that could setup PMP related functionality:
- U-Boot (used GitHub - chainsx/thead-u-boot: th1520(LicheePi 4A) BSP u-boot); I even ripped out any occurence of pmpcfg and pmpaddr in the entire repo to be sure that it does not set up PMP
- OpenSBI (also tried upstream which failed with
init_coldboot: timer init failed (error -3)
)
Here are my main questions:
- Has someone found PMP working on the C910 (TH1520)?
- I found that the Linux kernel sets up PMP in early boot when it is compiled with M_MODE. Is PMP required to be setup to do memory writes? I assumed when PMP is not setup it just performs no checks.
- Is there some other software involved in setting up PMP before U-Boot or in between the jump from U-Boot to OpenSBI?