[PATCH v2 5/5] KVM: arm64: Add host_hvc hyp event

Vincent Donnefort vdonnefort at google.com
Wed Nov 4 06:06:12 PST 2026


In a similar fashion to the guest_hvc hypervisor event, log hypervisor
handled host HVCs with their return values, stored in x1.

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 63d98dd92cb0..9a240fa410ca 100644
--- a/arch/arm64/include/asm/kvm_hypevents.h
+++ b/arch/arm64/include/asm/kvm_hypevents.h
@@ -66,6 +66,19 @@ HYP_EVENT(selftest,
 	RE_PRINTK("id=%llu", __entry->id)
 );
 
+HYP_EVENT(host_hvc,
+	HE_PROTO(u32 id, u64 x1),
+	HE_STRUCT(
+		he_field(u32, id)
+		he_field(u64, x1)
+	),
+	HE_ASSIGN(
+		__entry->id = id;
+		__entry->x1 = x1;
+	),
+	HE_PRINTK("id=0x%x x1=0x%llx", __entry->id, __entry->x1)
+);
+
 HYP_EVENT(guest_hvc,
 	HE_PROTO(u32 id, u64 x0),
 	HE_STRUCT(
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index 28e0191e443f..1113cd828bd5 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -1642,6 +1642,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(KVM_HOST_SMCCC_ID(id), cpu_reg(host_ctxt, 1));
+
 	return;
 inval:
 	cpu_reg(host_ctxt, 0) = SMCCC_RET_NOT_SUPPORTED;
-- 
2.56.0.455.g6c5a503b38-goog




More information about the linux-arm-kernel mailing list