Commit 3a7fa5be authored by Xenia Ragiadakou's avatar Xenia Ragiadakou Committed by Sarah Sharp

xhci: add trace for debug messages related to changing contexts

This patch defines a new trace event, which is called xhci_dbg_context_change
and belongs in the event class xhci_log_msg, and adds tracepoints for tracing
the debug messages related to context updates performed with Configure Endpoint
and Evaluate Context commands.
Signed-off-by: default avatarXenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent 84a99f6f
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include "xhci.h" #include "xhci.h"
#include "xhci-trace.h"
/* /*
* Allocates a generic ring segment from the ring pool, sets the dma address, * Allocates a generic ring segment from the ring pool, sets the dma address,
...@@ -661,7 +662,8 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci, ...@@ -661,7 +662,8 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci,
* fls(0) = 0, fls(0x1) = 1, fls(0x10) = 2, fls(0x100) = 3, etc. * fls(0) = 0, fls(0x1) = 1, fls(0x10) = 2, fls(0x100) = 3, etc.
*/ */
max_primary_streams = fls(stream_info->num_stream_ctxs) - 2; max_primary_streams = fls(stream_info->num_stream_ctxs) - 2;
xhci_dbg(xhci, "Setting number of stream ctx array entries to %u\n", xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Setting number of stream ctx array entries to %u",
1 << (max_primary_streams + 1)); 1 << (max_primary_streams + 1));
ep_ctx->ep_info &= cpu_to_le32(~EP_MAXPSTREAMS_MASK); ep_ctx->ep_info &= cpu_to_le32(~EP_MAXPSTREAMS_MASK);
ep_ctx->ep_info |= cpu_to_le32(EP_MAXPSTREAMS(max_primary_streams) ep_ctx->ep_info |= cpu_to_le32(EP_MAXPSTREAMS(max_primary_streams)
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "xhci.h" #include "xhci.h"
#include "xhci-trace.h"
static int handle_cmd_in_cmd_wait_list(struct xhci_hcd *xhci, static int handle_cmd_in_cmd_wait_list(struct xhci_hcd *xhci,
struct xhci_virt_device *virt_dev, struct xhci_virt_device *virt_dev,
...@@ -1454,7 +1455,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1454,7 +1455,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
break; break;
} }
bandwidth_change: bandwidth_change:
xhci_dbg(xhci, "Completed config ep cmd\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Completed config ep cmd");
xhci->devs[slot_id]->cmd_status = xhci->devs[slot_id]->cmd_status =
GET_COMP_CODE(le32_to_cpu(event->status)); GET_COMP_CODE(le32_to_cpu(event->status));
complete(&xhci->devs[slot_id]->cmd_completion); complete(&xhci->devs[slot_id]->cmd_completion);
......
...@@ -36,6 +36,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, ...@@ -36,6 +36,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_address,
TP_ARGS(vaf) TP_ARGS(vaf)
); );
DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
#endif /* __XHCI_TRACE_H */ #endif /* __XHCI_TRACE_H */
/* this part must be outside header guard */ /* this part must be outside header guard */
......
...@@ -1153,12 +1153,16 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, ...@@ -1153,12 +1153,16 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
hw_max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2)); hw_max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx->ep_info2));
max_packet_size = usb_endpoint_maxp(&urb->dev->ep0.desc); max_packet_size = usb_endpoint_maxp(&urb->dev->ep0.desc);
if (hw_max_packet_size != max_packet_size) { if (hw_max_packet_size != max_packet_size) {
xhci_dbg(xhci, "Max Packet Size for ep 0 changed.\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
xhci_dbg(xhci, "Max packet size in usb_device = %d\n", "Max Packet Size for ep 0 changed.");
xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Max packet size in usb_device = %d",
max_packet_size); max_packet_size);
xhci_dbg(xhci, "Max packet size in xHCI HW = %d\n", xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Max packet size in xHCI HW = %d",
hw_max_packet_size); hw_max_packet_size);
xhci_dbg(xhci, "Issuing evaluate context command.\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Issuing evaluate context command.");
/* Set up the input context flags for the command */ /* Set up the input context flags for the command */
/* FIXME: This won't work if a non-default control endpoint /* FIXME: This won't work if a non-default control endpoint
...@@ -1776,7 +1780,8 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci, ...@@ -1776,7 +1780,8 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
ret = -ENODEV; ret = -ENODEV;
break; break;
case COMP_SUCCESS: case COMP_SUCCESS:
dev_dbg(&udev->dev, "Successful Endpoint Configure command\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Successful Endpoint Configure command");
ret = 0; ret = 0;
break; break;
default: default:
...@@ -1822,7 +1827,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, ...@@ -1822,7 +1827,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_SUCCESS: case COMP_SUCCESS:
dev_dbg(&udev->dev, "Successful evaluate context command\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Successful evaluate context command");
ret = 0; ret = 0;
break; break;
default: default:
...@@ -2583,7 +2589,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, ...@@ -2583,7 +2589,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK)) if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK))
xhci_free_host_resources(xhci, ctrl_ctx); xhci_free_host_resources(xhci, ctrl_ctx);
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
xhci_dbg(xhci, "FIXME allocate a new ring segment\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"FIXME allocate a new ring segment");
return -ENOMEM; return -ENOMEM;
} }
xhci_ring_cmd_db(xhci); xhci_ring_cmd_db(xhci);
...@@ -3865,7 +3872,8 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, ...@@ -3865,7 +3872,8 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci,
slot_ctx->dev_info2 &= cpu_to_le32(~((u32) MAX_EXIT)); slot_ctx->dev_info2 &= cpu_to_le32(~((u32) MAX_EXIT));
slot_ctx->dev_info2 |= cpu_to_le32(max_exit_latency); slot_ctx->dev_info2 |= cpu_to_le32(max_exit_latency);
xhci_dbg(xhci, "Set up evaluate context for LPM MEL change.\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_context_change,
"Set up evaluate context for LPM MEL change.");
xhci_dbg(xhci, "Slot %u Input Context:\n", udev->slot_id); xhci_dbg(xhci, "Slot %u Input Context:\n", udev->slot_id);
xhci_dbg_ctx(xhci, command->in_ctx, 0); xhci_dbg_ctx(xhci, command->in_ctx, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment