.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
---|
2 | 2 | #include <errno.h> |
---|
3 | | -#include "../../util/kvm-stat.h" |
---|
| 3 | +#include <string.h> |
---|
| 4 | +#include "../../../util/kvm-stat.h" |
---|
| 5 | +#include "../../../util/evsel.h" |
---|
4 | 6 | #include <asm/svm.h> |
---|
5 | 7 | #include <asm/vmx.h> |
---|
6 | 8 | #include <asm/kvm.h> |
---|
.. | .. |
---|
26 | 28 | * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry |
---|
27 | 29 | * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...). |
---|
28 | 30 | */ |
---|
29 | | -static void mmio_event_get_key(struct perf_evsel *evsel, struct perf_sample *sample, |
---|
| 31 | +static void mmio_event_get_key(struct evsel *evsel, struct perf_sample *sample, |
---|
30 | 32 | struct event_key *key) |
---|
31 | 33 | { |
---|
32 | | - key->key = perf_evsel__intval(evsel, sample, "gpa"); |
---|
33 | | - key->info = perf_evsel__intval(evsel, sample, "type"); |
---|
| 34 | + key->key = evsel__intval(evsel, sample, "gpa"); |
---|
| 35 | + key->info = evsel__intval(evsel, sample, "type"); |
---|
34 | 36 | } |
---|
35 | 37 | |
---|
36 | 38 | #define KVM_TRACE_MMIO_READ_UNSATISFIED 0 |
---|
37 | 39 | #define KVM_TRACE_MMIO_READ 1 |
---|
38 | 40 | #define KVM_TRACE_MMIO_WRITE 2 |
---|
39 | 41 | |
---|
40 | | -static bool mmio_event_begin(struct perf_evsel *evsel, |
---|
| 42 | +static bool mmio_event_begin(struct evsel *evsel, |
---|
41 | 43 | struct perf_sample *sample, struct event_key *key) |
---|
42 | 44 | { |
---|
43 | 45 | /* MMIO read begin event in kernel. */ |
---|
.. | .. |
---|
46 | 48 | |
---|
47 | 49 | /* MMIO write begin event in kernel. */ |
---|
48 | 50 | if (!strcmp(evsel->name, "kvm:kvm_mmio") && |
---|
49 | | - perf_evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_WRITE) { |
---|
| 51 | + evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_WRITE) { |
---|
50 | 52 | mmio_event_get_key(evsel, sample, key); |
---|
51 | 53 | return true; |
---|
52 | 54 | } |
---|
.. | .. |
---|
54 | 56 | return false; |
---|
55 | 57 | } |
---|
56 | 58 | |
---|
57 | | -static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, |
---|
| 59 | +static bool mmio_event_end(struct evsel *evsel, struct perf_sample *sample, |
---|
58 | 60 | struct event_key *key) |
---|
59 | 61 | { |
---|
60 | 62 | /* MMIO write end event in kernel. */ |
---|
.. | .. |
---|
63 | 65 | |
---|
64 | 66 | /* MMIO read end event in kernel.*/ |
---|
65 | 67 | if (!strcmp(evsel->name, "kvm:kvm_mmio") && |
---|
66 | | - perf_evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_READ) { |
---|
| 68 | + evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_READ) { |
---|
67 | 69 | mmio_event_get_key(evsel, sample, key); |
---|
68 | 70 | return true; |
---|
69 | 71 | } |
---|
.. | .. |
---|
88 | 90 | }; |
---|
89 | 91 | |
---|
90 | 92 | /* The time of emulation pio access is from kvm_pio to kvm_entry. */ |
---|
91 | | -static void ioport_event_get_key(struct perf_evsel *evsel, |
---|
| 93 | +static void ioport_event_get_key(struct evsel *evsel, |
---|
92 | 94 | struct perf_sample *sample, |
---|
93 | 95 | struct event_key *key) |
---|
94 | 96 | { |
---|
95 | | - key->key = perf_evsel__intval(evsel, sample, "port"); |
---|
96 | | - key->info = perf_evsel__intval(evsel, sample, "rw"); |
---|
| 97 | + key->key = evsel__intval(evsel, sample, "port"); |
---|
| 98 | + key->info = evsel__intval(evsel, sample, "rw"); |
---|
97 | 99 | } |
---|
98 | 100 | |
---|
99 | | -static bool ioport_event_begin(struct perf_evsel *evsel, |
---|
| 101 | +static bool ioport_event_begin(struct evsel *evsel, |
---|
100 | 102 | struct perf_sample *sample, |
---|
101 | 103 | struct event_key *key) |
---|
102 | 104 | { |
---|
.. | .. |
---|
108 | 110 | return false; |
---|
109 | 111 | } |
---|
110 | 112 | |
---|
111 | | -static bool ioport_event_end(struct perf_evsel *evsel, |
---|
| 113 | +static bool ioport_event_end(struct evsel *evsel, |
---|
112 | 114 | struct perf_sample *sample __maybe_unused, |
---|
113 | 115 | struct event_key *key __maybe_unused) |
---|
114 | 116 | { |
---|