~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/arch/riscv/util/kvm-stat.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Arch specific functions for perf kvm stat.
  4  *
  5  * Copyright 2024 Beijing ESWIN Computing Technology Co., Ltd.
  6  *
  7  */
  8 #include <errno.h>
  9 #include <memory.h>
 10 #include "../../../util/evsel.h"
 11 #include "../../../util/kvm-stat.h"
 12 #include "riscv_exception_types.h"
 13 #include "debug.h"
 14 
 15 define_exit_reasons_table(riscv_exit_reasons, kvm_riscv_exception_class);
 16 
 17 const char *vcpu_id_str = "id";
 18 const char *kvm_exit_reason = "scause";
 19 const char *kvm_entry_trace = "kvm:kvm_entry";
 20 const char *kvm_exit_trace = "kvm:kvm_exit";
 21 
 22 const char *kvm_events_tp[] = {
 23         "kvm:kvm_entry",
 24         "kvm:kvm_exit",
 25         NULL,
 26 };
 27 
 28 static void event_get_key(struct evsel *evsel,
 29                           struct perf_sample *sample,
 30                           struct event_key *key)
 31 {
 32         key->info = 0;
 33         key->key = evsel__intval(evsel, sample, kvm_exit_reason);
 34         key->exit_reasons = riscv_exit_reasons;
 35 }
 36 
 37 static bool event_begin(struct evsel *evsel,
 38                         struct perf_sample *sample __maybe_unused,
 39                         struct event_key *key __maybe_unused)
 40 {
 41         return evsel__name_is(evsel, kvm_entry_trace);
 42 }
 43 
 44 static bool event_end(struct evsel *evsel,
 45                       struct perf_sample *sample,
 46                       struct event_key *key)
 47 {
 48         if (evsel__name_is(evsel, kvm_exit_trace)) {
 49                 event_get_key(evsel, sample, key);
 50                 return true;
 51         }
 52         return false;
 53 }
 54 
 55 static struct kvm_events_ops exit_events = {
 56         .is_begin_event = event_begin,
 57         .is_end_event   = event_end,
 58         .decode_key     = exit_event_decode_key,
 59         .name           = "VM-EXIT"
 60 };
 61 
 62 struct kvm_reg_events_ops kvm_reg_events_ops[] = {
 63         {
 64                 .name   = "vmexit",
 65                 .ops    = &exit_events,
 66         },
 67         { NULL, NULL },
 68 };
 69 
 70 const char * const kvm_skip_events[] = {
 71         NULL,
 72 };
 73 
 74 int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid __maybe_unused)
 75 {
 76         kvm->exit_reasons_isa = "riscv64";
 77         return 0;
 78 }
 79 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php