Skip to content

[PW_SID:1083508] KVM: selftests: Use kernel-style integer and g[vp]a_t types#1804

Closed
linux-riscv-bot wants to merge 20 commits into
workflowfrom
pw1083508
Closed

[PW_SID:1083508] KVM: selftests: Use kernel-style integer and g[vp]a_t types#1804
linux-riscv-bot wants to merge 20 commits into
workflowfrom
pw1083508

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1083508 applied to workflow

Name: KVM: selftests: Use kernel-style integer and g[vp]a_t types
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1083508
Version: 3

Linux RISC-V bot and others added 20 commits April 21, 2026 19:05
Replace all occurrences of vm_vaddr_t with gva_t to align with KVM code
and with the conversion helpers (e.g. addr_gva2hva()).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/vm_vaddr_/gva_/g'

Then by manually adjusting whitespace to make checkpatch.pl happy, and
dropping renames of functions that allocate memory within a given VM.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
[sean: drop renames of allocator APIs]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace all occurrences of vm_paddr_t with gpa_t to align with KVM code
and with the conversion helpers (e.g. addr_hva2gpa()).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/vm_paddr_/gpa_/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
[sean: drop bogus changelog blurb about renaming functions]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Fix various Hyper-V selftests to use gpa_t for variables that contain
guest physical addresses, rather than gva_t.  In practice, the bugs are
benign as both gva_t and gpa_t are u64 typedefs, i.e. gpa_t and gva_t are
interchangeable from a functional perspective, the code is just confusing.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
[sean: call out that both are u64 typedefs]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use u64 instead of uint64_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint64_t/u64/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

Include <linux/types.h> in include/kvm_util_types.h, iinclude/test_util.h,
and include/x86/pmu.h to pick up the tools-defined u64.  Arguably, all
headers (especially kvm_util_types.h) should have already been including
stdint.h to get uint64_t from the libc headers, but the missing dependency
only rears its head once KVM uses u64 instead of uint64_t.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
[sean: rename pread_uint64() => pread_u64, expand on types.h include]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use s64 instead of int64_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int64_t/s64/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use u32 instead of uint32_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint32_t/u32/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use s32 instead of int32_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int32_t/s32/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use u16 instead of uint16_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint16_t/u16/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use s16 instead of int16_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int16_t/s16/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use u8 instead of uint8_t to make the KVM selftests code more concise
and more similar to the kernel (since selftests are primarily developed
by kernel developers).

This commit was generated with the following command:

  git ls-files tools/testing/selftests/kvm | xargs sed -i 's/uint8_t/u8/g'

Then by manually adjusting whitespace to make checkpatch.pl happy.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…ven VM

Now that KVM selftests use gva_t instead of vm_vaddr_t, drop "vaddr_" from
the core memory allocation APIs as the information is extraneous and does
more harm than good.  E.g. the APIs don't _just_ allocate virtual memory,
they allocate backing physical memory and install mappings in the guest
page tables.  And as proven by kmalloc() and malloc(), developers generally
expect that allocations come with a working virtual address.

Opportunistically clean up the function comment for vm_alloc(), and drop
the misleading and superfluous comments for its wrappers.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Now that KVM selftests use gva_t instead of vm_vaddr_t, rename the API
for finding an unused range of virtual memory to drop the defunct
terminology and use "vm" for the scope.

Opportunistically clean up the function comment to drop superfluous
and redundant information.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…bitmap()

Now that KVM selftests use gva_t instead of vm_vaddr_t, rename the helper
for populating the initial GVA bitmap to drop the defunct terminology and
use "vm" for the scope.

Opportunistically fixup the declaration of the API, which has been broken
since day 1.  The flaw went unnoticed because the sole caller is defined
after the weak version, i.e. can see the prototype without a previous
declaration.

No functional change intended.

Fixes: e8b9a05 ("KVM: arm64: selftests: Align VA space allocator with TTBR0")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…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.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…t a guest PA

Rename inject_uer()'s @paddr to @HPA to make it more obvious that it
injects an error using a host PA, not a guest PA.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace all variations of "vaddr" variables in KVM selftests with "gva",
with the exception of the ELF structures, as those fields are not specific
to guest virtual addresses, to complete the conversion from vm_vaddr_t to
gva_t.

