KVM: arm64: Improve error handling from check_host_shared_guest()
authorQuentin Perret <qperret@google.com>
Fri, 7 Feb 2025 14:54:37 +0000 (14:54 +0000)
committerMarc Zyngier <maz@kernel.org>
Sun, 9 Feb 2025 10:20:38 +0000 (10:20 +0000)
commitc53fbdb60fb61fd6bda2bc0dc89837966625c5dc
tree1ef0e923b101372461b674911d301bf72fa00f73
parent0e459810285503fb354537e84049e212c5917c33
KVM: arm64: Improve error handling from check_host_shared_guest()

The check_host_shared_guest() path expects to find a last-level valid
PTE in the guest's stage-2 page-table. However, it checks the PTE's
level before its validity, which makes it hard for callers to figure out
what went wrong.

To make error handling simpler, check the PTE's validity first.

Signed-off-by: Quentin Perret <qperret@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20250207145438.1333475-2-qperret@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/mem_protect.c