git: 5e2f304cb4c7 - main - Fix calculating l0index in _pmap_alloc_l3 on arm64

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 15 Mar 2022 11:10:02 UTC
The branch main has been updated by andrew:

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

commit 5e2f304cb4c7c2a8fdd8760ac53ed87d2df055f5
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-03-10 14:40:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-03-15 09:51:41 +0000

    Fix calculating l0index in _pmap_alloc_l3 on arm64
    
    When moving from the l1 index to l0 index we need to use the l1 shift
    value not the l0 shift value. With 4k pages they are identical, however
    with 16k pages we only have 2 l0 entries so the shift value is incorrect.
    
    Reviewed by:    alc, markj
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D34517
---
 sys/arm64/arm64/pmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 3ad50e57d8e0..1570bf3d0b9c 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1945,7 +1945,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
 		pd_entry_t tl0;
 
 		l1index = ptepindex - NUL2E;
-		l0index = l1index >> L0_ENTRIES_SHIFT;
+		l0index = l1index >> Ln_ENTRIES_SHIFT;
 
 		l0 = &pmap->pm_l0[l0index];
 		tl0 = pmap_load(l0);
@@ -1973,7 +1973,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
 		pd_entry_t tl0, tl1;
 
 		l1index = ptepindex >> Ln_ENTRIES_SHIFT;
-		l0index = l1index >> L0_ENTRIES_SHIFT;
+		l0index = l1index >> Ln_ENTRIES_SHIFT;
 
 		l0 = &pmap->pm_l0[l0index];
 		tl0 = pmap_load(l0);