Page MenuHomeFreeBSD

riscv pmap: zero reserved pte bits in ppn
ClosedPublic

Authored by freebsdphab-AX9_cmx.ietfng.org on Jun 30 2020, 8:08 PM.
Tags
Referenced Files
Unknown Object (File)
Tue, Nov 19, 9:40 AM
Unknown Object (File)
Thu, Nov 14, 10:17 AM
Unknown Object (File)
Thu, Nov 14, 7:05 AM
Unknown Object (File)
Wed, Nov 13, 2:20 AM
Unknown Object (File)
Wed, Nov 13, 12:59 AM
Unknown Object (File)
Tue, Nov 12, 7:54 PM
Unknown Object (File)
Mon, Nov 11, 9:34 AM
Unknown Object (File)
Sun, Nov 10, 6:08 PM
Subscribers

Details

Summary

The top 10 bits of a pte are reserved by specification and are not part of the PPN

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp added a subscriber: kp.

For those playing along at home, from 'Volume II: RISC-V Privileged Architectures V20190608-Priv-MSU-Ratified', '4.4.1 Addressing and Memory Protection', page 72: "The PTE format for Sv39 is shown in Figure 4.18. Bits 9–0 have the same meaning as for Sv32. Bits 63–54 are reserved for future use and must be zeroed by software for forward compatibility.".

This revision is now accepted and ready to land.Jul 1 2020, 1:30 PM
mhorne added inline comments.
sys/riscv/riscv/pmap.c
362 ↗(On Diff #73923)

I'd prefer to see a definition for the constant placed in pte.h, something like PTE_MASK.
Also, rather than splitting the expression in the middle, you could do:

#define PTE_TO_PHYS(pte) \
    ((((pte) & PTE_MASK) >> PTE_PPN0_S) * PAGE_SIZE)

(The second line has a 4-space indent)

This revision now requires review to proceed.Jul 1 2020, 5:20 PM
This revision is now accepted and ready to land.Jul 1 2020, 5:33 PM

@mhorne Do you want to commit or shall I?

In D25523#564539, @kp wrote:

@mhorne Do you want to commit or shall I?

Would you? Alongside D25524 if you don't mind.

This revision was automatically updated to reflect the committed changes.