aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/emulate-nested.c
diff options
context:
space:
mode:
authorOliver Upton <[email protected]>2025-07-08 17:25:10 +0000
committerOliver Upton <[email protected]>2025-07-08 18:35:54 +0000
commit9aba641b9ec2a9f443a6c666c054c5e98ef550b5 (patch)
tree6ca4c4e3d20f305b77f3d1d2ae9f3a6d2f9fa5f4 /arch/arm64/kvm/emulate-nested.c
parentKVM: arm64: Treat vCPU with pending SError as runnable (diff)
downloadkernel-9aba641b9ec2a9f443a6c666c054c5e98ef550b5.tar.gz
kernel-9aba641b9ec2a9f443a6c666c054c5e98ef550b5.zip
KVM: arm64: nv: Respect exception routing rules for SEAs
Synchronous external aborts are taken to EL2 if ELIsInHost() or HCR_EL2.TEA=1. Rework the SEA injection plumbing to respect the imposed routing of the guest hypervisor and opportunistically rephrase things to make their function a bit more obvious. Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
Diffstat (limited to 'arch/arm64/kvm/emulate-nested.c')
-rw-r--r--arch/arm64/kvm/emulate-nested.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index 1de4a9001d9d..65a2471c5638 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -2811,3 +2811,13 @@ int kvm_inject_nested_irq(struct kvm_vcpu *vcpu)
/* esr_el2 value doesn't matter for exits due to irqs. */
return kvm_inject_nested(vcpu, 0, except_type_irq);
}
+
+int kvm_inject_nested_sea(struct kvm_vcpu *vcpu, bool iabt, u64 addr)
+{
+ u64 esr = FIELD_PREP(ESR_ELx_EC_MASK,
+ iabt ? ESR_ELx_EC_IABT_LOW : ESR_ELx_EC_DABT_LOW);
+ esr |= ESR_ELx_FSC_EXTABT | ESR_ELx_IL;
+
+ vcpu_write_sys_reg(vcpu, FAR_EL2, addr);
+ return kvm_inject_nested_sync(vcpu, esr);
+}