]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Simplify nested VMA shift calculation
authorFuad Tabba <tabba@google.com>
Fri, 6 Mar 2026 14:02:26 +0000 (14:02 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 28 Mar 2026 11:29:40 +0000 (11:29 +0000)
commit2175ca5384ba9f3d1f45745522cdeb5865488400
tree356aea437ed639792208275be55b6c8353430482
parent5557a3f843bcef3de9a1237020348b2859812170
KVM: arm64: Simplify nested VMA shift calculation

In the kvm_s2_resolve_vma_size() helper, the local variable vma_pagesize
is calculated from vma_shift, only to be used to bound the vma_pagesize
by max_map_size and subsequently convert it back to a shift via __ffs().

Because vma_pagesize and max_map_size are both powers of two, we can
simplify the logic by omitting vma_pagesize entirely and bounding the
vma_shift directly using the shift of max_map_size. This achieves the
same result while keeping the size-to-shift conversion out of the helper
logic.

Signed-off-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/mmu.c