Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 2 | #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) |
| 3 | #define _TRACE_KVM_H |
| 4 | |
| 5 | #include <linux/tracepoint.h> |
Alexander Yarygin | 6de1bf8 | 2014-01-30 22:11:14 +0400 | [diff] [blame] | 6 | #include <asm/sie.h> |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 7 | #include <asm/debug.h> |
Heiko Carstens | 0f20822 | 2013-09-13 13:36:25 +0200 | [diff] [blame] | 8 | #include <asm/dis.h> |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 9 | |
| 10 | #undef TRACE_SYSTEM |
| 11 | #define TRACE_SYSTEM kvm |
| 12 | #define TRACE_INCLUDE_PATH . |
| 13 | #undef TRACE_INCLUDE_FILE |
| 14 | #define TRACE_INCLUDE_FILE trace |
| 15 | |
| 16 | /* |
| 17 | * Helpers for vcpu-specific tracepoints containing the same information |
| 18 | * as s390dbf VCPU_EVENTs. |
| 19 | */ |
| 20 | #define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu |
| 21 | #define VCPU_ARGS_COMMON vcpu |
| 22 | #define VCPU_FIELD_COMMON __field(int, id) \ |
| 23 | __field(unsigned long, pswmask) \ |
| 24 | __field(unsigned long, pswaddr) |
| 25 | #define VCPU_ASSIGN_COMMON do { \ |
| 26 | __entry->id = vcpu->vcpu_id; \ |
| 27 | __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \ |
| 28 | __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \ |
| 29 | } while (0); |
| 30 | #define VCPU_TP_PRINTK(p_str, p_args...) \ |
| 31 | TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \ |
| 32 | __entry->pswmask, __entry->pswaddr, p_args) |
| 33 | |
Dominik Dingel | 693ffc0 | 2014-01-14 18:11:14 +0100 | [diff] [blame] | 34 | TRACE_EVENT(kvm_s390_skey_related_inst, |
| 35 | TP_PROTO(VCPU_PROTO_COMMON), |
| 36 | TP_ARGS(VCPU_ARGS_COMMON), |
| 37 | |
| 38 | TP_STRUCT__entry( |
| 39 | VCPU_FIELD_COMMON |
| 40 | ), |
| 41 | |
| 42 | TP_fast_assign( |
| 43 | VCPU_ASSIGN_COMMON |
| 44 | ), |
David Hildenbrand | 11ddcd4 | 2016-05-10 09:40:09 +0200 | [diff] [blame] | 45 | VCPU_TP_PRINTK("%s", "storage key related instruction") |
Dominik Dingel | 693ffc0 | 2014-01-14 18:11:14 +0100 | [diff] [blame] | 46 | ); |
| 47 | |
Dominik Dingel | 3c038e6 | 2013-10-07 17:11:48 +0200 | [diff] [blame] | 48 | TRACE_EVENT(kvm_s390_major_guest_pfault, |
| 49 | TP_PROTO(VCPU_PROTO_COMMON), |
| 50 | TP_ARGS(VCPU_ARGS_COMMON), |
| 51 | |
| 52 | TP_STRUCT__entry( |
| 53 | VCPU_FIELD_COMMON |
| 54 | ), |
| 55 | |
| 56 | TP_fast_assign( |
| 57 | VCPU_ASSIGN_COMMON |
| 58 | ), |
| 59 | VCPU_TP_PRINTK("%s", "major fault, maybe applicable for pfault") |
| 60 | ); |
| 61 | |
| 62 | TRACE_EVENT(kvm_s390_pfault_init, |
| 63 | TP_PROTO(VCPU_PROTO_COMMON, long pfault_token), |
| 64 | TP_ARGS(VCPU_ARGS_COMMON, pfault_token), |
| 65 | |
| 66 | TP_STRUCT__entry( |
| 67 | VCPU_FIELD_COMMON |
| 68 | __field(long, pfault_token) |
| 69 | ), |
| 70 | |
| 71 | TP_fast_assign( |
| 72 | VCPU_ASSIGN_COMMON |
| 73 | __entry->pfault_token = pfault_token; |
| 74 | ), |
| 75 | VCPU_TP_PRINTK("init pfault token %ld", __entry->pfault_token) |
| 76 | ); |
| 77 | |
| 78 | TRACE_EVENT(kvm_s390_pfault_done, |
| 79 | TP_PROTO(VCPU_PROTO_COMMON, long pfault_token), |
| 80 | TP_ARGS(VCPU_ARGS_COMMON, pfault_token), |
| 81 | |
| 82 | TP_STRUCT__entry( |
| 83 | VCPU_FIELD_COMMON |
| 84 | __field(long, pfault_token) |
| 85 | ), |
| 86 | |
| 87 | TP_fast_assign( |
| 88 | VCPU_ASSIGN_COMMON |
| 89 | __entry->pfault_token = pfault_token; |
| 90 | ), |
| 91 | VCPU_TP_PRINTK("done pfault token %ld", __entry->pfault_token) |
| 92 | ); |
| 93 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 94 | /* |
| 95 | * Tracepoints for SIE entry and exit. |
| 96 | */ |
| 97 | TRACE_EVENT(kvm_s390_sie_enter, |
| 98 | TP_PROTO(VCPU_PROTO_COMMON, int cpuflags), |
| 99 | TP_ARGS(VCPU_ARGS_COMMON, cpuflags), |
| 100 | |
| 101 | TP_STRUCT__entry( |
| 102 | VCPU_FIELD_COMMON |
| 103 | __field(int, cpuflags) |
| 104 | ), |
| 105 | |
| 106 | TP_fast_assign( |
| 107 | VCPU_ASSIGN_COMMON |
| 108 | __entry->cpuflags = cpuflags; |
| 109 | ), |
| 110 | |
| 111 | VCPU_TP_PRINTK("entering sie flags %x", __entry->cpuflags) |
| 112 | ); |
| 113 | |
| 114 | TRACE_EVENT(kvm_s390_sie_fault, |
| 115 | TP_PROTO(VCPU_PROTO_COMMON), |
| 116 | TP_ARGS(VCPU_ARGS_COMMON), |
| 117 | |
| 118 | TP_STRUCT__entry( |
| 119 | VCPU_FIELD_COMMON |
| 120 | ), |
| 121 | |
| 122 | TP_fast_assign( |
| 123 | VCPU_ASSIGN_COMMON |
| 124 | ), |
| 125 | |
| 126 | VCPU_TP_PRINTK("%s", "fault in sie instruction") |
| 127 | ); |
| 128 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 129 | TRACE_EVENT(kvm_s390_sie_exit, |
| 130 | TP_PROTO(VCPU_PROTO_COMMON, u8 icptcode), |
| 131 | TP_ARGS(VCPU_ARGS_COMMON, icptcode), |
| 132 | |
| 133 | TP_STRUCT__entry( |
| 134 | VCPU_FIELD_COMMON |
| 135 | __field(u8, icptcode) |
| 136 | ), |
| 137 | |
| 138 | TP_fast_assign( |
| 139 | VCPU_ASSIGN_COMMON |
| 140 | __entry->icptcode = icptcode; |
| 141 | ), |
| 142 | |
| 143 | VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode, |
| 144 | __print_symbolic(__entry->icptcode, |
| 145 | sie_intercept_code)) |
| 146 | ); |
| 147 | |
| 148 | /* |
| 149 | * Trace point for intercepted instructions. |
| 150 | */ |
| 151 | TRACE_EVENT(kvm_s390_intercept_instruction, |
| 152 | TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb), |
| 153 | TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb), |
| 154 | |
| 155 | TP_STRUCT__entry( |
| 156 | VCPU_FIELD_COMMON |
| 157 | __field(__u64, instruction) |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 158 | ), |
| 159 | |
| 160 | TP_fast_assign( |
| 161 | VCPU_ASSIGN_COMMON |
| 162 | __entry->instruction = ((__u64)ipa << 48) | |
| 163 | ((__u64)ipb << 16); |
| 164 | ), |
| 165 | |
| 166 | VCPU_TP_PRINTK("intercepted instruction %016llx (%s)", |
| 167 | __entry->instruction, |
Alexander Yarygin | d26b865 | 2014-01-30 22:13:40 +0400 | [diff] [blame] | 168 | __print_symbolic(icpt_insn_decoder(__entry->instruction), |
| 169 | icpt_insn_codes)) |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 170 | ); |
| 171 | |
| 172 | /* |
| 173 | * Trace point for intercepted program interruptions. |
| 174 | */ |
| 175 | TRACE_EVENT(kvm_s390_intercept_prog, |
| 176 | TP_PROTO(VCPU_PROTO_COMMON, __u16 code), |
| 177 | TP_ARGS(VCPU_ARGS_COMMON, code), |
| 178 | |
| 179 | TP_STRUCT__entry( |
| 180 | VCPU_FIELD_COMMON |
| 181 | __field(__u16, code) |
| 182 | ), |
| 183 | |
| 184 | TP_fast_assign( |
| 185 | VCPU_ASSIGN_COMMON |
| 186 | __entry->code = code; |
| 187 | ), |
| 188 | |
Alexander Yarygin | c1778e51 | 2016-05-06 15:47:19 +0300 | [diff] [blame] | 189 | VCPU_TP_PRINTK("intercepted program interruption %04x (%s)", |
| 190 | __entry->code, |
| 191 | __print_symbolic(__entry->code, |
| 192 | icpt_prog_codes)) |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 193 | ); |
| 194 | |
| 195 | /* |
| 196 | * Trace point for validity intercepts. |
| 197 | */ |
| 198 | TRACE_EVENT(kvm_s390_intercept_validity, |
| 199 | TP_PROTO(VCPU_PROTO_COMMON, __u16 viwhy), |
| 200 | TP_ARGS(VCPU_ARGS_COMMON, viwhy), |
| 201 | |
| 202 | TP_STRUCT__entry( |
| 203 | VCPU_FIELD_COMMON |
| 204 | __field(__u16, viwhy) |
| 205 | ), |
| 206 | |
| 207 | TP_fast_assign( |
| 208 | VCPU_ASSIGN_COMMON |
| 209 | __entry->viwhy = viwhy; |
| 210 | ), |
| 211 | |
| 212 | VCPU_TP_PRINTK("got validity intercept %04x", __entry->viwhy) |
| 213 | ); |
| 214 | |
| 215 | /* |
| 216 | * Trace points for instructions that are of special interest. |
| 217 | */ |
| 218 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 219 | TRACE_EVENT(kvm_s390_handle_sigp, |
| 220 | TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr, \ |
| 221 | __u32 parameter), |
| 222 | TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter), |
| 223 | |
| 224 | TP_STRUCT__entry( |
| 225 | VCPU_FIELD_COMMON |
| 226 | __field(__u8, order_code) |
| 227 | __field(__u16, cpu_addr) |
| 228 | __field(__u32, parameter) |
| 229 | ), |
| 230 | |
| 231 | TP_fast_assign( |
| 232 | VCPU_ASSIGN_COMMON |
| 233 | __entry->order_code = order_code; |
| 234 | __entry->cpu_addr = cpu_addr; |
| 235 | __entry->parameter = parameter; |
| 236 | ), |
| 237 | |
| 238 | VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \ |
| 239 | "parameter %08x", __entry->order_code, |
| 240 | __print_symbolic(__entry->order_code, |
| 241 | sigp_order_codes), |
| 242 | __entry->cpu_addr, __entry->parameter) |
| 243 | ); |
| 244 | |
David Hildenbrand | 4953919 | 2014-02-21 08:59:59 +0100 | [diff] [blame] | 245 | TRACE_EVENT(kvm_s390_handle_sigp_pei, |
| 246 | TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr), |
| 247 | TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr), |
| 248 | |
| 249 | TP_STRUCT__entry( |
| 250 | VCPU_FIELD_COMMON |
| 251 | __field(__u8, order_code) |
| 252 | __field(__u16, cpu_addr) |
| 253 | ), |
| 254 | |
| 255 | TP_fast_assign( |
| 256 | VCPU_ASSIGN_COMMON |
| 257 | __entry->order_code = order_code; |
| 258 | __entry->cpu_addr = cpu_addr; |
| 259 | ), |
| 260 | |
| 261 | VCPU_TP_PRINTK("handle sigp pei order %02x (%s), cpu address %04x", |
| 262 | __entry->order_code, |
| 263 | __print_symbolic(__entry->order_code, |
| 264 | sigp_order_codes), |
| 265 | __entry->cpu_addr) |
| 266 | ); |
| 267 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 268 | TRACE_EVENT(kvm_s390_handle_diag, |
| 269 | TP_PROTO(VCPU_PROTO_COMMON, __u16 code), |
| 270 | TP_ARGS(VCPU_ARGS_COMMON, code), |
| 271 | |
| 272 | TP_STRUCT__entry( |
| 273 | VCPU_FIELD_COMMON |
| 274 | __field(__u16, code) |
| 275 | ), |
| 276 | |
| 277 | TP_fast_assign( |
| 278 | VCPU_ASSIGN_COMMON |
| 279 | __entry->code = code; |
| 280 | ), |
| 281 | |
| 282 | VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry->code, |
| 283 | __print_symbolic(__entry->code, diagnose_codes)) |
| 284 | ); |
| 285 | |
| 286 | TRACE_EVENT(kvm_s390_handle_lctl, |
| 287 | TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr), |
| 288 | TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr), |
| 289 | |
| 290 | TP_STRUCT__entry( |
| 291 | VCPU_FIELD_COMMON |
| 292 | __field(int, g) |
| 293 | __field(int, reg1) |
| 294 | __field(int, reg3) |
| 295 | __field(u64, addr) |
| 296 | ), |
| 297 | |
| 298 | TP_fast_assign( |
| 299 | VCPU_ASSIGN_COMMON |
| 300 | __entry->g = g; |
| 301 | __entry->reg1 = reg1; |
| 302 | __entry->reg3 = reg3; |
| 303 | __entry->addr = addr; |
| 304 | ), |
| 305 | |
| 306 | VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx", |
| 307 | __entry->g ? "lctlg" : "lctl", |
| 308 | __entry->reg1, __entry->reg3, __entry->addr) |
| 309 | ); |
| 310 | |
David Hildenbrand | aba0750 | 2014-01-23 10:47:13 +0100 | [diff] [blame] | 311 | TRACE_EVENT(kvm_s390_handle_stctl, |
| 312 | TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr), |
| 313 | TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr), |
| 314 | |
| 315 | TP_STRUCT__entry( |
| 316 | VCPU_FIELD_COMMON |
| 317 | __field(int, g) |
| 318 | __field(int, reg1) |
| 319 | __field(int, reg3) |
| 320 | __field(u64, addr) |
| 321 | ), |
| 322 | |
| 323 | TP_fast_assign( |
| 324 | VCPU_ASSIGN_COMMON |
| 325 | __entry->g = g; |
| 326 | __entry->reg1 = reg1; |
| 327 | __entry->reg3 = reg3; |
| 328 | __entry->addr = addr; |
| 329 | ), |
| 330 | |
| 331 | VCPU_TP_PRINTK("%s: storing cr %x-%x to %016llx", |
| 332 | __entry->g ? "stctg" : "stctl", |
| 333 | __entry->reg1, __entry->reg3, __entry->addr) |
| 334 | ); |
| 335 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 336 | TRACE_EVENT(kvm_s390_handle_prefix, |
| 337 | TP_PROTO(VCPU_PROTO_COMMON, int set, u32 address), |
| 338 | TP_ARGS(VCPU_ARGS_COMMON, set, address), |
| 339 | |
| 340 | TP_STRUCT__entry( |
| 341 | VCPU_FIELD_COMMON |
| 342 | __field(int, set) |
| 343 | __field(u32, address) |
| 344 | ), |
| 345 | |
| 346 | TP_fast_assign( |
| 347 | VCPU_ASSIGN_COMMON |
| 348 | __entry->set = set; |
| 349 | __entry->address = address; |
| 350 | ), |
| 351 | |
| 352 | VCPU_TP_PRINTK("%s prefix to %08x", |
| 353 | __entry->set ? "setting" : "storing", |
| 354 | __entry->address) |
| 355 | ); |
| 356 | |
| 357 | TRACE_EVENT(kvm_s390_handle_stap, |
| 358 | TP_PROTO(VCPU_PROTO_COMMON, u64 address), |
| 359 | TP_ARGS(VCPU_ARGS_COMMON, address), |
| 360 | |
| 361 | TP_STRUCT__entry( |
| 362 | VCPU_FIELD_COMMON |
| 363 | __field(u64, address) |
| 364 | ), |
| 365 | |
| 366 | TP_fast_assign( |
| 367 | VCPU_ASSIGN_COMMON |
| 368 | __entry->address = address; |
| 369 | ), |
| 370 | |
| 371 | VCPU_TP_PRINTK("storing cpu address to %016llx", |
| 372 | __entry->address) |
| 373 | ); |
| 374 | |
| 375 | TRACE_EVENT(kvm_s390_handle_stfl, |
| 376 | TP_PROTO(VCPU_PROTO_COMMON, unsigned int facility_list), |
| 377 | TP_ARGS(VCPU_ARGS_COMMON, facility_list), |
| 378 | |
| 379 | TP_STRUCT__entry( |
| 380 | VCPU_FIELD_COMMON |
| 381 | __field(unsigned int, facility_list) |
| 382 | ), |
| 383 | |
| 384 | TP_fast_assign( |
| 385 | VCPU_ASSIGN_COMMON |
| 386 | __entry->facility_list = facility_list; |
| 387 | ), |
| 388 | |
| 389 | VCPU_TP_PRINTK("store facility list value %08x", |
| 390 | __entry->facility_list) |
| 391 | ); |
| 392 | |
| 393 | TRACE_EVENT(kvm_s390_handle_stsi, |
| 394 | TP_PROTO(VCPU_PROTO_COMMON, int fc, int sel1, int sel2, u64 addr), |
| 395 | TP_ARGS(VCPU_ARGS_COMMON, fc, sel1, sel2, addr), |
| 396 | |
| 397 | TP_STRUCT__entry( |
| 398 | VCPU_FIELD_COMMON |
| 399 | __field(int, fc) |
| 400 | __field(int, sel1) |
| 401 | __field(int, sel2) |
| 402 | __field(u64, addr) |
| 403 | ), |
| 404 | |
| 405 | TP_fast_assign( |
| 406 | VCPU_ASSIGN_COMMON |
| 407 | __entry->fc = fc; |
| 408 | __entry->sel1 = sel1; |
| 409 | __entry->sel2 = sel2; |
| 410 | __entry->addr = addr; |
| 411 | ), |
| 412 | |
| 413 | VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx", |
| 414 | __entry->fc, __entry->sel1, __entry->sel2, |
| 415 | __entry->addr) |
| 416 | ); |
| 417 | |
Janosch Frank | a011eeb | 2016-05-09 14:14:01 +0200 | [diff] [blame] | 418 | TRACE_EVENT(kvm_s390_handle_operexc, |
| 419 | TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb), |
| 420 | TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb), |
| 421 | |
| 422 | TP_STRUCT__entry( |
| 423 | VCPU_FIELD_COMMON |
| 424 | __field(__u64, instruction) |
| 425 | ), |
| 426 | |
| 427 | TP_fast_assign( |
| 428 | VCPU_ASSIGN_COMMON |
| 429 | __entry->instruction = ((__u64)ipa << 48) | |
| 430 | ((__u64)ipb << 16); |
| 431 | ), |
| 432 | |
| 433 | VCPU_TP_PRINTK("operation exception on instruction %016llx (%s)", |
| 434 | __entry->instruction, |
| 435 | __print_symbolic(icpt_insn_decoder(__entry->instruction), |
| 436 | icpt_insn_codes)) |
| 437 | ); |
| 438 | |
Janosch Frank | 95ca2cb | 2016-05-23 15:11:58 +0200 | [diff] [blame] | 439 | TRACE_EVENT(kvm_s390_handle_sthyi, |
| 440 | TP_PROTO(VCPU_PROTO_COMMON, u64 code, u64 addr), |
| 441 | TP_ARGS(VCPU_ARGS_COMMON, code, addr), |
| 442 | |
| 443 | TP_STRUCT__entry( |
| 444 | VCPU_FIELD_COMMON |
| 445 | __field(u64, code) |
| 446 | __field(u64, addr) |
| 447 | ), |
| 448 | |
| 449 | TP_fast_assign( |
| 450 | VCPU_ASSIGN_COMMON |
| 451 | __entry->code = code; |
| 452 | __entry->addr = addr; |
| 453 | ), |
| 454 | |
| 455 | VCPU_TP_PRINTK("STHYI fc: %llu addr: %016llx", |
| 456 | __entry->code, __entry->addr) |
| 457 | ); |
| 458 | |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 459 | #endif /* _TRACE_KVM_H */ |
| 460 | |
| 461 | /* This part must be outside protection */ |
| 462 | #include <trace/define_trace.h> |