Skip to content

Don't update A/D in the HPTW for leaf PTEs with reserved encodings - #1965

Open
davidharrishmc wants to merge 1 commit into
openhwfoundation:mainfrom
davidharrishmc:dh/hptw-reserved-no-ad
Open

davidharrishmc wants to merge 1 commit into
openhwfoundation:mainfrom
davidharrishmc:dh/hptw-reserved-no-ad

Conversation

@davidharrishmc

Copy link
Copy Markdown
Contributor

With Svadu (menvcfg.ADUE=1), a TLB miss on a leaf PTE with A=0 and a reserved encoding (nonzero bits 60:54, PBMT=3 or PBMT≠0 without Svpbmt/PBMTE, or a reserved NAPOT encoding) wrote A/D back to memory before tlbcontrol raised the page fault. The hptw's OtherPageFault omitted these checks, although tlbcontrol's TLB-hit path already gated its update with them.

The privileged spec stops translation at step 3 when "any bits or encodings that are reserved for future standard use are set within pte", before the A/D update in step 9, so the PTE must not change. The fix adds the same conditions as tlbcontrol's BadReserved/BadPBMT/BadNAPOT to the walker's fault check.

Found by the new ACT Svadu_sv{39,48,57}_Svadu_fault_Smode tests (reserved bit 54 case), which now pass. All 677 rv64gc and 54 rv32gc privileged/virtual-memory ACT tests pass in Verilator, and lint is clean.

🤖 Generated with Claude Code

On a TLB miss with Svadu, the walker wrote A/D back to a leaf PTE whose
reserved bits (60:54), PBMT, or N encoding cause a page fault, because
its fault check omitted those conditions. The spec stops the walk at
step 3 for reserved encodings, before the A/D update in step 9. Use the
same conditions as tlbcontrol's BadReserved, BadPBMT, and BadNAPOT.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant