git: 835cd17f87e1 - main - riscv: use pmap_l1_pindex to calculate the pindex of the l2 page table page

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Thu, 29 Aug 2024 15:21:53 UTC
The branch main has been updated by mhorne:

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

commit 835cd17f87e1b38c05e4a9a392181bebb9b8dc6d
Author:     Wuyang Chung <wy-chung@outlook.com>
AuthorDate: 2024-08-05 05:22:56 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-08-29 15:20:29 +0000

    riscv: use pmap_l1_pindex to calculate the pindex of the l2 page table page
    
    Reviewed by:    mhorne
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1360
---
 sys/riscv/riscv/pmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 4baa4948e442..69eb36c2cd4c 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -1743,7 +1743,7 @@ pmap_alloc_l2(pmap_t pmap, vm_offset_t va, struct rwlock **lockp)
 {
 	pd_entry_t *l1;
 	vm_page_t l2pg;
-	vm_pindex_t l2pindex;
+	vm_pindex_t pindex;
 
 retry:
 	l1 = pmap_l1(pmap, va);
@@ -1756,8 +1756,8 @@ retry:
 		l2pg->ref_count++;
 	} else {
 		/* Allocate a L2 page. */
-		l2pindex = pmap_l2_pindex(va) >> Ln_ENTRIES_SHIFT;
-		l2pg = _pmap_alloc_l3(pmap, NUL2E + l2pindex, lockp);
+		pindex = pmap_l1_pindex(va);
+		l2pg = _pmap_alloc_l3(pmap, pindex, lockp);
 		if (l2pg == NULL && lockp != NULL)
 			goto retry;
 	}