Skip to content

Commit 2dc720e

Browse files
Fuad Tabbaoupton
authored andcommitted
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. Fixes: 798eb59 ("KVM: arm64: Sync protected guest VBAR_EL1 on injecting an undef exception") Signed-off-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent ebb2d8f commit 2dc720e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/hyp/nvhe/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu)
253253

254254
*vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
255255
*vcpu_cpsr(vcpu) = read_sysreg_el2(SYS_SPSR);
256-
__vcpu_assign_sys_reg(vcpu, read_sysreg_el1(SYS_VBAR), VBAR_EL1);
256+
__vcpu_assign_sys_reg(vcpu, VBAR_EL1, read_sysreg_el1(SYS_VBAR));
257257

258258
kvm_pend_exception(vcpu, EXCEPT_AA64_EL1_SYNC);
259259

0 commit comments

Comments
 (0)