KVM: arm64: Fix parameter ordering for VBAR_EL1 assignment
PATCH 1/1 KVM: arm64: Fix parameter ordering for VBAR_EL1 assignment
The __vcpu_assign_sys_reg() helper expects the register ID as the second argument and the value to be assigned as the third. However, the existing code was passing these parameters in the incorrect order.
Fix the function call to properly read the live value of VBAR_EL1 from the guest and update the vCPU value immediately before pending the exception. This ensures the vCPU's value is the same as the guest's and that the exception will be handled at the correct address upon resuming the guest.
--- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/hyp/nvhe/sys_regs.c +1 -1
@@ -253,7 +253,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu) *vcpu_pc (vcpu) =read_sysreg_el2 (SYS_ELR ); *vcpu_cpsr (vcpu) =read_sysreg_el2 (SYS_SPSR ); -__vcpu_assign_sys_reg (vcpu,read_sysreg_el1 (SYS_VBAR ),VBAR_EL1 ); +__vcpu_assign_sys_reg (vcpu,VBAR_EL1 ,read_sysreg_el1 (SYS_VBAR ));kvm_pend_exception (vcpu,EXCEPT_AA64_EL1_SYNC );
base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
Signature · 1 line
2.51.0.355.g5224444f11-goog
Oliver Upton
AppliedQuoted 11 lines · Fuad Tabba
The
__vcpu_assign_sys_reg()helper expects the register ID as the second argument and the value to be assigned as the third. However, the existing code was passing these parameters in the incorrect order.Fix the function call to properly read the live value of
VBAR_EL1from the guest and update the vCPU value immediately before pending the exception. This ensures the vCPU's value is the same as the guest's and that the exception will be handled at the correct address upon resuming the guest.[...]
Applied to fixes, thanks!
[1/1] KVM: arm64: Fix parameter ordering for VBAR_EL1 assignment
https://git.kernel.org/kvmarm/kvmarm/c/9f8073411c13
--
Best,
Oliver