git: 421516f25e9c - main - Create pmap_mask_set_locked on arm64

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 12 Apr 2023 12:26:11 UTC
The branch main has been updated by andrew:

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

commit 421516f25e9cfa91b33841f633a463889bc10af7
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-04-12 12:09:06 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-04-12 12:10:13 +0000

    Create pmap_mask_set_locked on arm64
    
    Create a locked version of pmap_mask_set. We will need this for BTI
    support.
    
    Sponsored by:   Arm Ltd
---
 sys/arm64/arm64/pmap.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 2e5b2c23efd7..fc4650c8d449 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -3837,14 +3837,14 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, pt_entry_t mask,
  * pmap and range
  */
 static void
-pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask,
+pmap_mask_set_locked(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask,
     pt_entry_t nbits, bool invalidate)
 {
 	vm_offset_t va, va_next;
 	pd_entry_t *l0, *l1, *l2;
 	pt_entry_t *l3p, l3;
 
-	PMAP_LOCK(pmap);
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	for (; sva < eva; sva = va_next) {
 		l0 = pmap_l0(pmap, sva);
 		if (pmap_load(l0) == 0) {
@@ -3938,6 +3938,14 @@ pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask,
 		if (va != va_next && invalidate)
 			pmap_s1_invalidate_range(pmap, va, sva, true);
 	}
+}
+
+static void
+pmap_mask_set(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t mask,
+    pt_entry_t nbits, bool invalidate)
+{
+	PMAP_LOCK(pmap);
+	pmap_mask_set_locked(pmap, sva, eva, mask, nbits, invalidate);
 	PMAP_UNLOCK(pmap);
 }