Page MenuHomeFreeBSD

riscv: Add support for enabling SV48 mode
ClosedPublic

Authored by markj on Feb 14 2022, 10:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 1:58 AM
Unknown Object (File)
Dec 7 2023, 10:28 AM
Unknown Object (File)
Dec 4 2023, 5:47 PM
Unknown Object (File)
Dec 4 2023, 5:47 PM
Unknown Object (File)
Dec 4 2023, 5:47 PM
Unknown Object (File)
Dec 1 2023, 8:09 PM
Unknown Object (File)
Nov 17 2023, 7:00 PM
Unknown Object (File)
Nov 15 2023, 12:30 PM
Subscribers

Details

Summary

This increases the size of the user map from 256GB to 128TB. The kernel
map is left unchanged for now.

For now SV48 mode is left disabled by default, but can be enabled with a
tunable. Note that extant hardware does not implement SV48, but QEMU
does.

  • In pmap_bootstrap(), allocate a L0 page and attempt to enable SV48 mode. If the write to SATP doesn't take, the kernel continues to run in SV39 mode.
  • Define VM_MAX_USER_ADDRESS to refer to the SV48 limit. In SV39 mode, the region [VM_MAX_USER_ADDRESS_SV39, VM_MAX_USER_ADDRESS_SV48] is not mappable.

Diff Detail

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

Event Timeline

jhb added a subscriber: jhb.
jhb added inline comments.
sys/riscv/include/riscvreg.h
153

These changes seem like an unrelated cleanup that could be earlier? Also, does this constant need UL? Perhaps it is auto-promoted as it is already bigger than MAX_INT?

sys/riscv/include/vmparam.h
212

Hmm, I guess I can see from this why you added _SV39 when you did. I would maybe still say to add PS_STRINGS_SV39 in the earlier commit?

This revision is now accepted and ready to land.Feb 15 2022, 12:23 AM
sys/riscv/include/riscvreg.h
153

Yeah, this is here just because this commit adds the first use of SATP_MODE_M. I don't think there's another suitable commit to squash this into. I suppose I could have a separate commit for this part.

I'll add the UL suffix here too just for consistency, but yeah I believe it's correct as is.

Add the UL suffix to SATP_PPN_M for consistency.

This revision now requires review to proceed.Feb 15 2022, 2:59 PM
This revision is now accepted and ready to land.Feb 15 2022, 5:39 PM
This revision was automatically updated to reflect the committed changes.