]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: arm64: Add missing hyp_enter when trapping sysreg
authorVincent Donnefort <vdonnefort@google.com>
Wed, 17 Jun 2026 09:52:38 +0000 (10:52 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 23 Jul 2026 08:56:57 +0000 (09:56 +0100)
Add a missing hypervisor event call for hyp_enter on sysreg trapping,
causing an unbalanced hyp_enter/hyp_exit.

The enum hyp_enter_exit_reason is not ABI, so we can keep the ERET
reasons at the end for clarity.

Fixes: 696dfec22b8e ("KVM: arm64: Add hyp_enter/hyp_exit events to nVHE/pKVM hyp")
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260617095238.1530121-1-vdonnefort@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_hypevents.h
arch/arm64/kvm/hyp/nvhe/hyp-main.c
arch/arm64/kvm/hyp_trace.c

index 743c49bd878f72db738596689aa89aebc956fa61..5f6e6789d1211df551665e1b089c451784790fa4 100644 (file)
@@ -12,6 +12,7 @@
 enum hyp_enter_exit_reason {
        HYP_REASON_SMC,
        HYP_REASON_HVC,
+       HYP_REASON_SYS,
        HYP_REASON_PSCI,
        HYP_REASON_HOST_ABORT,
        HYP_REASON_GUEST_EXIT,
index d3c69de698f4842f3b01903bfb20306ea1256baf..d3df96ed8ba4231bf8807dc1ea15604b27457029 100644 (file)
@@ -932,6 +932,7 @@ void handle_trap(struct kvm_cpu_context *host_ctxt)
                handle_host_mem_abort(host_ctxt);
                break;
        case ESR_ELx_EC_SYS64:
+               trace_hyp_enter(host_ctxt, HYP_REASON_SYS);
                if (handle_host_mte(esr))
                        break;
                fallthrough;
index 1adfdc80018766ee7e421cbdbee6e1ea9c7fa274..9644c424819b76fb8f1e59ee5ad89fc96d356ab8 100644 (file)
@@ -409,6 +409,7 @@ static const char *__hyp_enter_exit_reason_str(u8 reason)
        static const char strs[][12] = {
                "smc",
                "hvc",
+               "sys",
                "psci",
                "host_abort",
                "guest_exit",