1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
// SPDX-License-Identifier: GPL-2.0
/*
* Tracepoints for RISC-V KVM
*
* Copyright 2024 Beijing ESWIN Computing Technology Co., Ltd.
*
*/
#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_KVM_H
#include <linux/tracepoint.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kvm
TRACE_EVENT(kvm_entry,
TP_PROTO(struct kvm_vcpu *vcpu),
TP_ARGS(vcpu),
TP_STRUCT__entry(
__field(unsigned long, pc)
),
TP_fast_assign(
__entry->pc = vcpu->arch.guest_context.sepc;
),
TP_printk("PC: 0x%016lx", __entry->pc)
);
TRACE_EVENT(kvm_exit,
TP_PROTO(struct kvm_cpu_trap *trap),
TP_ARGS(trap),
TP_STRUCT__entry(
__field(unsigned long, sepc)
__field(unsigned long, scause)
__field(unsigned long, stval)
__field(unsigned long, htval)
__field(unsigned long, htinst)
),
TP_fast_assign(
__entry->sepc = trap->sepc;
__entry->scause = trap->scause;
__entry->stval = trap->stval;
__entry->htval = trap->htval;
__entry->htinst = trap->htinst;
),
TP_printk("SEPC:0x%lx, SCAUSE:0x%lx, STVAL:0x%lx, HTVAL:0x%lx, HTINST:0x%lx",
__entry->sepc,
__entry->scause,
__entry->stval,
__entry->htval,
__entry->htinst)
);
TRACE_EVENT(kvm_mmio_emulate,
TP_PROTO(unsigned long vcpu_id, unsigned long sepc, unsigned long insn,
unsigned long fault_addr, bool write, int len),
TP_ARGS(vcpu_id, sepc, insn, fault_addr, write, len),
TP_STRUCT__entry(
__field(unsigned long, vcpu_id)
__field(unsigned long, sepc)
__field(unsigned long, insn)
__field(unsigned long, fault_addr)
__field(bool, write)
__field(int, len)
),
TP_fast_assign(
__entry->vcpu_id = vcpu_id;
__entry->sepc = sepc;
__entry->insn = insn;
__entry->fault_addr = fault_addr;
__entry->write = write;
__entry->len = len;
),
TP_printk("VCPU: %lu, %s MMIO at 0x%lx, len %d, insn 0x%lx, sepc 0x%lx",
__entry->vcpu_id, __entry->write ? "Store" : "Load",
__entry->fault_addr, __entry->len, __entry->insn,
__entry->sepc)
);
TRACE_EVENT(kvm_vcpu_exit,
TP_PROTO(unsigned long vcpu_id, unsigned long sepc, unsigned long scause,
unsigned long stval, unsigned long htval, unsigned long htinst),
TP_ARGS(vcpu_id, sepc, scause, stval, htval, htinst),
TP_STRUCT__entry(
__field(unsigned long, vcpu_id)
__field(unsigned long, sepc)
__field(unsigned long, scause)
__field(unsigned long, stval)
__field(unsigned long, htval)
__field(unsigned long, htinst)
),
TP_fast_assign(
__entry->vcpu_id = vcpu_id;
__entry->sepc = sepc;
__entry->scause = scause;
__entry->stval = stval;
__entry->htval = htval;
__entry->htinst = htinst;
),
TP_printk("VCPU: %lu, SEPC: 0x%lx, SCAUSE: 0x%lx, STVAL: 0x%lx, HTVAL: 0x%lx, HTINST: 0x%lx",
__entry->vcpu_id, __entry->sepc, __entry->scause,
__entry->stval, __entry->htval, __entry->htinst)
);
TRACE_EVENT(kvm_vcpu_irq,
TP_PROTO(unsigned long vcpu_id, unsigned int irq, int level),
TP_ARGS(vcpu_id, irq, level),
TP_STRUCT__entry(
__field(unsigned long, vcpu_id)
__field(unsigned int, irq)
__field(int, level)
),
TP_fast_assign(
__entry->vcpu_id = vcpu_id;
__entry->irq = irq;
__entry->level = level;
),
TP_printk("VCPU: %lu, IRQ: %u, level: %d",
__entry->vcpu_id, __entry->irq, __entry->level)
);
#endif /* _TRACE_KVM_H */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
/* This part must be outside protection */
#include <trace/define_trace.h>
|