git: d7adf3b47a05 - main - riscv: fix L0 PTE setup (Sv48)

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Wed, 15 May 2024 17:09:40 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=d7adf3b47a058552270fb2603cc888f40eba3e17

commit d7adf3b47a058552270fb2603cc888f40eba3e17
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-05-15 17:07:33 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-05-15 17:07:33 +0000

    riscv: fix L0 PTE setup (Sv48)
    
    Per the Privilege Spec, the Accessed (A) or Dirty (D) bits must only be
    set for a leaf PTE.
    
    It seems newer versions of QEMU have started to enforce this
    requirement, and without this change, pmap_bootstrap() hangs when
    switching to Sv48 mode.
    
    Reviewed by:    jrtc27, markj
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45210
---
 sys/riscv/riscv/pmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index b92cb816f44a..b571806bb2da 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -714,7 +714,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen)
 		alloc_pages(l0pv, 1);
 		l0p = (void *)l0pv;
 		l1pa = pmap_early_vtophys(l1pt, l1pt);
-		l0p[pmap_l0_index(KERNBASE)] = PTE_V | PTE_A | PTE_D |
+		l0p[pmap_l0_index(KERNBASE)] = PTE_V |
 		    ((l1pa >> PAGE_SHIFT) << PTE_PPN0_S);
 
 		l0pa = pmap_early_vtophys(l1pt, l0pv);