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

TOMOYO Linux Cross Reference
Linux/tools/perf/arch/arm64/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 #include <errno.h>
  3 #include <memory.h>
  4 #include "../../../util/evsel.h"
  5 #include "../../../util/kvm-stat.h"
  6 #include "arm64_exception_types.h"
  7 #include "debug.h"
  8 
  9 define_exit_reasons_table(arm64_exit_reasons, kvm_arm_exception_type);
 10 define_exit_reasons_table(arm64_trap_exit_reasons, kvm_arm_exception_class);
 11 
 12 const char *kvm_trap_exit_reason = "esr_ec";
 13 const char *vcpu_id_str = "id";
 14 const char *kvm_exit_reason = "ret";
 15 const char *kvm_entry_trace = "kvm:kvm_entry";
 16 const char *kvm_exit_trace = "kvm:kvm_exit";
 17 
 18 const char *kvm_events_tp[] = {
 19         "kvm:kvm_entry",
 20         "kvm:kvm_exit",
 21         NULL,
 22 };
 23 
 24 static void event_get_key(struct evsel *evsel,
 25                           struct perf_sample *sample,
 26                           struct event_key *key)
 27 {
 28         key->info = 0;
 29         key->key = evsel__intval(evsel, sample, kvm_exit_reason);
 30         key->exit_reasons = arm64_exit_reasons;
 31 
 32         /*
 33          * TRAP exceptions carry exception class info in esr_ec field
 34          * and, hence, we need to use a different exit_reasons table to
 35          * properly decode event's est_ec.
 36          */
 37         if (key->key == ARM_EXCEPTION_TRAP) {
 38                 key->key = evsel__intval(evsel, sample, kvm_trap_exit_reason);
 39                 key->exit_reasons = arm64_trap_exit_reasons;
 40         }
 41 }
 42 
 43 static bool event_begin(struct evsel *evsel,
 44                         struct perf_sample *sample __maybe_unused,
 45                         struct event_key *key __maybe_unused)
 46 {
 47         return evsel__name_is(evsel, kvm_entry_trace);
 48 }
 49 
 50 static bool event_end(struct evsel *evsel,
 51                       struct perf_sample *sample,
 52                       struct event_key *key)
 53 {
 54         if (evsel__name_is(evsel, kvm_exit_trace)) {
 55                 event_get_key(evsel, sample, key);
 56                 return true;
 57         }
 58         return false;
 59 }
 60 
 61 static struct kvm_events_ops exit_events = {
 62         .is_begin_event = event_begin,
 63         .is_end_event   = event_end,
 64         .decode_key     = exit_event_decode_key,
 65         .name           = "VM-EXIT"
 66 };
 67 
 68 struct kvm_reg_events_ops kvm_reg_events_ops[] = {
 69         {
 70                 .name   = "vmexit",
 71                 .ops    = &exit_events,
 72         },
 73         { NULL, NULL },
 74 };
 75 
 76 const char * const kvm_skip_events[] = {
 77         NULL,
 78 };
 79 
 80 int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid __maybe_unused)
 81 {
 82         kvm->exit_reasons_isa = "arm64";
 83         return 0;
 84 }
 85 

~ [ 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