| .. | .. |
|---|
| 1 | | -// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * xHCI host controller driver |
|---|
| 4 | 4 | * |
|---|
| .. | .. |
|---|
| 24 | 24 | #include <linux/tracepoint.h> |
|---|
| 25 | 25 | #include "xhci.h" |
|---|
| 26 | 26 | #include "xhci-dbgcap.h" |
|---|
| 27 | | - |
|---|
| 28 | | -#define XHCI_MSG_MAX 500 |
|---|
| 29 | 27 | |
|---|
| 30 | 28 | DECLARE_EVENT_CLASS(xhci_log_msg, |
|---|
| 31 | 29 | TP_PROTO(struct va_format *vaf), |
|---|
| .. | .. |
|---|
| 82 | 80 | __field(dma_addr_t, ctx_dma) |
|---|
| 83 | 81 | __field(u8 *, ctx_va) |
|---|
| 84 | 82 | __field(unsigned, ctx_ep_num) |
|---|
| 85 | | - __field(int, slot_id) |
|---|
| 86 | 83 | __dynamic_array(u32, ctx_data, |
|---|
| 87 | 84 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * |
|---|
| 88 | 85 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) |
|---|
| 89 | 86 | ), |
|---|
| 90 | 87 | TP_fast_assign( |
|---|
| 91 | | - struct usb_device *udev; |
|---|
| 92 | 88 | |
|---|
| 93 | | - udev = to_usb_device(xhci_to_hcd(xhci)->self.controller); |
|---|
| 94 | 89 | __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
|---|
| 95 | 90 | __entry->ctx_type = ctx->type; |
|---|
| 96 | 91 | __entry->ctx_dma = ctx->dma; |
|---|
| 97 | 92 | __entry->ctx_va = ctx->bytes; |
|---|
| 98 | | - __entry->slot_id = udev->slot_id; |
|---|
| 99 | 93 | __entry->ctx_ep_num = ep_num; |
|---|
| 100 | 94 | memcpy(__get_dynamic_array(ctx_data), ctx->bytes, |
|---|
| 101 | 95 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * |
|---|
| .. | .. |
|---|
| 122 | 116 | __field(u32, field1) |
|---|
| 123 | 117 | __field(u32, field2) |
|---|
| 124 | 118 | __field(u32, field3) |
|---|
| 119 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 125 | 120 | ), |
|---|
| 126 | 121 | TP_fast_assign( |
|---|
| 127 | 122 | __entry->type = ring->type; |
|---|
| .. | .. |
|---|
| 131 | 126 | __entry->field3 = le32_to_cpu(trb->field[3]); |
|---|
| 132 | 127 | ), |
|---|
| 133 | 128 | TP_printk("%s: %s", xhci_ring_type_string(__entry->type), |
|---|
| 134 | | - xhci_decode_trb(__entry->field0, __entry->field1, |
|---|
| 129 | + xhci_decode_trb(__get_str(str), XHCI_MSG_MAX, __entry->field0, __entry->field1, |
|---|
| 135 | 130 | __entry->field2, __entry->field3) |
|---|
| 136 | 131 | ) |
|---|
| 137 | 132 | ); |
|---|
| .. | .. |
|---|
| 323 | 318 | __field(u32, info2) |
|---|
| 324 | 319 | __field(u64, deq) |
|---|
| 325 | 320 | __field(u32, tx_info) |
|---|
| 321 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 326 | 322 | ), |
|---|
| 327 | 323 | TP_fast_assign( |
|---|
| 328 | 324 | __entry->info = le32_to_cpu(ctx->ep_info); |
|---|
| .. | .. |
|---|
| 330 | 326 | __entry->deq = le64_to_cpu(ctx->deq); |
|---|
| 331 | 327 | __entry->tx_info = le32_to_cpu(ctx->tx_info); |
|---|
| 332 | 328 | ), |
|---|
| 333 | | - TP_printk("%s", xhci_decode_ep_context(__entry->info, |
|---|
| 334 | | - __entry->info2, __entry->deq, __entry->tx_info) |
|---|
| 329 | + TP_printk("%s", xhci_decode_ep_context(__get_str(str), |
|---|
| 330 | + __entry->info, __entry->info2, __entry->deq, __entry->tx_info) |
|---|
| 335 | 331 | ) |
|---|
| 336 | 332 | ); |
|---|
| 337 | 333 | |
|---|
| .. | .. |
|---|
| 355 | 351 | TP_ARGS(ctx) |
|---|
| 356 | 352 | ); |
|---|
| 357 | 353 | |
|---|
| 354 | +DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint, |
|---|
| 355 | + TP_PROTO(struct xhci_ep_ctx *ctx), |
|---|
| 356 | + TP_ARGS(ctx) |
|---|
| 357 | +); |
|---|
| 358 | + |
|---|
| 358 | 359 | DECLARE_EVENT_CLASS(xhci_log_slot_ctx, |
|---|
| 359 | 360 | TP_PROTO(struct xhci_slot_ctx *ctx), |
|---|
| 360 | 361 | TP_ARGS(ctx), |
|---|
| .. | .. |
|---|
| 363 | 364 | __field(u32, info2) |
|---|
| 364 | 365 | __field(u32, tt_info) |
|---|
| 365 | 366 | __field(u32, state) |
|---|
| 367 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 366 | 368 | ), |
|---|
| 367 | 369 | TP_fast_assign( |
|---|
| 368 | 370 | __entry->info = le32_to_cpu(ctx->dev_info); |
|---|
| .. | .. |
|---|
| 370 | 372 | __entry->tt_info = le64_to_cpu(ctx->tt_info); |
|---|
| 371 | 373 | __entry->state = le32_to_cpu(ctx->dev_state); |
|---|
| 372 | 374 | ), |
|---|
| 373 | | - TP_printk("%s", xhci_decode_slot_context(__entry->info, |
|---|
| 374 | | - __entry->info2, __entry->tt_info, |
|---|
| 375 | | - __entry->state) |
|---|
| 375 | + TP_printk("%s", xhci_decode_slot_context(__get_str(str), |
|---|
| 376 | + __entry->info, __entry->info2, |
|---|
| 377 | + __entry->tt_info, __entry->state) |
|---|
| 376 | 378 | ) |
|---|
| 377 | 379 | ); |
|---|
| 378 | 380 | |
|---|
| .. | .. |
|---|
| 419 | 421 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint, |
|---|
| 420 | 422 | TP_PROTO(struct xhci_slot_ctx *ctx), |
|---|
| 421 | 423 | TP_ARGS(ctx) |
|---|
| 424 | +); |
|---|
| 425 | + |
|---|
| 426 | +DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx, |
|---|
| 427 | + TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
|---|
| 428 | + TP_ARGS(ctrl_ctx), |
|---|
| 429 | + TP_STRUCT__entry( |
|---|
| 430 | + __field(u32, drop) |
|---|
| 431 | + __field(u32, add) |
|---|
| 432 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 433 | + ), |
|---|
| 434 | + TP_fast_assign( |
|---|
| 435 | + __entry->drop = le32_to_cpu(ctrl_ctx->drop_flags); |
|---|
| 436 | + __entry->add = le32_to_cpu(ctrl_ctx->add_flags); |
|---|
| 437 | + ), |
|---|
| 438 | + TP_printk("%s", xhci_decode_ctrl_ctx(__get_str(str), __entry->drop, __entry->add) |
|---|
| 439 | + ) |
|---|
| 440 | +); |
|---|
| 441 | + |
|---|
| 442 | +DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx, |
|---|
| 443 | + TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
|---|
| 444 | + TP_ARGS(ctrl_ctx) |
|---|
| 445 | +); |
|---|
| 446 | + |
|---|
| 447 | +DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx, |
|---|
| 448 | + TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
|---|
| 449 | + TP_ARGS(ctrl_ctx) |
|---|
| 422 | 450 | ); |
|---|
| 423 | 451 | |
|---|
| 424 | 452 | DECLARE_EVENT_CLASS(xhci_log_ring, |
|---|
| .. | .. |
|---|
| 493 | 521 | TP_STRUCT__entry( |
|---|
| 494 | 522 | __field(u32, portnum) |
|---|
| 495 | 523 | __field(u32, portsc) |
|---|
| 524 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 496 | 525 | ), |
|---|
| 497 | 526 | TP_fast_assign( |
|---|
| 498 | 527 | __entry->portnum = portnum; |
|---|
| .. | .. |
|---|
| 500 | 529 | ), |
|---|
| 501 | 530 | TP_printk("port-%d: %s", |
|---|
| 502 | 531 | __entry->portnum, |
|---|
| 503 | | - xhci_decode_portsc(__entry->portsc) |
|---|
| 532 | + xhci_decode_portsc(__get_str(str), __entry->portsc) |
|---|
| 504 | 533 | ) |
|---|
| 505 | 534 | ); |
|---|
| 506 | 535 | |
|---|
| .. | .. |
|---|
| 519 | 548 | TP_ARGS(portnum, portsc) |
|---|
| 520 | 549 | ); |
|---|
| 521 | 550 | |
|---|
| 551 | +DECLARE_EVENT_CLASS(xhci_log_doorbell, |
|---|
| 552 | + TP_PROTO(u32 slot, u32 doorbell), |
|---|
| 553 | + TP_ARGS(slot, doorbell), |
|---|
| 554 | + TP_STRUCT__entry( |
|---|
| 555 | + __field(u32, slot) |
|---|
| 556 | + __field(u32, doorbell) |
|---|
| 557 | + __dynamic_array(char, str, XHCI_MSG_MAX) |
|---|
| 558 | + ), |
|---|
| 559 | + TP_fast_assign( |
|---|
| 560 | + __entry->slot = slot; |
|---|
| 561 | + __entry->doorbell = doorbell; |
|---|
| 562 | + ), |
|---|
| 563 | + TP_printk("Ring doorbell for %s", |
|---|
| 564 | + xhci_decode_doorbell(__get_str(str), __entry->slot, __entry->doorbell) |
|---|
| 565 | + ) |
|---|
| 566 | +); |
|---|
| 567 | + |
|---|
| 568 | +DEFINE_EVENT(xhci_log_doorbell, xhci_ring_ep_doorbell, |
|---|
| 569 | + TP_PROTO(u32 slot, u32 doorbell), |
|---|
| 570 | + TP_ARGS(slot, doorbell) |
|---|
| 571 | +); |
|---|
| 572 | + |
|---|
| 573 | +DEFINE_EVENT(xhci_log_doorbell, xhci_ring_host_doorbell, |
|---|
| 574 | + TP_PROTO(u32 slot, u32 doorbell), |
|---|
| 575 | + TP_ARGS(slot, doorbell) |
|---|
| 576 | +); |
|---|
| 577 | + |
|---|
| 522 | 578 | DECLARE_EVENT_CLASS(xhci_dbc_log_request, |
|---|
| 523 | 579 | TP_PROTO(struct dbc_request *req), |
|---|
| 524 | 580 | TP_ARGS(req), |
|---|