From: Vincent Donnefort <vdonnefort@google.com>
To: maz@kernel.org, oupton@kernel.org, kvmarm@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Cc: joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org,
kernel-team@android.com, fuad.tabba@linux.dev,
qperret@google.com, Vincent Donnefort <vdonnefort@google.com>
Subject: [PATCH v1 2/3] KVM: arm64: Add guest_hvc hyp event
Date: Fri, 9 Oct 2026 09:45:28 +0100 [thread overview]
Message-ID: <20261009084529.462577-3-vdonnefort@google.com> (raw)
In-Reply-To: <20261009084529.462577-1-vdonnefort@google.com>
Add a guest_hvc hypervisor trace event to log protected VM HVC call IDs,
return values, and whether the call was handled by the hypervisor.
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
---
arch/arm64/include/asm/kvm_hypevents.h | 16 ++++++++++++++++
arch/arm64/kvm/hyp/nvhe/pkvm.c | 7 ++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h
index 96985c93a15e..c1239d78c8f9 100644
--- a/arch/arm64/include/asm/kvm_hypevents.h
+++ b/arch/arm64/include/asm/kvm_hypevents.h
@@ -59,4 +59,20 @@ HYP_EVENT(selftest,
),
RE_PRINTK("id=%llu", __entry->id)
);
+
+HYP_EVENT(guest_hvc,
+ HE_PROTO(u32 id, u64 val, u8 handled),
+ HE_STRUCT(
+ he_field(u8, handled)
+ he_field(u32, id)
+ he_field(u64, val)
+ ),
+ HE_ASSIGN(
+ __entry->id = id;
+ __entry->val = val;
+ __entry->handled = handled;
+ ),
+ HE_PRINTK("id=0x%x val=0x%llx handled=%u",
+ __entry->id, __entry->val, __entry->handled)
+);
#endif
diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
index 6290c4b62659..0deed0622677 100644
--- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
+++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
@@ -10,6 +10,7 @@
#include <linux/mm.h>
#include <asm/kvm_emulate.h>
+#include <asm/kvm_hypevents.h>
#include <nvhe/mem_protect.h>
#include <nvhe/memory.h>
@@ -1142,9 +1143,10 @@ static void pkvm_memunshare_call(u64 *ret, struct kvm_vcpu *vcpu)
bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
{
u64 val[4] = { SMCCC_RET_INVALID_PARAMETER };
+ u32 fn = smccc_get_function(vcpu);
bool handled = true;
- switch (smccc_get_function(vcpu)) {
+ switch (fn) {
case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
val[0] = BIT(ARM_SMCCC_KVM_FUNC_FEATURES);
val[0] |= BIT(ARM_SMCCC_KVM_FUNC_HYP_MEMINFO);
@@ -1183,5 +1185,8 @@ bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
if (handled)
smccc_set_retval(vcpu, val[0], val[1], val[2], val[3]);
+
+ trace_guest_hvc(fn, val[0], handled);
+
return handled;
}
--
2.56.0.385.gd3acb90ef8-goog
next prev parent reply other threads:[~2026-10-09 8:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 8:45 [PATCH v1 0/3] KVM: arm64: pkvm: Extend hypervisor entering tracing reasons Vincent Donnefort
2026-10-09 8:45 ` [PATCH v1 1/3] KVM: arm64: Add ESR class to the hyp_enter hyp event Vincent Donnefort
2026-10-09 11:30 ` Fuad Tabba
2026-10-09 13:02 ` Vincent Donnefort
2026-10-09 14:08 ` Fuad Tabba
2026-10-09 8:45 ` Vincent Donnefort [this message]
2026-10-09 12:06 ` [PATCH v1 2/3] KVM: arm64: Add guest_hvc " Fuad Tabba
2026-10-09 13:17 ` Vincent Donnefort
2026-10-09 8:45 ` [PATCH v1 3/3] KVM: arm64: Add host_hvc " Vincent Donnefort
2026-10-09 12:26 ` Fuad Tabba
2026-10-09 13:20 ` Vincent Donnefort
2026-10-09 13:50 ` [PATCH v1 0/3] KVM: arm64: pkvm: Extend hypervisor entering tracing reasons Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009084529.462577-3-vdonnefort@google.com \
--to=vdonnefort@google.com \
--cc=catalin.marinas@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=qperret@google.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox