Page MenuHomeFreeBSD

riscv stage2 pmap support
ClosedPublic

Authored by br on Tue, Jun 4, 1:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 23, 3:34 AM
Unknown Object (File)
Mon, Jun 17, 6:51 PM
Unknown Object (File)
Sun, Jun 16, 5:42 AM
Unknown Object (File)
Tue, Jun 11, 5:37 AM
Unknown Object (File)
Sat, Jun 8, 11:55 AM
Unknown Object (File)
Thu, Jun 6, 5:14 PM
Unknown Object (File)
Wed, Jun 5, 1:54 PM
Unknown Object (File)
Tue, Jun 4, 2:40 PM
Subscribers

Details

Summary

Add basic Stage2 support (guest physical to host physical)

RISC-V hypervisor spec[1] extends top page table directory from 4K page to 16K page making total addressable memory 1petabyte (4x256TB).
The rest of page table system (including PTE format) is identical.

I am not sure if that makes any sense to us to support all of that space since our VM layout limits user VA space to 128TB.

(If some one want I can try to support all that space, but that could add a mess into pmap.c since NUL2E, NUL1E, NUL0E defines have to be converted into macroses, i.e. NUL2E(pmap) depending on stage could give different bounds)

  1. https://five-embeddev.com/riscv-priv-isa-manual/Priv-v1.12/hypervisor.html
Test Plan

Tested on unmodified Spike running Bhyve with 2.5gb of memory

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

br requested review of this revision.Tue, Jun 4, 1:33 PM

No objection if you want to commit this now. I agree it is unimportant to support the full address space, at present.

sys/riscv/riscv/pmap.c
1353
This revision is now accepted and ready to land.Tue, Jun 4, 11:26 PM

The rest of page table system (including PTE format) is identical.

That's not entirely true; the G bit exists but is reserved. Having said that I don't think we currently set it? (Though there is code to inspect and preserve it in places)

The rest of page table system (including PTE format) is identical.

That's not entirely true; the G bit exists but is reserved. Having said that I don't think we currently set it? (Though there is code to inspect and preserve it in places)

right, we will need to support hypervisor memory-management fence instructions (and manage address space/VM IDs etc). I will put this into TODO list.

sys/riscv/riscv/pmap.c
1353

that is intentional to fit into 80 characters line

rename variable mtop to m

This revision now requires review to proceed.Wed, Jun 5, 10:06 AM
In D45481#1037849, @br wrote:

The rest of page table system (including PTE format) is identical.

That's not entirely true; the G bit exists but is reserved. Having said that I don't think we currently set it? (Though there is code to inspect and preserve it in places)

right, we will need to support hypervisor memory-management fence instructions (and manage address space/VM IDs etc). I will put this into TODO list.

FYI I have some old patches for the G bit, but it needs rebasing. This will come after Svpbmt.

This revision is now accepted and ready to land.Wed, Jun 5, 12:50 PM
This revision was automatically updated to reflect the committed changes.