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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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-only
  2 /*
  3  * Arch specific functions for perf kvm stat.
  4  *
  5  * Copyright 2014 IBM Corp.
  6  * Author(s): Alexander Yarygin <yarygin@linux.vnet.ibm.com>
  7  */
  8 
  9 #include <errno.h>
 10 #include <string.h>
 11 #include "../../util/kvm-stat.h"
 12 #include "../../util/evsel.h"
 13 #include <asm/sie.h>
 14 
 15 define_exit_reasons_table(sie_exit_reasons, sie_intercept_code);
 16 define_exit_reasons_table(sie_icpt_insn_codes, icpt_insn_codes);
 17 define_exit_reasons_table(sie_sigp_order_codes, sigp_order_codes);
 18 define_exit_reasons_table(sie_diagnose_codes, diagnose_codes);
 19 define_exit_reasons_table(sie_icpt_prog_codes, icpt_prog_codes);
 20 
 21 const char *vcpu_id_str = "id";
 22 const char *kvm_exit_reason = "icptcode";
 23 const char *kvm_entry_trace = "kvm:kvm_s390_sie_enter";
 24 const char *kvm_exit_trace = "kvm:kvm_s390_sie_exit";
 25 
 26 static void event_icpt_insn_get_key(struct evsel *evsel,
 27                                     struct perf_sample *sample,
 28                                     struct event_key *key)
 29 {
 30         unsigned long insn;
 31 
 32         insn = evsel__intval(evsel, sample, "instruction");
 33         key->key = icpt_insn_decoder(insn);
 34         key->exit_reasons = sie_icpt_insn_codes;
 35 }
 36 
 37 static void event_sigp_get_key(struct evsel *evsel,
 38                                struct perf_sample *sample,
 39                                struct event_key *key)
 40 {
 41         key->key = evsel__intval(evsel, sample, "order_code");
 42         key->exit_reasons = sie_sigp_order_codes;
 43 }
 44 
 45 static void event_diag_get_key(struct evsel *evsel,
 46                                struct perf_sample *sample,
 47                                struct event_key *key)
 48 {
 49         key->key = evsel__intval(evsel, sample, "code");
 50         key->exit_reasons = sie_diagnose_codes;
 51 }
 52 
 53 static void event_icpt_prog_get_key(struct evsel *evsel,
 54                                     struct perf_sample *sample,
 55                                     struct event_key *key)
 56 {
 57         key->key = evsel__intval(evsel, sample, "code");
 58         key->exit_reasons = sie_icpt_prog_codes;
 59 }
 60 
 61 static struct child_event_ops child_events[] = {
 62         { .name = "kvm:kvm_s390_intercept_instruction",
 63           .get_key = event_icpt_insn_get_key },
 64         { .name = "kvm:kvm_s390_handle_sigp",
 65           .get_key = event_sigp_get_key },
 66         { .name = "kvm:kvm_s390_handle_diag",
 67           .get_key = event_diag_get_key },
 68         { .name = "kvm:kvm_s390_intercept_prog",
 69           .get_key = event_icpt_prog_get_key },
 70         { NULL, NULL },
 71 };
 72 
 73 static struct kvm_events_ops exit_events = {
 74         .is_begin_event = exit_event_begin,
 75         .is_end_event = exit_event_end,
 76         .child_ops = child_events,
 77         .decode_key = exit_event_decode_key,
 78         .name = "VM-EXIT"
 79 };
 80 
 81 const char *kvm_events_tp[] = {
 82         "kvm:kvm_s390_sie_enter",
 83         "kvm:kvm_s390_sie_exit",
 84         "kvm:kvm_s390_intercept_instruction",
 85         "kvm:kvm_s390_handle_sigp",
 86         "kvm:kvm_s390_handle_diag",
 87         "kvm:kvm_s390_intercept_prog",
 88         NULL,
 89 };
 90 
 91 struct kvm_reg_events_ops kvm_reg_events_ops[] = {
 92         { .name = "vmexit", .ops = &exit_events },
 93         { NULL, NULL },
 94 };
 95 
 96 const char * const kvm_skip_events[] = {
 97         "Wait state",
 98         NULL,
 99 };
100 
101 int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid)
102 {
103         if (strstr(cpuid, "IBM")) {
104                 kvm->exit_reasons = sie_exit_reasons;
105                 kvm->exit_reasons_isa = "SIE";
106         } else
107                 return -ENOTSUP;
108 
109         return 0;
110 }
111 

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