git: 88227ddc7536 - stable/14 - arm64: Use pmap_early_vtophys in pmap_bootstrap_san

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 19 Feb 2024 16:45:28 UTC
The branch stable/14 has been updated by andrew:

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

commit 88227ddc7536db86a8dd8896061c5e2e8da84cb3
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-11-13 16:34:56 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-19 13:14:59 +0000

    arm64: Use pmap_early_vtophys in pmap_bootstrap_san
    
    Use pmap_early_vtophys to find the physical address of the kernel base
    rather than using the calculated offset as it will be removed in a
    latter commit.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D42566
    
    (cherry picked from commit 5fae53589eacbf65855419922c881b3a25a68e03)
---
 sys/arm64/arm64/machdep.c | 2 +-
 sys/arm64/arm64/pmap.c    | 5 ++++-
 sys/arm64/include/pmap.h  | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index bb7689c19101..7aa20357acf4 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -973,7 +973,7 @@ initarm(struct arm64_bootparams *abp)
 	 * segments also get excluded from phys_avail.
 	 */
 #if defined(KASAN)
-	pmap_bootstrap_san(KERNBASE - abp->kern_delta);
+	pmap_bootstrap_san();
 #endif
 
 	physmem_init_kernel_globals();
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 9849a58dd070..d9d224f44fb6 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1365,11 +1365,14 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen)
  * - Map that entire range using L2 superpages.
  */
 void
-pmap_bootstrap_san(vm_paddr_t kernstart)
+pmap_bootstrap_san(void)
 {
 	vm_offset_t va;
+	vm_paddr_t kernstart;
 	int i, shadow_npages, nkasan_l2;
 
+	kernstart = pmap_early_vtophys(KERNBASE);
+
 	/*
 	 * Rebuild physmap one more time, we may have excluded more regions from
 	 * allocation since pmap_bootstrap().
diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h
index bb226df2099c..e7d23dfb2844 100644
--- a/sys/arm64/include/pmap.h
+++ b/sys/arm64/include/pmap.h
@@ -192,7 +192,7 @@ pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused)
 #if defined(KASAN) || defined(KMSAN)
 struct arm64_bootparams;
 
-void	pmap_bootstrap_san(vm_paddr_t);
+void	pmap_bootstrap_san(void);
 void	pmap_san_enter(vm_offset_t);
 #endif