Attention is currently required from: Philipp Hug, ron minnich.
Hello Philipp Hug, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/81152?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed: Verified-1 by build bot (Jenkins)
Change subject: arch/riscv: use PMP ......................................................................
arch/riscv: use PMP
With this change, a simple S-mode payload works: 1: li a7, 1 li a0, 48 ecall j 1b
Without this change, it will not work.
Linux also boots with this on the command line: clk_ignore_unused
Resolving that problem will require a separate patch.
Getting this to build on RV32 required changes to the API, as it was incorrect. In RV32, PMP entries are 34 bits. Hence, the setup_pmp needed to accept u64. So, uinptr_t can not be used, as on 32 bits they are only 32 bit numbers. The internal API uses uintptr_t, but the exported API uses u64, so external code does not have to think about right shifts on base and size.
Errors are detected: an error in base and size will result in a BIOS_EMERG print, but not a panic. Boots not bricks if possible.
There are small changes to the internal API to reduce stack pressure: there's no need to have two pmpcfg_t on the stack when one will do.
PMPs are just packed with all kinds of special cases. There are no requirements that you read back what you wrote to the PMPaddr registers. An SoC can just decide it only does 4096-byte granularity, and that is your problem if you wanted finer granulatiry. SoC's don't have to implement all the high order bits either. Finally, since it's a memory address range, the SoC need only implement enough bits for the memory bus, not the address space of the chip!
PMPs are best used sparingly.
Change-Id: I8d7dd171ee69e83f3b904df38c7e2d36cc46a62e Signed-off-by: Ronald G Minnich rminnich@gmail.com --- M src/arch/riscv/include/arch/pmp.h M src/arch/riscv/payload.c M src/arch/riscv/pmp.c 3 files changed, 140 insertions(+), 32 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/81152/2