Page MenuHomeFreeBSD

Implement vm.pmap.kernel_maps for RISC-V
ClosedPublic

Authored by mhorne on Mon, Feb 10, 12:34 AM.

Details

Summary

This is taken from the arm64 version, with the following simplifications:

  • Our current pmap implementation uses a 3-level paging scheme
  • The "mode" field has been omitted since RISC-V PTEs don't encode typical mode attributes
Test Plan

Output from qemu:

root@qemu:~ # sysctl vm.pmap.kernel_maps
vm.pmap.kernel_maps: 
Kernel map:
0xffffffc000000000-0xffffffc000a00000 rwxs- 0 5 0
0xffffffc000c00000-0xffffffc000c10000 r--s- 0 0 16
0xffffffc000c10000-0xffffffc000c22000 rw-s- 0 0 18
0xffffffc000c43000-0xffffffc000c47000 rw-s- 0 0 4
0xffffffc000c48000-0xffffffc000c4c000 rw-s- 0 0 4
0xffffffc000c4d000-0xffffffc000c51000 rw-s- 0 0 4
0xffffffc000c52000-0xffffffc000c56000 rw-s- 0 0 4
0xffffffc000c57000-0xffffffc000c5b000 rw-s- 0 0 4
0xffffffc000c5c000-0xffffffc000c60000 rw-s- 0 0 4
0xffffffc000c61000-0xffffffc000c65000 rw-s- 0 0 4
0xffffffc000c66000-0xffffffc000c6a000 rw-s- 0 0 4
0xffffffc000c6b000-0xffffffc000c6f000 rw-s- 0 0 4
0xffffffc000c70000-0xffffffc000c74000 rw-s- 0 0 4
0xffffffc000c75000-0xffffffc000c81000 rw-s- 0 0 12
0xffffffc000c82000-0xffffffc000c86000 rw-s- 0 0 4
0xffffffc000c87000-0xffffffc000c8b000 rw-s- 0 0 4
0xffffffc000c8c000-0xffffffc000c90000 rw-s- 0 0 4
0xffffffc000c91000-0xffffffc000c9b000 rw-s- 0 0 10
0xffffffc000c9c000-0xffffffc000ca0000 rw-s- 0 0 4
0xffffffc000ca1000-0xffffffc000ca5000 rw-s- 0 0 4
0xffffffc000ca6000-0xffffffc000caa000 rw-s- 0 0 4
0xffffffc000cab000-0xffffffc000caf000 rw-s- 0 0 4
0xffffffc000cb0000-0xffffffc000cb4000 rw-s- 0 0 4
0xffffffc000cb5000-0xffffffc000cb9000 rw-s- 0 0 4
0xffffffc000cba000-0xffffffc000cbe000 rw-s- 0 0 4
0xffffffc000cbf000-0xffffffc000cc3000 rw-s- 0 0 4
0xffffffc000cc4000-0xffffffc000cc9000 rw-s- 0 0 5
0xffffffc000cca000-0xffffffc000cd0000 rw-s- 0 0 6
0xffffffc000cd1000-0xffffffc000cdb000 rw-s- 0 0 10
0xffffffc000cdc000-0xffffffc000ce1000 rw-s- 0 0 5
0xffffffc000ce2000-0xffffffc000ce8000 rw-s- 0 0 6
0xffffffc000ce9000-0xffffffc000ced000 rw-s- 0 0 4
0xffffffc000cee000-0xffffffc000cf2000 rw-s- 0 0 4
0xffffffc000cf3000-0xffffffc000cf7000 rw-s- 0 0 4
0xffffffc000cf8000-0xffffffc000cfc000 rw-s- 0 0 4
0xffffffc000e00000-0xffffffc001000000 rw-s- 0 0 512
0xffffffc001400000-0xffffffc001d6b000 rw-s- 0 0 2411
0xffffffc002000000-0xffffffc002009000 rw-s- 0 0 9
0xffffffc002010000-0xffffffc002019000 rw-s- 0 0 9
0xffffffc002020000-0xffffffc002021000 rw-s- 0 0 1
0xffffffc002028000-0xffffffc002029000 rw-s- 0 0 1
0xffffffc002030000-0xffffffc002031000 rw-s- 0 0 1
0xffffffc002038000-0xffffffc002051000 rw-s- 0 0 25
0xffffffc002058000-0xffffffc002059000 rw-s- 0 0 1
0xffffffc002060000-0xffffffc002079000 rw-s- 0 0 25
0xffffffc002080000-0xffffffc002081000 rw-s- 0 0 1
0xffffffc002088000-0xffffffc0020a1000 rw-s- 0 0 25
0xffffffc0020a4000-0xffffffc0020a5000 rw-s- 0 0 1
0xffffffc0020a8000-0xffffffc0020a9000 rw-s- 0 0 1
0xffffffc0020b0000-0xffffffc0020b1000 rw-s- 0 0 1
0xffffffc0020b8000-0xffffffc0020c2000 rw-s- 0 0 10
0xffffffc0020c8000-0xffffffc0020ca000 rw-s- 0 0 2
0xffffffc0020d0000-0xffffffc0020d9000 rw-s- 0 0 9
0xffffffc0020e0000-0xffffffc0020e1000 rw-s- 0 0 1
0xffffffc0020e8000-0xffffffc0020e9000 rw-s- 0 0 1
0xffffffc0020f0000-0xffffffc0020f1000 rw-s- 0 0 1
0xffffffc0020f8000-0xffffffc0020f9000 rw-s- 0 0 1
0xffffffc002100000-0xffffffc002101000 rw-s- 0 0 1
0xffffffc002108000-0xffffffc002109000 rw-s- 0 0 1
0xffffffc002110000-0xffffffc002111000 rw-s- 0 0 1
0xffffffc002118000-0xffffffc002119000 rw-s- 0 0 1
0xffffffc002120000-0xffffffc002121000 rw-s- 0 0 1
0xffffffc002128000-0xffffffc00212c000 rw-s- 0 0 4
0xffffffc002130000-0xffffffc002139000 rw-s- 0 0 9
0xffffffc002140000-0xffffffc002143000 rw-s- 0 0 3
0xffffffc002148000-0xffffffc002149000 rw-s- 0 0 1
0xffffffc002150000-0xffffffc002159000 rw-s- 0 0 9
0xffffffc002160000-0xffffffc002161000 rw-s- 0 0 1
0xffffffc002168000-0xffffffc002169000 rw-s- 0 0 1
0xffffffc002170000-0xffffffc002171000 rw-s- 0 0 1
0xffffffc002178000-0xffffffc002181000 rw-s- 0 0 9
0xffffffc002188000-0xffffffc002191000 rw-s- 0 0 9
0xffffffc002198000-0xffffffc0021a1000 rw-s- 0 0 9
0xffffffc0021a8000-0xffffffc0021b1000 rw-s- 0 0 9
0xffffffc0021b8000-0xffffffc0021c1000 rw-s- 0 0 9
0xffffffc0021c8000-0xffffffc0021c9000 rw-s- 0 0 1
0xffffffc0021d0000-0xffffffc0021d7000 rw-s- 0 0 7
0xffffffc0021d8000-0xffffffc0021d9000 rw-s- 0 0 1
0xffffffc0021e0000-0xffffffc0021e9000 rw-s- 0 0 9
0xffffffc0021f0000-0xffffffc0021f1000 rw-s- 0 0 1
0xffffffc0021f8000-0xffffffc0021f9000 rw-s- 0 0 1
0xffffffc002200000-0xffffffc002201000 rw-s- 0 0 1
0xffffffc002208000-0xffffffc002209000 rw-s- 0 0 1
0xffffffc002210000-0xffffffc002211000 rw-s- 0 0 1
0xffffffc002218000-0xffffffc002219000 rw-s- 0 0 1
0xffffffc002220000-0xffffffc002221000 rw-s- 0 0 1
0xffffffc002228000-0xffffffc002229000 rw-s- 0 0 1
0xffffffc002230000-0xffffffc002231000 rw-s- 0 0 1
0xffffffc002238000-0xffffffc002239000 rw-s- 0 0 1
0xffffffc002240000-0xffffffc002249000 rw-s- 0 0 9
0xffffffc002250000-0xffffffc002279000 rw-s- 0 0 41
0xffffffc002280000-0xffffffc002281000 rw-s- 0 0 1
0xffffffc002288000-0xffffffc00228a000 rw-s- 0 0 2
0xffffffc002290000-0xffffffc002291000 rw-s- 0 0 1
0xffffffc002298000-0xffffffc002299000 rw-s- 0 0 1
0xffffffc0022a0000-0xffffffc0022a1000 rw-s- 0 0 1
0xffffffc0022a8000-0xffffffc0022a9000 rw-s- 0 0 1
0xffffffc0022b0000-0xffffffc0022b1000 rw-s- 0 0 1
0xffffffc0022b8000-0xffffffc0022b9000 rw-s- 0 0 1
0xffffffc0022c0000-0xffffffc0022c4000 rw-s- 0 0 4
0xffffffc0022c8000-0xffffffc0022c9000 rw-s- 0 0 1
0xffffffc0022d0000-0xffffffc0022d1000 rw-s- 0 0 1
0xffffffc0022d8000-0xffffffc0022d9000 rw-s- 0 0 1
0xffffffc0022e0000-0xffffffc0022e1000 rw-s- 0 0 1
0xffffffc0022e8000-0xffffffc0022e9000 rw-s- 0 0 1
0xffffffc0022f0000-0xffffffc0022f1000 rw-s- 0 0 1
0xffffffc0022f8000-0xffffffc0022f9000 rw-s- 0 0 1
0xffffffc002300000-0xffffffc002301000 rw-s- 0 0 1
0xffffffc002308000-0xffffffc00230a000 rw-s- 0 0 2
0xffffffc002310000-0xffffffc002311000 rw-s- 0 0 1
0xffffffc002318000-0xffffffc002321000 rw-s- 0 0 9
0xffffffc002328000-0xffffffc002331000 rw-s- 0 0 9
0xffffffc002338000-0xffffffc002341000 rw-s- 0 0 9
0xffffffc002348000-0xffffffc002351000 rw-s- 0 0 9
0xffffffc002358000-0xffffffc002359000 rw-s- 0 0 1
0xffffffc002360000-0xffffffc002361000 rw-s- 0 0 1
0xffffffc002368000-0xffffffc002369000 rw-s- 0 0 1
0xffffffc002370000-0xffffffc002378000 rw-s- 0 0 8
0xffffffc0175fc000-0xffffffc017600000 rw-s- 0 0 4
0xffffffc017c0c000-0xffffffc017c0d000 rw-s- 0 0 1
0xffffffc017c8d000-0xffffffc017c8e000 rw-s- 0 0 1
0xffffffc017d0e000-0xffffffc017d0f000 rw-s- 0 0 1
0xffffffc017d8f000-0xffffffc017d90000 rw-s- 0 0 1
0xffffffc01a000000-0xffffffc02e000000 rw-s- 0 0 81920
0xffffffc033e81000-0xffffffc033e85000 rw-s- 0 0 4
0xffffffc033e86000-0xffffffc033e8a000 rw-s- 0 0 4
0xffffffc033e8b000-0xffffffc033e8f000 rw-s- 0 0 4
0xffffffc033e90000-0xffffffc033e94000 rw-s- 0 0 4
0xffffffc033ff5000-0xffffffc033ff9000 rw-s- 0 0 4
0xffffffc033ffa000-0xffffffc033ffe000 rw-s- 0 0 4
0xffffffc035801000-0xffffffc035805000 rw-s- 0 0 4
0xffffffc035806000-0xffffffc03580a000 rw-s- 0 0 4
0xffffffc03580b000-0xffffffc03580f000 rw-s- 0 0 4
0xffffffc035810000-0xffffffc035814000 rw-s- 0 0 4
0xffffffc035815000-0xffffffc035819000 rw-s- 0 0 4
0xffffffc03581a000-0xffffffc03581e000 rw-s- 0 0 4
0xffffffc03581f000-0xffffffc035823000 rw-s- 0 0 4
0xffffffc035824000-0xffffffc035828000 rw-s- 0 0 4
0xffffffc035829000-0xffffffc03582d000 rw-s- 0 0 4
0xffffffc03582e000-0xffffffc035832000 rw-s- 0 0 4
0xffffffc035833000-0xffffffc035837000 rw-s- 0 0 4
0xffffffc035838000-0xffffffc03583c000 rw-s- 0 0 4
0xffffffc03583d000-0xffffffc035841000 rw-s- 0 0 4
0xffffffc035842000-0xffffffc035846000 rw-s- 0 0 4
0xffffffc035847000-0xffffffc03584b000 rw-s- 0 0 4
0xffffffc03584c000-0xffffffc035850000 rw-s- 0 0 4
0xffffffc035851000-0xffffffc035855000 rw-s- 0 0 4
0xffffffc035856000-0xffffffc03585a000 rw-s- 0 0 4
0xffffffc03585b000-0xffffffc03585f000 rw-s- 0 0 4
0xffffffc035860000-0xffffffc035864000 rw-s- 0 0 4
0xffffffc035865000-0xffffffc035869000 rw-s- 0 0 4
0xffffffc03586a000-0xffffffc03586e000 rw-s- 0 0 4
0xffffffc03586f000-0xffffffc035873000 rw-s- 0 0 4
0xffffffc035874000-0xffffffc035878000 rw-s- 0 0 4
0xffffffc035879000-0xffffffc03587d000 rw-s- 0 0 4
0xffffffc03587e000-0xffffffc035882000 rw-s- 0 0 4
0xffffffc035a00000-0xffffffc040000000 rwxs- 0 83 0
0xffffffc7ffc00000-0xffffffc7ffe00000 rw-s- 0 1 0
0xffffffc7fffff000-0xffffffc800000000 rw-s- 0 0 1

Direct map:
0xffffffd000000000-0xffffffd080000000 rw-s- 2 0 0

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mhorne created this revision.Mon, Feb 10, 12:34 AM
mhorne edited the test plan for this revision. (Show Details)Mon, Feb 10, 12:36 AM
markj accepted this revision.Tue, Feb 11, 6:39 PM

This seems fine to me. I would just avoid using the "block" terminology here - it comes from ARMv8 terminology, where a PTE is either a table descriptor (refers to another page table page) or a block descriptor (maps a large page). I think l1pages and l2pages are fine for RISC-V.

This revision is now accepted and ready to land.Tue, Feb 11, 6:39 PM
This revision was automatically updated to reflect the committed changes.