Repository navigation
hptw: don't set A/D on leaf PTEs with reserved PBMT, NAPOT or bits 60:54 - #1938
Closed
davidharrishmc wants to merge 2 commits into
Closed
davidharrishmc wants to merge 2 commits into
davidharrishmc wants to merge 2 commits into
Conversation
With menvcfg.ADUE=1 the walker decided whether to update A/D from its own copy of the leaf checks, which lacked tlbcontrol's BadPBMT, BadNAPOT and BadReserved. A store through a leaf with PBMT=3, PBMT!=0 while menvcfg.PBMTE=0, N=1 with a reserved napot encoding, or a bit in 60:54 set therefore had A and D written to the PTE before tlbcontrol raised the store page fault. The translation algorithm stops at step 3 for these encodings, before the A/D update in step 9, and D updates must be exact. Add the three checks to the walker's OtherPageFault, using the PTE it read. The remaining leaf page-fault conditions in tlbcontrol (V, R/W reserved encoding, U/SUM privilege, R/W/X permission, misaligned superpage, non-canonical VA) were already checked by the walker. A module shared by tlbcontrol and hptw is deferred: tlbcontrol sees the compressed TLB entry bits (one OR of bits 60:54) on the TLB-hit path and is parameterized for ITLB/DTLB, so sharing more than these three lines would mean restructuring both. This is a targeted fix. hptwReservedAD checks that each reserved case takes a store page fault and leaves the PTE unchanged, and that legal PTEs (including PBMT=NC with PBMTE=1) still get A and D. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: David Harris <David_Harris@hmc.edu>
testbench/tests.vh was removed by openhwfoundation#1895; hptwReservedAD now runs from tests/coverage. Signed-off-by: David Harris <David_Harris@hmc.edu>
rosethompson
approved these changes
Oct 15, 2026
Contributor
|
Is this PR no longer needed after the merge of PR #1916? |
Contributor
Author
|
Redundant after 1916. |
rosethompson
pushed a commit
that referenced
this pull request
Oct 19, 2026
#1916 stopped the page table walker from setting A/D on leaf PTEs with reserved encodings, but added no test. hptwReservedAD (from the closed #1938) stores through leaves with PBMT=3, PBMT!=0 while menvcfg.PBMTE=0, a reserved NAPOT encoding and bit 54 set, and checks each takes a store page fault with the PTE unchanged, while legal PTEs still get A and D. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Harris <David_Harris@hmc.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With menvcfg.ADUE=1, the page-table walker decided whether to update A/D with its own copy of the leaf checks (
OtherPageFaultinhptw.sv). That copy lacked tlbcontrol's BadPBMT, BadNAPOT and BadReserved. A store through a leaf PTE with any of these therefore had A and D written to the PTE before the store page fault:The privileged spec stops translation with a page fault at step 3 for these encodings, before the A/D update, and D updates must be exact.
This adds the three checks to the walker. They are computed from its PTE and only gate
HPTWUpdateDA. A module shared with tlbcontrol was deferred, because tlbcontrol works on the TLB's compressed entry bits on the hit path.The new self-checking test
hptwReservedADchecks:It fails on main, and ImperasDV flags the PTE readback there; with the fix it passes with 0 mismatches.
Found while reviewing #1924/#1931/#1932, which share the root cause: the walker's checks and controls drift from the TLB's. Related to #1921.
🤖 Generated with Claude Code