git: d03e1ffbea6d - main - arm64: Remove some redundant calculations from pmap_bootstrap{,_san1}()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 20 Jun 2024 22:00:07 UTC
The branch main has been updated by markj:

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

commit d03e1ffbea6dd74ea8716b6a7cd052893d347b58
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-20 20:43:48 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-20 21:53:54 +0000

    arm64: Remove some redundant calculations from pmap_bootstrap{,_san1}()
    
    No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   Juniper Networks, Inc.
---
 sys/arm64/arm64/pmap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index e8991ae706f9..d072a387d9b9 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1323,13 +1323,12 @@ pmap_bootstrap(vm_size_t kernlen)
 	min_pa = pmap_early_vtophys(KERNBASE);
 
 	physmap_idx = physmem_avail(physmap, nitems(physmap));
-	physmap_idx /= 2;
 
 	/*
 	 * Find the minimum physical address. physmap is sorted,
 	 * but may contain empty ranges.
 	 */
-	for (i = 0; i < physmap_idx * 2; i += 2) {
+	for (i = 0; i < physmap_idx; i += 2) {
 		if (physmap[i] == physmap[i + 1])
 			continue;
 		if (physmap[i] <= min_pa)
@@ -1439,7 +1438,6 @@ pmap_bootstrap_san1(vm_offset_t va, int scale)
 	 * allocation since pmap_bootstrap().
 	 */
 	physmap_idx = physmem_avail(physmap, nitems(physmap));
-	physmap_idx /= 2;
 
 	eva = va + (virtual_avail - VM_MIN_KERNEL_ADDRESS) / scale;
 
@@ -1448,7 +1446,7 @@ pmap_bootstrap_san1(vm_offset_t va, int scale)
 	 * the shadow map as high up as we can to avoid depleting the lower 4GB in case
 	 * it's needed for, e.g., an xhci controller that can only do 32-bit DMA.
 	 */
-	for (i = (physmap_idx * 2) - 2; i >= 0; i -= 2) {
+	for (i = physmap_idx - 2; i >= 0; i -= 2) {
 		vm_paddr_t plow, phigh;
 
 		/* L2 mappings must be backed by memory that is L2-aligned */