Skip to content

KVM: selftests: Alignment fixes and arm64 MMU cleanup

Fuad Tabba kvm kvm-riscv kvmarm linux-arm-kernel 4 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 1 replyApplied
  2. v35 patches 2 repliesSuperseded
  3. v25 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches0 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/5KVM: arm64: selftests: Disable unused TTBR1_EL1 translationstools/testing/selftests/kvm/include/arm64/processor.h tools/testing/selftests/kvm/lib/arm64/processor.c+6 -00 replies
2/5KVM: arm64: selftests: Fix incorrect rounding in page_align()tools/testing/selftests/kvm/lib/arm64/processor.c+1 -10 replies
3/5KVM: riscv: selftests: Fix incorrect rounding in page_align()tools/testing/selftests/kvm/lib/riscv/processor.c+1 -10 replies
4/5KVM: selftests: Move page_align() to shared headertools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/arm64/processor.c tools/testing/selftests/kvm/lib/riscv/processor.c+7 -120 replies
5/5KVM: selftests: Fix typos and stale comments in kvm_utiltools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/kvm_util.c+3 -30 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchAndrew JonesItaru Kitayama
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/5] KVM: selftests: Alignment fixes and arm64 MMU cleanup

Changes from v3 [1]:
- Renamed page_align() to vm_page_align() (Sean)

This series tidies up a few things in the KVM selftests. It addresses an error in memory alignment, hardens the arm64 MMU configuration for selftests, and fixes minor documentation issues.

First, for arm64, the series explicitly disables translation table walks for the unused upper virtual address range (TTBR1). Since selftests run entirely in the lower range (TTBR0), leaving TTBR1 uninitialized but active could lead to unpredictable behavior if guest code accesses high addresses. We set EPD1 and TBI1 to ensure such accesses deterministically generate translation faults.

Second, the series fixes the page_align() implementation in both arm64 and riscv. The previous version incorrectly rounded up already-aligned addresses to the *next* page, potentially wasting memory or causing unexpected gaps. After fixing the logic in the arch-specific files, the function is moved to the common kvm_util.h header to eliminate code duplication, and renamed to vm_page_align() to make it clear that the alignment is done with respect to the guest's base page size.

Finally, a few comments and argument descriptions in kvm_util are updated to match the actual code implementation.

Based on Linux 6.19-rc4.

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (5):
KVM: arm64: selftests: Disable unused TTBR1_EL1 translations
KVM: arm64: selftests: Fix incorrect rounding in page_align()
KVM: riscv: selftests: Fix incorrect rounding in page_align()
KVM: selftests: Move page_align() to shared header
KVM: selftests: Fix typos and stale comments in kvm_util

 tools/testing/selftests/kvm/include/arm64/processor.h | 4 ++++
 tools/testing/selftests/kvm/include/kvm_util.h        | 9 +++++++--
 tools/testing/selftests/kvm/lib/arm64/processor.c     | 9 +++------
 tools/testing/selftests/kvm/lib/kvm_util.c            | 2 +-
 tools/testing/selftests/kvm/lib/riscv/processor.c     | 7 +------
 5 files changed, 16 insertions(+), 15 deletions(-)

base-commit: 9ace4753a5202b02191d54e9fdf7f9e3d02b85eb

Signature · 1 line
2.52.0.457.g6b5491de43-goog