@@ -7,6 +7,8 @@
#include <linux/err.h>
#include <linux/uaccess.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/geniezone.h>
#include <linux/gzvm.h>
#include <linux/gzvm_drv.h>
#include "gzvm_arch_common.h"
@@ -33,7 +35,10 @@ int gzvm_hypcall_wrapper(unsigned long a0, unsigned long a1,
unsigned long a6, unsigned long a7,
struct arm_smccc_res *res)
{
+ trace_mtk_hypcall_enter(a0);
arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res);
+ trace_mtk_hypcall_leave(a0, (res->a0 != ERR_NOT_SUPPORTED) ? 0 : 1);
+
return gzvm_err_to_errno(res->a0);
}
@@ -10,6 +10,8 @@
#include <linux/mm.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+
+#include <trace/events/geniezone.h>
#include <linux/gzvm_drv.h>
/* maximum size needed for holding an integer */
@@ -103,6 +105,7 @@ static long gzvm_vcpu_run(struct gzvm_vcpu *vcpu, void __user *argp)
while (!need_userspace && !signal_pending(current)) {
gzvm_arch_vcpu_run(vcpu, &exit_reason);
+ trace_mtk_vcpu_exit(exit_reason);
switch (exit_reason) {
case GZVM_EXIT_MMIO:
new file mode 100644
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2023 MediaTek Inc.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM geniezone
+
+#define _TRACE_GENIEZONE_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(mtk_hypcall_enter,
+ TP_PROTO(unsigned long id),
+
+ TP_ARGS(id),
+
+ TP_STRUCT__entry(__field(unsigned long, id)),
+
+ TP_fast_assign(__entry->id = id;),
+
+ TP_printk("id=0x%lx", __entry->id)
+);
+
+TRACE_EVENT(mtk_hypcall_leave,
+ TP_PROTO(unsigned long id, unsigned long invalid),
+
+ TP_ARGS(id, invalid),
+
+ TP_STRUCT__entry(__field(unsigned long, id)
+ __field(unsigned long, invalid)
+ ),
+
+ TP_fast_assign(__entry->id = id;
+ __entry->invalid = invalid;
+ ),
+
+ TP_printk("id=0x%lx invalid=%lu", __entry->id, __entry->invalid)
+);
+
+TRACE_EVENT(mtk_vcpu_exit,
+ TP_PROTO(unsigned long exit_reason),
+
+ TP_ARGS(exit_reason),
+
+ TP_STRUCT__entry(__field(unsigned long, exit_reason)),
+
+ TP_fast_assign(__entry->exit_reason = exit_reason;),
+
+ TP_printk("vcpu exit_reason=0x%lx", __entry->exit_reason)
+);
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>