[PATCH v2 04/20] KVM: arm64: Remove redundant kern_hyp_va() calls from the pKVM FP sync
From: Fuad Tabba
Date: Wed Nov 25 2026 - 10:41:16 EST
With pKVM, EL2 saves FP and SVE state through the hyp vCPU, whose kvm
is the hyp VM's and whose sve_state is already a hyp address.
kern_hyp_va() returns both unchanged.
Remove the calls in fpsimd_sve_sync() and __hyp_sve_save_guest(), and
the one in kvm_hyp_save_fpsimd_host(), which only pKVM reaches. The
ones in __hyp_sve_restore_guest() and kvm_hyp_handle_fpsimd() stay, as
nVHE without pKVM reaches them with the host's pointers.
No functional change intended.
Tested-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>
Reviewed-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
index e0c55644224cb..ee85a8bc4d798 100644
--- a/arch/arm64/kvm/hyp/include/hyp/switch.h
+++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
@@ -594,7 +594,7 @@ static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)
fpsimd_save_state(&hctxt->fp_regs);
}
- if (kvm_has_fpmr(kern_hyp_va(vcpu->kvm)))
+ if (kvm_has_fpmr(vcpu->kvm))
ctxt_sys_reg(hctxt, FPMR) = read_sysreg_s(SYS_FPMR);
}
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index 9958ca6d7b0a2..57c3f7a2d4b14 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -482,7 +482,7 @@ static void __hyp_sve_save_guest(struct kvm_vcpu *vcpu)
* on the VL, so use a consistent (i.e., the maximum) guest VL.
*/
sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2);
- sve_save_state(kern_hyp_va(vcpu->arch.sve_state), true);
+ sve_save_state(vcpu->arch.sve_state, true);
fpsimd_save_common(&vcpu->arch.ctxt.fp_regs);
write_sysreg_s(sve_vq_from_vl(kvm_host_sve_max_vl) - 1, SYS_ZCR_EL2);
}
@@ -531,7 +531,7 @@ static void fpsimd_sve_sync(struct kvm_vcpu *vcpu)
else
fpsimd_save_state(&vcpu->arch.ctxt.fp_regs);
- has_fpmr = kvm_has_fpmr(kern_hyp_va(vcpu->kvm));
+ has_fpmr = kvm_has_fpmr(vcpu->kvm);
if (has_fpmr)
__vcpu_assign_sys_reg(vcpu, FPMR, read_sysreg_s(SYS_FPMR));
--
2.47.3