Skip to content

Commit 1de4dc1

Browse files
yosrym93sean-jc
authored andcommitted
KVM: selftests: Stop using __virt_pg_map() directly in tests
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>
1 parent 6a8818d commit 1de4dc1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

tools/testing/selftests/kvm/mmu_stress_test.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,9 @@ int main(int argc, char *argv[])
362362

363363
#ifdef __x86_64__
364364
/* Identity map memory in the guest using 1gb pages. */
365-
for (i = 0; i < slot_size; i += SZ_1G)
366-
__virt_pg_map(vm, gpa + i, gpa + i, PG_LEVEL_1G);
365+
virt_map_level(vm, gpa, gpa, slot_size, PG_LEVEL_1G);
367366
#else
368-
for (i = 0; i < slot_size; i += vm->page_size)
369-
virt_pg_map(vm, gpa + i, gpa + i);
367+
virt_map(vm, gpa, gpa, slot_size >> vm->page_shift);
370368
#endif
371369
}
372370

tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ int main(int argc, char *argv[])
621621
for (i = 0; i < NTEST_PAGES; i++) {
622622
pte = vm_get_page_table_entry(vm, data->test_pages + i * PAGE_SIZE);
623623
gpa = addr_hva2gpa(vm, pte);
624-
__virt_pg_map(vm, gva + PAGE_SIZE * i, gpa & PAGE_MASK, PG_LEVEL_4K);
624+
virt_pg_map(vm, gva + PAGE_SIZE * i, gpa & PAGE_MASK);
625625
data->test_pages_pte[i] = gva + (gpa & ~PAGE_MASK);
626626
}
627627

0 commit comments

Comments
 (0)