summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2019-04-26 09:23:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-27 08:53:58 -0400
commit90d6d5731da79a55de51552d930f9ad0b13262a2 (patch)
tree67de377ff5dfebaeda0f0df34099953736ff0774
parentd70d5a846671c3acb572425fe429b35cb4ec44a9 (diff)
xhci: Add tracing for input control context
Add tracing for the add and drop bits in the input control context used in Address device, configure endpoint, evaluate context commands. The add and drop bits tell xHC which enpoints are added and dropped. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-trace.h25
-rw-r--r--drivers/usb/host/xhci.c3
-rw-r--r--drivers/usb/host/xhci.h29
3 files changed, 57 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h
index 88b427434bd8..9b0e6419a93e 100644
--- a/drivers/usb/host/xhci-trace.h
+++ b/drivers/usb/host/xhci-trace.h
@@ -432,6 +432,31 @@ DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
432 TP_ARGS(ctx) 432 TP_ARGS(ctx)
433); 433);
434 434
435DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx,
436 TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
437 TP_ARGS(ctrl_ctx),
438 TP_STRUCT__entry(
439 __field(u32, drop)
440 __field(u32, add)
441 ),
442 TP_fast_assign(
443 __entry->drop = le32_to_cpu(ctrl_ctx->drop_flags);
444 __entry->add = le32_to_cpu(ctrl_ctx->add_flags);
445 ),
446 TP_printk("%s", xhci_decode_ctrl_ctx(__entry->drop, __entry->add)
447 )
448);
449
450DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx,
451 TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
452 TP_ARGS(ctrl_ctx)
453);
454
455DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx,
456 TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
457 TP_ARGS(ctrl_ctx)
458);
459
435DECLARE_EVENT_CLASS(xhci_log_ring, 460DECLARE_EVENT_CLASS(xhci_log_ring,
436 TP_PROTO(struct xhci_ring *ring), 461 TP_PROTO(struct xhci_ring *ring),
437 TP_ARGS(ring), 462 TP_ARGS(ring),
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index cdccbdfb479e..2ab76a57f05e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2771,6 +2771,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
2771 } 2771 }
2772 2772
2773 slot_ctx = xhci_get_slot_ctx(xhci, command->in_ctx); 2773 slot_ctx = xhci_get_slot_ctx(xhci, command->in_ctx);
2774
2775 trace_xhci_configure_endpoint_ctrl_ctx(ctrl_ctx);
2774 trace_xhci_configure_endpoint(slot_ctx); 2776 trace_xhci_configure_endpoint(slot_ctx);
2775 2777
2776 if (!ctx_change) 2778 if (!ctx_change)
@@ -4036,6 +4038,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
4036 trace_xhci_address_ctx(xhci, virt_dev->in_ctx, 4038 trace_xhci_address_ctx(xhci, virt_dev->in_ctx,
4037 le32_to_cpu(slot_ctx->dev_info) >> 27); 4039 le32_to_cpu(slot_ctx->dev_info) >> 27);
4038 4040
4041 trace_xhci_address_ctrl_ctx(ctrl_ctx);
4039 spin_lock_irqsave(&xhci->lock, flags); 4042 spin_lock_irqsave(&xhci->lock, flags);
4040 trace_xhci_setup_device(virt_dev); 4043 trace_xhci_setup_device(virt_dev);
4041 ret = xhci_queue_address_device(xhci, command, virt_dev->in_ctx->dma, 4044 ret = xhci_queue_address_device(xhci, command, virt_dev->in_ctx->dma,
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index abbd4813e8a2..a450a99e90eb 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2401,6 +2401,35 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2,
2401 return str; 2401 return str;
2402} 2402}
2403 2403
2404static inline const char *xhci_decode_ctrl_ctx(unsigned long drop,
2405 unsigned long add)
2406{
2407 static char str[1024];
2408 unsigned int bit;
2409 int ret = 0;
2410
2411 if (drop) {
2412 ret = sprintf(str, "Drop:");
2413 for_each_set_bit(bit, &drop, 32)
2414 ret += sprintf(str + ret, " %d%s",
2415 bit / 2,
2416 bit % 2 ? "in":"out");
2417 ret += sprintf(str + ret, ", ");
2418 }
2419
2420 if (add) {
2421 ret += sprintf(str + ret, "Add:%s%s",
2422 (add & SLOT_FLAG) ? " slot":"",
2423 (add & EP0_FLAG) ? " ep0":"");
2424 add &= ~(SLOT_FLAG | EP0_FLAG);
2425 for_each_set_bit(bit, &add, 32)
2426 ret += sprintf(str + ret, " %d%s",
2427 bit / 2,
2428 bit % 2 ? "in":"out");
2429 }
2430 return str;
2431}
2432
2404static inline const char *xhci_decode_slot_context(u32 info, u32 info2, 2433static inline const char *xhci_decode_slot_context(u32 info, u32 info2,
2405 u32 tt_info, u32 state) 2434 u32 tt_info, u32 state)
2406{ 2435{