git: ed10a9398d05 - stable/14 - riscv: fix L0 PTE setup (Sv48)

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 27 May 2024 14:43:36 UTC
The branch stable/14 has been updated by mhorne:

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

commit ed10a9398d05738089ee31fed263854ba92884e2
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-05-15 17:07:33 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-05-27 14:41:49 +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
    
    (cherry picked from commit d7adf3b47a058552270fb2603cc888f40eba3e17)
---
 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 8ddc31bed81c..45245fe54a59 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -715,7 +715,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);