KVM: arm64: Infer PA offset from VA in hyp map walker
authorOliver Upton <oliver.upton@linux.dev>
Fri, 21 Apr 2023 07:16:06 +0000 (07:16 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 21 Apr 2023 09:51:40 +0000 (10:51 +0100)
commit39bc95be3782ba88e55cd72e830f37e74395831b
tree45bc8818fbd3f9c092f0db35d18e1c0381c8018c
parent1f0f4a2ef7a5693b135ce174e71f116db4bd684d
KVM: arm64: Infer PA offset from VA in hyp map walker

Similar to the recently fixed stage-2 walker, the hyp map walker
increments the PA and VA of a walk separately. Unlike stage-2, there is
no bug here as the map walker has exclusive access to the stage-1 page
tables.

Nonetheless, in the interest of continuity throughout the page table
code, tweak the hyp map walker to avoid incrementing the PA and instead
use the VA as the authoritative source of how far along a table walk has
gotten. Calculate the PA to use for a leaf PTE by adding the offset of
the VA from the start of the walk to the starting PA.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230421071606.1603916-3-oliver.upton@linux.dev
arch/arm64/kvm/hyp/pgtable.c