[PATCH v2 4/4] KVM: arm64: pkvm: Avoid trapping on HVC_RESET_VECTORS
Vincent Donnefort
vdonnefort at google.com
Thu Oct 22 07:00:48 PDT 2026
pKVM prevents the reset of the hypervisor vector and as a consequence,
kvm_hyp_initialized can never be reset. Add a fast-path for this case to
skip unnecessary HVCs on the CPU hotplug and PM path.
Signed-off-by: Vincent Donnefort <vdonnefort at google.com>
---
arch/arm64/kvm/arm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 4c4e2fb7b660..3d7199a87ca9 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -2248,8 +2248,13 @@ static void cpu_init_hyp_mode(void)
static int cpu_hyp_reset(void)
{
- if (!is_kernel_in_hyp_mode())
+ if (!is_kernel_in_hyp_mode()) {
+ /* pKVM fast-path */
+ if (is_protected_kvm_enabled() && __this_cpu_read(kvm_hyp_initialized))
+ return -EPERM;
+
return __hyp_reset_vectors() ? -EPERM : 0;
+ }
return 0;
}
--
2.56.0.257.gf7497c7d27-goog
More information about the linux-arm-kernel
mailing list