git: 9da8d0b5b680 - stable/13 - Fix calculating l0index in _pmap_alloc_l3 on arm64

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 04 Apr 2022 11:06:08 UTC
The branch stable/13 has been updated by andrew:

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

commit 9da8d0b5b6803000dea93ab058321d82ef524712
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-03-10 14:40:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-04-04 09:37:07 +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
    
    (cherry picked from commit 5e2f304cb4c7c2a8fdd8760ac53ed87d2df055f5)
---
 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 849db125b027..924b82f01313 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1889,7 +1889,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);
@@ -1917,7 +1917,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);