Merge "xhci: Add tracing for xhci doorbell register writes"

This commit is contained in:
qctecmdr 2020-12-20 17:39:58 -08:00 • committed by Gerrit - the friendly Code Review server
commit 9feba1d5e3
3 changed files with 61 additions and 0 deletions

View file

@ -280,6 +280,9 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)
return;
xhci_dbg(xhci, "// Ding dong!\n");
trace_xhci_ring_host_doorbell(0, DB_VALUE_HOST);
writel(DB_VALUE_HOST, &xhci->dba->doorbell[0]);
/* Flush PCI posted writes */
readl(&xhci->dba->doorbell[0]);
@ -401,6 +404,9 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
if ((ep_state & EP_STOP_CMD_PENDING) || (ep_state & SET_DEQ_PENDING) ||
(ep_state & EP_HALTED) || (ep_state & EP_CLEARING_TT))
return;
trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id));
writel(DB_VALUE(ep_index, stream_id), db_addr);
/* The CPU has better things to do at this point than wait for a
* write-posting flush. It'll get there soon enough.

View file

@ -549,6 +549,32 @@ DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data,
TP_ARGS(portnum, portsc)
);
DECLARE_EVENT_CLASS(xhci_log_doorbell,
TP_PROTO(u32 slot, u32 doorbell),
TP_ARGS(slot, doorbell),
TP_STRUCT__entry(
__field(u32, slot)
__field(u32, doorbell)
),
TP_fast_assign(
__entry->slot = slot;
__entry->doorbell = doorbell;
),
TP_printk("Ring doorbell for %s",
xhci_decode_doorbell(__entry->slot, __entry->doorbell)
)
);
DEFINE_EVENT(xhci_log_doorbell, xhci_ring_ep_doorbell,
TP_PROTO(u32 slot, u32 doorbell),
TP_ARGS(slot, doorbell)
);
DEFINE_EVENT(xhci_log_doorbell, xhci_ring_host_doorbell,
TP_PROTO(u32 slot, u32 doorbell),
TP_ARGS(slot, doorbell)
);
DECLARE_EVENT_CLASS(xhci_dbc_log_request,
TP_PROTO(struct dbc_request *req),
TP_ARGS(req),

View file

@ -2601,6 +2601,35 @@ static inline const char *xhci_decode_portsc(u32 portsc)
return str;
}
static inline const char *xhci_decode_doorbell(u32 slot, u32 doorbell)
{
static char str[256];
u8 ep;
u16 stream;
int ret;
ep = (doorbell & 0xff);
stream = doorbell >> 16;
if (slot == 0) {
sprintf(str, "Command Ring %d", doorbell);
return str;
}
ret = sprintf(str, "Slot %d ", slot);
if (ep > 0 && ep < 32)
ret = sprintf(str + ret, "ep%d%s",
ep / 2,
ep % 2 ? "in" : "out");
else if (ep == 0 || ep < 248)
ret = sprintf(str + ret, "Reserved %d", ep);
else
ret = sprintf(str + ret, "Vendor Defined %d", ep);
if (stream)
ret = sprintf(str + ret, " Stream %d", stream);
return str;
}
static inline const char *xhci_ep_state_string(u8 state)
{
switch (state) {