]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: selftests: Stop using __virt_pg_map() directly in tests
authorYosry Ahmed <yosry.ahmed@linux.dev>
Tue, 21 Oct 2025 07:47:23 +0000 (07:47 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 21 Nov 2025 18:15:14 +0000 (10:15 -0800)
Replace __virt_pg_map() calls in tests by high-level equivalent
functions, removing some loops in the process.

No functional change intended.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
Link: https://patch.msgid.link/20251021074736.1324328-11-yosry.ahmed@linux.dev
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/mmu_stress_test.c
tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c

index c799e0d0694f88fb2d0d68410bcfb6896ea555c0..51c070556f3efe5e852e8de8383c22fd54cd4689 100644 (file)
@@ -362,11 +362,9 @@ int main(int argc, char *argv[])
 
 #ifdef __x86_64__
                /* Identity map memory in the guest using 1gb pages. */
-               for (i = 0; i < slot_size; i += SZ_1G)
-                       __virt_pg_map(vm, gpa + i, gpa + i, PG_LEVEL_1G);
+               virt_map_level(vm, gpa, gpa, slot_size, PG_LEVEL_1G);
 #else
-               for (i = 0; i < slot_size; i += vm->page_size)
-                       virt_pg_map(vm, gpa + i, gpa + i);
+               virt_map(vm, gpa, gpa, slot_size >> vm->page_shift);
 #endif
        }
 
index 077cd0ec3040e9c8b3fc95311c8642125d86c59c..a3b7ce15598125cd29c7b54bd653da7c224c7487 100644 (file)
@@ -621,7 +621,7 @@ int main(int argc, char *argv[])
        for (i = 0; i < NTEST_PAGES; i++) {
                pte = vm_get_page_table_entry(vm, data->test_pages + i * PAGE_SIZE);
                gpa = addr_hva2gpa(vm, pte);
-               __virt_pg_map(vm, gva + PAGE_SIZE * i, gpa & PAGE_MASK, PG_LEVEL_4K);
+               virt_pg_map(vm, gva + PAGE_SIZE * i, gpa & PAGE_MASK);
                data->test_pages_pte[i] = gva + (gpa & ~PAGE_MASK);
        }