Opportunistically use gva_t instead of u64 for relevant variables, and
fixup indentation as appropriate.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Use gpa_t instead of u64 for obvious declarations of GPA variables.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
In x86's nested TDP APIs, use the appropriate gpa_t typedef and rename
variables from nested_paddr to l2_gpa to match KVM x86's nomenclature.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace all variations of "paddr" variables in KVM selftests with "gpa",
with the exception of the ELF structures, as those fields are not specific
to guest virtual addresses, to complete the conversion from vm_paddr_t to
gpa_t.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1019.06 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1378.52 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 27.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 14.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
kdoc
Desc: Detects for kdoc errors
Duration: 0.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/19] KVM: selftests: Use gva_t instead of vm_vaddr_t"
module-param
Desc: Detect module_param changes
Duration: 0.39 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[v3,18/19] KVM: selftests: Replace "u64 nested_paddr" with "gpa_t l2_gpa""
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[v3,18/19] KVM: selftests: Replace "u64 nested_paddr" with "gpa_t l2_gpa""
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 139.20 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1016.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1376.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.54 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 3.63 seconds
Result: WARNING
Output:

WARNING: Possible repeated word: 'beyond'
#156: FILE: tools/testing/selftests/kvm/lib/arm64/processor.c:140:
+		    "Physical address beyond beyond maximum supported,\n"

CHECK: multiple assignments should be avoided
#286: FILE: tools/testing/selftests/kvm/lib/kvm_util.c:2042:
+	base = pg = min_gpa >> vm->page_shift;

WARNING: quoted string split across lines
#296: FILE: tools/testing/selftests/kvm/lib/kvm_util.c:2054:
 		fprintf(stderr, "No guest physical page available, "
+			"min_gpa: 0x%lx page_size: 0x%x memslot: %u\n",

CHECK: Alignment should match open parenthesis
#355: FILE: tools/testing/selftests/kvm/lib/loongarch/processor.c:130:
+	TEST_ASSERT((gpa % vm->page_size) == 0,
 			"Physical address not on page boundary,\n"

CHECK: Alignment should match open parenthesis
#360: FILE: tools/testing/selftests/kvm/lib/loongarch/processor.c:133:
+	TEST_ASSERT((gpa >> vm->page_shift) <= vm->max_gfn,
 			"Physical address beyond maximum supported,\n"

CHECK: Alignment should match open parenthesis
#392: FILE: tools/testing/selftests/kvm/lib/riscv/processor.c:89:
+	TEST_ASSERT((gpa % vm->page_size) == 0,
 		"Physical address not on page boundary,\n"

CHECK: Alignment should match open parenthesis
#397: FILE: tools/testing/selftests/kvm/lib/riscv/processor.c:92:
+	TEST_ASSERT((gpa >> vm->page_shift) <= vm->max_gfn,
 		"Physical address beyond maximum supported,\n"

CHECK: Alignment should match open parenthesis
#435: FILE: tools/testing/selftests/kvm/lib/s390/processor.c:24:
+	gpa = vm_phy_pages_alloc(vm, PAGES_PER_REGION,
 				   KVM_GUEST_PAGE_TABLE_MIN_PADDR,

total: 0 errors, 2 warnings, 6 checks, 506 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 4b0105fec813 ("KVM: selftests: Replace "paddr" with "gpa" throughout") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 2 warnings, 6 checks, 506 lines checked
CHECK: Alignment should match open parenthesis
CHECK: multiple assignments should be avoided
WARNING: Possible repeated word: 'beyond'
WARNING: quoted string split across lines


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 86.55 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 6.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
kdoc
Desc: Detects for kdoc errors
Duration: 1.53 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
module-param
Desc: Detect module_param changes
Duration: 0.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 19: "[v3,19/19] KVM: selftests: Replace "paddr" with "gpa" throughout"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow branch 14 times, most recently from da65025 to 50e3f1e Compare April 28, 2026 02:09
@linux-riscv-bot linux-riscv-bot deleted the pw1083508 branch April 28, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants