Hi,
I wish to come up with a PMP setting that covers the entire address space in 64 bit.
Per spec:
pmpaddr pmpcfg.A Match type and size
yyyy...yyy0 NAPOT 8-byte NAPOT range
yyyy...yy01 NAPOT 16-byte NAPOT range
yyyy...y011 NAPOT 32-byte NAPOT range
. . . . . . . . .
yy01...1111 NAPOT 2^XLEN -byte NAPOT range
y011...1111 NAPOT 2^XLEN+1 -byte NAPOT range
0111...1111 NAPOT 2^XLEN+2 -byte NAPOT range
1111...1111 NAPOT 2^XLEN+3 -byte NAPOT range
Therefore, if I set pmpaddr to be 0111...1111 (totally 54 bits here, and the top 10 bits in the pmpaddr register are hard-wired to 0 per spec), it would cover a range of size 2^56, which is already the max address range supported in Sv39 and Sv48, so this already covers the entire address space.
So, what is the meaning of the last entry (1111...1111)? I found out that Qemu defines the last entry to be
reserved. However, the spec still defines the range, in this case to be 2^57, but why supporting a range that's 2X the max address space available?
For software developers, what should be the canonical and blessed pmpaddr setting if they wish to cover the entire address space, 0111...1111 or 1111...1111?
Regards,
Chongfeng