Hi,
In an attempt to bring up my own OS kernel, a PMP access failure was
observed and I cannot explain why it happened.
This issue was seen with running the kernel on top of OpenSBI plus
U-Boot on the SiFive Unleashed board. The same kernel boots fine on
QEMU.
I reported the issue in the OpenSBI community and the discussion did
not end up with root cause identified.
https://github.com/riscv/opensbi/issues/103
Hence I posted it here for wider audience, especially someone from
SiFive may have some ideas.
I've created a test case to demonstrate the issue using OpenSBI to
load the test payload.
https://github.com/lbmeng/opensbi/commit/f3ba28f5e56e44dad8b1d008ff244bb2b0316dff
Basically the test codes sets up a PTE to map the 2GiB memory space
with the following mapping:
0xffffffff 80000000 - 0xffffffff ffffffff (V) maps to 0x80000000 -
0xffffffff (P)
But as soon as satp is written, the core firstly traps to the stvec
address in S-mode, but fetching the first instruction at stvec address
makes the core trap to mtvec with instruction access exception code.
Per my read of the privileged spec 1.10, what the test codes does
seems not wrong.
Either the spec needs some clarification about PMP access check, or
maybe, such test happen to trigger some silicon errata?
Regards,
Bin