Skip to content

Commit f6e2262

Browse files
committed
KVM: arm64: Populate ESR_ELx.EC for emulated SError injection
The hardware vSError injection mechanism populates ESR_ELx.EC as part of ESR propagation and the contents of VSESR_EL2 populate the ISS field. Of course, this means our emulated injection needs to set up the EC correctly for an SError too. Fixes: ce66109 ("KVM: arm64: nv: Take "masked" aborts to EL2 when HCRX_EL2.TMEA is set") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 0b593ef commit f6e2262

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/kvm/inject_fault.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,13 @@ int kvm_inject_serror_esr(struct kvm_vcpu *vcpu, u64 esr)
322322
* the vCPU is in a nested context w/ vSErrors enabled then we've already
323323
* delegated he hardware vSError context (i.e. HCR_EL2.VSE, VSESR_EL2,
324324
* VDISR_EL2) to the guest hypervisor.
325+
*
326+
* As we're emulating the SError injection we need to explicitly populate
327+
* ESR_ELx.EC because hardware will not do it on our behalf.
325328
*/
326329
if (!serror_is_masked(vcpu)) {
327330
pend_serror_exception(vcpu);
331+
esr |= FIELD_PREP(ESR_ELx_EC_MASK, ESR_ELx_EC_SERROR);
328332
vcpu_write_sys_reg(vcpu, esr, exception_esr_elx(vcpu));
329333
return 1;
330334
}

0 commit comments

Comments
 (0)