hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/tools/perf/arch/x86/util/kvm-stat.c
....@@ -1,6 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <errno.h>
3
-#include "../../util/kvm-stat.h"
3
+#include <string.h>
4
+#include "../../../util/kvm-stat.h"
5
+#include "../../../util/evsel.h"
46 #include <asm/svm.h>
57 #include <asm/vmx.h>
68 #include <asm/kvm.h>
....@@ -26,18 +28,18 @@
2628 * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry
2729 * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...).
2830 */
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,
3032 struct event_key *key)
3133 {
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");
3436 }
3537
3638 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0
3739 #define KVM_TRACE_MMIO_READ 1
3840 #define KVM_TRACE_MMIO_WRITE 2
3941
40
-static bool mmio_event_begin(struct perf_evsel *evsel,
42
+static bool mmio_event_begin(struct evsel *evsel,
4143 struct perf_sample *sample, struct event_key *key)
4244 {
4345 /* MMIO read begin event in kernel. */
....@@ -46,7 +48,7 @@
4648
4749 /* MMIO write begin event in kernel. */
4850 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) {
5052 mmio_event_get_key(evsel, sample, key);
5153 return true;
5254 }
....@@ -54,7 +56,7 @@
5456 return false;
5557 }
5658
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,
5860 struct event_key *key)
5961 {
6062 /* MMIO write end event in kernel. */
....@@ -63,7 +65,7 @@
6365
6466 /* MMIO read end event in kernel.*/
6567 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) {
6769 mmio_event_get_key(evsel, sample, key);
6870 return true;
6971 }
....@@ -88,15 +90,15 @@
8890 };
8991
9092 /* 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,
9294 struct perf_sample *sample,
9395 struct event_key *key)
9496 {
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");
9799 }
98100
99
-static bool ioport_event_begin(struct perf_evsel *evsel,
101
+static bool ioport_event_begin(struct evsel *evsel,
100102 struct perf_sample *sample,
101103 struct event_key *key)
102104 {
....@@ -108,7 +110,7 @@
108110 return false;
109111 }
110112
111
-static bool ioport_event_end(struct perf_evsel *evsel,
113
+static bool ioport_event_end(struct evsel *evsel,
112114 struct perf_sample *sample __maybe_unused,
113115 struct event_key *key __maybe_unused)
114116 {