[PATCH v1 3/3] KVM: arm64: Add host_hvc hyp event

Vincent Donnefort vdonnefort at google.com
Fri Oct 9 01:45:29 PDT 2026


Add a host_hvc hypervisor trace event to log host HVC call IDs and
return values.

Signed-off-by: Vincent Donnefort <vdonnefort at google.com>
---
 arch/arm64/include/asm/kvm_hypevents.h | 13 +++++++++++++
 arch/arm64/kvm/hyp/nvhe/hyp-main.c     |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h
index c1239d78c8f9..a37ba9db1cc7 100644
--- a/arch/arm64/include/asm/kvm_hypevents.h
+++ b/arch/arm64/include/asm/kvm_hypevents.h
@@ -60,6 +60,19 @@ HYP_EVENT(selftest,
 	RE_PRINTK("id=%llu", __entry->id)
 );
 
+HYP_EVENT(host_hvc,
+	HE_PROTO(u8 id, u64 ret),
+	HE_STRUCT(
+		he_field(u8, id)
+		he_field(u64, ret)
+	),
+	HE_ASSIGN(
+		__entry->id = id;
+		__entry->ret = ret;
+	),
+	HE_PRINTK("id=%u ret=0x%llx", __entry->id, __entry->ret)
+);
+
 HYP_EVENT(guest_hvc,
 	HE_PROTO(u32 id, u64 val, u8 handled),
 	HE_STRUCT(
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index 76d08c503dc0..579615e3b2dd 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -996,6 +996,8 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt)
 	cpu_reg(host_ctxt, 0) = SMCCC_RET_SUCCESS;
 	hfn(host_ctxt);
 
+	trace_host_hvc(id, cpu_reg(host_ctxt, 1));
+
 	return;
 inval:
 	cpu_reg(host_ctxt, 0) = SMCCC_RET_NOT_SUPPORTED;
-- 
2.56.0.385.gd3acb90ef8-goog




More information about the linux-arm-kernel mailing list