hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/usb/host/xhci-trace.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * xHCI host controller driver
44 *
....@@ -24,8 +24,6 @@
2424 #include <linux/tracepoint.h>
2525 #include "xhci.h"
2626 #include "xhci-dbgcap.h"
27
-
28
-#define XHCI_MSG_MAX 500
2927
3028 DECLARE_EVENT_CLASS(xhci_log_msg,
3129 TP_PROTO(struct va_format *vaf),
....@@ -82,20 +80,16 @@
8280 __field(dma_addr_t, ctx_dma)
8381 __field(u8 *, ctx_va)
8482 __field(unsigned, ctx_ep_num)
85
- __field(int, slot_id)
8683 __dynamic_array(u32, ctx_data,
8784 ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) *
8885 ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1))
8986 ),
9087 TP_fast_assign(
91
- struct usb_device *udev;
9288
93
- udev = to_usb_device(xhci_to_hcd(xhci)->self.controller);
9489 __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params);
9590 __entry->ctx_type = ctx->type;
9691 __entry->ctx_dma = ctx->dma;
9792 __entry->ctx_va = ctx->bytes;
98
- __entry->slot_id = udev->slot_id;
9993 __entry->ctx_ep_num = ep_num;
10094 memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
10195 ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) *
....@@ -122,6 +116,7 @@
122116 __field(u32, field1)
123117 __field(u32, field2)
124118 __field(u32, field3)
119
+ __dynamic_array(char, str, XHCI_MSG_MAX)
125120 ),
126121 TP_fast_assign(
127122 __entry->type = ring->type;
....@@ -131,7 +126,7 @@
131126 __entry->field3 = le32_to_cpu(trb->field[3]);
132127 ),
133128 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,
135130 __entry->field2, __entry->field3)
136131 )
137132 );
....@@ -323,6 +318,7 @@
323318 __field(u32, info2)
324319 __field(u64, deq)
325320 __field(u32, tx_info)
321
+ __dynamic_array(char, str, XHCI_MSG_MAX)
326322 ),
327323 TP_fast_assign(
328324 __entry->info = le32_to_cpu(ctx->ep_info);
....@@ -330,8 +326,8 @@
330326 __entry->deq = le64_to_cpu(ctx->deq);
331327 __entry->tx_info = le32_to_cpu(ctx->tx_info);
332328 ),
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)
335331 )
336332 );
337333
....@@ -355,6 +351,11 @@
355351 TP_ARGS(ctx)
356352 );
357353
354
+DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint,
355
+ TP_PROTO(struct xhci_ep_ctx *ctx),
356
+ TP_ARGS(ctx)
357
+);
358
+
358359 DECLARE_EVENT_CLASS(xhci_log_slot_ctx,
359360 TP_PROTO(struct xhci_slot_ctx *ctx),
360361 TP_ARGS(ctx),
....@@ -363,6 +364,7 @@
363364 __field(u32, info2)
364365 __field(u32, tt_info)
365366 __field(u32, state)
367
+ __dynamic_array(char, str, XHCI_MSG_MAX)
366368 ),
367369 TP_fast_assign(
368370 __entry->info = le32_to_cpu(ctx->dev_info);
....@@ -370,9 +372,9 @@
370372 __entry->tt_info = le64_to_cpu(ctx->tt_info);
371373 __entry->state = le32_to_cpu(ctx->dev_state);
372374 ),
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)
376378 )
377379 );
378380
....@@ -419,6 +421,32 @@
419421 DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
420422 TP_PROTO(struct xhci_slot_ctx *ctx),
421423 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)
422450 );
423451
424452 DECLARE_EVENT_CLASS(xhci_log_ring,
....@@ -493,6 +521,7 @@
493521 TP_STRUCT__entry(
494522 __field(u32, portnum)
495523 __field(u32, portsc)
524
+ __dynamic_array(char, str, XHCI_MSG_MAX)
496525 ),
497526 TP_fast_assign(
498527 __entry->portnum = portnum;
....@@ -500,7 +529,7 @@
500529 ),
501530 TP_printk("port-%d: %s",
502531 __entry->portnum,
503
- xhci_decode_portsc(__entry->portsc)
532
+ xhci_decode_portsc(__get_str(str), __entry->portsc)
504533 )
505534 );
506535
....@@ -519,6 +548,33 @@
519548 TP_ARGS(portnum, portsc)
520549 );
521550
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
+
522578 DECLARE_EVENT_CLASS(xhci_dbc_log_request,
523579 TP_PROTO(struct dbc_request *req),
524580 TP_ARGS(req),