Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: selftests: Rename translate_to_host_paddr() => translate_hva_to_hpa()

Rename arm64's translate_to_host_paddr() to translate_hva_to_hpa() and
update variable names to match, as using "vaddr" and "paddr" terminology
is super confusing due to selftests using those exact names for *guest*
addresses.

Opportunisitically drop superfluous local page_addr and paddr variables.

No functional change intended.

Link: https://patch.msgid.link/20260420212004.3938325-15-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

+5 -8
+5 -8
tools/testing/selftests/kvm/arm64/sea_to_user.c
··· 56 56 static u64 einj_hpa; 57 57 static bool far_invalid; 58 58 59 - static u64 translate_to_host_paddr(unsigned long vaddr) 59 + static u64 translate_hva_to_hpa(unsigned long hva) 60 60 { 61 61 u64 pinfo; 62 - s64 offset = vaddr / getpagesize() * sizeof(pinfo); 62 + s64 offset = hva / getpagesize() * sizeof(pinfo); 63 63 int fd; 64 - u64 page_addr; 65 - u64 paddr; 66 64 67 65 fd = open("/proc/self/pagemap", O_RDONLY); 68 66 if (fd < 0) ··· 75 77 if ((pinfo & PAGE_PRESENT) == 0) 76 78 ksft_exit_fail_perror("Page not present"); 77 79 78 - page_addr = (pinfo & PAGE_PHYSICAL) << MIN_PAGE_SHIFT; 79 - paddr = page_addr + (vaddr & (getpagesize() - 1)); 80 - return paddr; 80 + return ((pinfo & PAGE_PHYSICAL) << MIN_PAGE_SHIFT) + 81 + (hva & (getpagesize() - 1)); 81 82 } 82 83 83 84 static void write_einj_entry(const char *einj_path, u64 val) ··· 300 303 ksft_print_msg("Before EINJect: data=%#lx\n", 301 304 guest_data); 302 305 303 - einj_hpa = translate_to_host_paddr((unsigned long)einj_hva); 306 + einj_hpa = translate_hva_to_hpa((unsigned long)einj_hva); 304 307 305 308 ksft_print_msg("EINJ_GVA=%#lx, einj_gpa=%#lx, einj_hva=%p, einj_hpa=%#lx\n", 306 309 EINJ_GVA, einj_gpa, einj_hva, einj_hpa);