Commit 4bdfe4c38fd5b06da558050a3288a0a48825a3e7
Committed by
Sarah Sharp
1 parent
3a7fa5bef0
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
xhci: add trace for debug messages related to quirks
This patch defines a new trace event, which is called xhci_dbg_quirks and belongs in the event class xhci_log_msg, and adds tracepoints that trace the debug messages associated with xHCs' quirks. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Showing 5 changed files with 69 additions and 35 deletions Side-by-side Diff
drivers/usb/host/xhci-hub.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #include <asm/unaligned.h> |
25 | 25 | |
26 | 26 | #include "xhci.h" |
27 | +#include "xhci-trace.h" | |
27 | 28 | |
28 | 29 | #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) |
29 | 30 | #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | \ |
... | ... | @@ -535,8 +536,10 @@ |
535 | 536 | xhci->port_status_u0 |= 1 << wIndex; |
536 | 537 | if (xhci->port_status_u0 == all_ports_seen_u0) { |
537 | 538 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
538 | - xhci_dbg(xhci, "All USB3 ports have entered U0 already!\n"); | |
539 | - xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted.\n"); | |
539 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
540 | + "All USB3 ports have entered U0 already!"); | |
541 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
542 | + "Compliance Mode Recovery Timer Deleted."); | |
540 | 543 | } |
541 | 544 | } |
542 | 545 | } |
drivers/usb/host/xhci-pci.c
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | #include <linux/module.h> |
26 | 26 | |
27 | 27 | #include "xhci.h" |
28 | +#include "xhci-trace.h" | |
28 | 29 | |
29 | 30 | /* Device for a quirk */ |
30 | 31 | #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 |
31 | 32 | |
... | ... | @@ -64,16 +65,18 @@ |
64 | 65 | if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && |
65 | 66 | pdev->revision == 0x0) { |
66 | 67 | xhci->quirks |= XHCI_RESET_EP_QUIRK; |
67 | - xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" | |
68 | - " endpoint cmd after reset endpoint\n"); | |
68 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
69 | + "QUIRK: Fresco Logic xHC needs configure" | |
70 | + " endpoint cmd after reset endpoint"); | |
69 | 71 | } |
70 | 72 | /* Fresco Logic confirms: all revisions of this chip do not |
71 | 73 | * support MSI, even though some of them claim to in their PCI |
72 | 74 | * capabilities. |
73 | 75 | */ |
74 | 76 | xhci->quirks |= XHCI_BROKEN_MSI; |
75 | - xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u " | |
76 | - "has broken MSI implementation\n", | |
77 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
78 | + "QUIRK: Fresco Logic revision %u " | |
79 | + "has broken MSI implementation", | |
77 | 80 | pdev->revision); |
78 | 81 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
79 | 82 | } |
... | ... | @@ -110,7 +113,8 @@ |
110 | 113 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
111 | 114 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { |
112 | 115 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
113 | - xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | |
116 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
117 | + "QUIRK: Resetting on resume"); | |
114 | 118 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
115 | 119 | } |
116 | 120 | if (pdev->vendor == PCI_VENDOR_ID_VIA) |
drivers/usb/host/xhci-ring.c
... | ... | @@ -1159,7 +1159,8 @@ |
1159 | 1159 | * because the HW can't handle two commands being queued in a row. |
1160 | 1160 | */ |
1161 | 1161 | if (xhci->quirks & XHCI_RESET_EP_QUIRK) { |
1162 | - xhci_dbg(xhci, "Queueing configure endpoint command\n"); | |
1162 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1163 | + "Queueing configure endpoint command"); | |
1163 | 1164 | xhci_queue_configure_endpoint(xhci, |
1164 | 1165 | xhci->devs[slot_id]->in_ctx->dma, slot_id, |
1165 | 1166 | false); |
... | ... | @@ -1445,8 +1446,9 @@ |
1445 | 1446 | ep_state = xhci->devs[slot_id]->eps[ep_index].ep_state; |
1446 | 1447 | if (!(ep_state & EP_HALTED)) |
1447 | 1448 | goto bandwidth_change; |
1448 | - xhci_dbg(xhci, "Completed config ep cmd - " | |
1449 | - "last ep index = %d, state = %d\n", | |
1449 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1450 | + "Completed config ep cmd - " | |
1451 | + "last ep index = %d, state = %d", | |
1450 | 1452 | ep_index, ep_state); |
1451 | 1453 | /* Clear internal halted state and restart ring(s) */ |
1452 | 1454 | xhci->devs[slot_id]->eps[ep_index].ep_state &= |
... | ... | @@ -1499,7 +1501,8 @@ |
1499 | 1501 | xhci->error_bitmask |= 1 << 6; |
1500 | 1502 | break; |
1501 | 1503 | } |
1502 | - xhci_dbg(xhci, "NEC firmware version %2x.%02x\n", | |
1504 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1505 | + "NEC firmware version %2x.%02x", | |
1503 | 1506 | NEC_FW_MAJOR(le32_to_cpu(event->status)), |
1504 | 1507 | NEC_FW_MINOR(le32_to_cpu(event->status))); |
1505 | 1508 | break; |
drivers/usb/host/xhci-trace.h
drivers/usb/host/xhci.c
... | ... | @@ -418,9 +418,11 @@ |
418 | 418 | * Compliance Mode Detected. Letting USB Core |
419 | 419 | * handle the Warm Reset |
420 | 420 | */ |
421 | - xhci_dbg(xhci, "Compliance mode detected->port %d\n", | |
421 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
422 | + "Compliance mode detected->port %d", | |
422 | 423 | i + 1); |
423 | - xhci_dbg(xhci, "Attempting compliance mode recovery\n"); | |
424 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
425 | + "Attempting compliance mode recovery"); | |
424 | 426 | hcd = xhci->shared_hcd; |
425 | 427 | |
426 | 428 | if (hcd->state == HC_STATE_SUSPENDED) |
... | ... | @@ -458,7 +460,8 @@ |
458 | 460 | set_timer_slack(&xhci->comp_mode_recovery_timer, |
459 | 461 | msecs_to_jiffies(COMP_MODE_RCVRY_MSECS)); |
460 | 462 | add_timer(&xhci->comp_mode_recovery_timer); |
461 | - xhci_dbg(xhci, "Compliance mode recovery timer initialized\n"); | |
463 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
464 | + "Compliance mode recovery timer initialized"); | |
462 | 465 | } |
463 | 466 | |
464 | 467 | /* |
... | ... | @@ -509,7 +512,8 @@ |
509 | 512 | xhci_dbg(xhci, "xhci_init\n"); |
510 | 513 | spin_lock_init(&xhci->lock); |
511 | 514 | if (xhci->hci_version == 0x95 && link_quirk) { |
512 | - xhci_dbg(xhci, "QUIRK: Not clearing Link TRB chain bits.\n"); | |
515 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
516 | + "QUIRK: Not clearing Link TRB chain bits."); | |
513 | 517 | xhci->quirks |= XHCI_LINK_TRB_QUIRK; |
514 | 518 | } else { |
515 | 519 | xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); |
... | ... | @@ -668,7 +672,8 @@ |
668 | 672 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
669 | 673 | (!(xhci_all_ports_seen_u0(xhci)))) { |
670 | 674 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
671 | - xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", | |
675 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
676 | + "%s: compliance mode recovery timer deleted", | |
672 | 677 | __func__); |
673 | 678 | } |
674 | 679 | |
... | ... | @@ -866,7 +871,8 @@ |
866 | 871 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
867 | 872 | (!(xhci_all_ports_seen_u0(xhci)))) { |
868 | 873 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
869 | - xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", | |
874 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
875 | + "%s: compliance mode recovery timer deleted", | |
870 | 876 | __func__); |
871 | 877 | } |
872 | 878 | |
... | ... | @@ -931,7 +937,8 @@ |
931 | 937 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
932 | 938 | !(xhci_all_ports_seen_u0(xhci))) { |
933 | 939 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
934 | - xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n"); | |
940 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
941 | + "Compliance Mode Recovery Timer deleted!"); | |
935 | 942 | } |
936 | 943 | |
937 | 944 | /* Let the USB core know _both_ roothubs lost power. */ |
938 | 945 | |
... | ... | @@ -1894,14 +1901,16 @@ |
1894 | 1901 | |
1895 | 1902 | added_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); |
1896 | 1903 | if (xhci->num_active_eps + added_eps > xhci->limit_active_eps) { |
1897 | - xhci_dbg(xhci, "Not enough ep ctxs: " | |
1898 | - "%u active, need to add %u, limit is %u.\n", | |
1904 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1905 | + "Not enough ep ctxs: " | |
1906 | + "%u active, need to add %u, limit is %u.", | |
1899 | 1907 | xhci->num_active_eps, added_eps, |
1900 | 1908 | xhci->limit_active_eps); |
1901 | 1909 | return -ENOMEM; |
1902 | 1910 | } |
1903 | 1911 | xhci->num_active_eps += added_eps; |
1904 | - xhci_dbg(xhci, "Adding %u ep ctxs, %u now active.\n", added_eps, | |
1912 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1913 | + "Adding %u ep ctxs, %u now active.", added_eps, | |
1905 | 1914 | xhci->num_active_eps); |
1906 | 1915 | return 0; |
1907 | 1916 | } |
... | ... | @@ -1919,7 +1928,8 @@ |
1919 | 1928 | |
1920 | 1929 | num_failed_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); |
1921 | 1930 | xhci->num_active_eps -= num_failed_eps; |
1922 | - xhci_dbg(xhci, "Removing %u failed ep ctxs, %u now active.\n", | |
1931 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1932 | + "Removing %u failed ep ctxs, %u now active.", | |
1923 | 1933 | num_failed_eps, |
1924 | 1934 | xhci->num_active_eps); |
1925 | 1935 | } |
... | ... | @@ -1938,7 +1948,8 @@ |
1938 | 1948 | num_dropped_eps = xhci_count_num_dropped_endpoints(xhci, ctrl_ctx); |
1939 | 1949 | xhci->num_active_eps -= num_dropped_eps; |
1940 | 1950 | if (num_dropped_eps) |
1941 | - xhci_dbg(xhci, "Removing %u dropped ep ctxs, %u now active.\n", | |
1951 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
1952 | + "Removing %u dropped ep ctxs, %u now active.", | |
1942 | 1953 | num_dropped_eps, |
1943 | 1954 | xhci->num_active_eps); |
1944 | 1955 | } |
1945 | 1956 | |
1946 | 1957 | |
... | ... | @@ -2099,18 +2110,21 @@ |
2099 | 2110 | * that the HS bus has enough bandwidth if we are activing a new TT. |
2100 | 2111 | */ |
2101 | 2112 | if (virt_dev->tt_info) { |
2102 | - xhci_dbg(xhci, "Recalculating BW for rootport %u\n", | |
2113 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
2114 | + "Recalculating BW for rootport %u", | |
2103 | 2115 | virt_dev->real_port); |
2104 | 2116 | if (xhci_check_tt_bw_table(xhci, virt_dev, old_active_eps)) { |
2105 | 2117 | xhci_warn(xhci, "Not enough bandwidth on HS bus for " |
2106 | 2118 | "newly activated TT.\n"); |
2107 | 2119 | return -ENOMEM; |
2108 | 2120 | } |
2109 | - xhci_dbg(xhci, "Recalculating BW for TT slot %u port %u\n", | |
2121 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
2122 | + "Recalculating BW for TT slot %u port %u", | |
2110 | 2123 | virt_dev->tt_info->slot_id, |
2111 | 2124 | virt_dev->tt_info->ttport); |
2112 | 2125 | } else { |
2113 | - xhci_dbg(xhci, "Recalculating BW for rootport %u\n", | |
2126 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
2127 | + "Recalculating BW for rootport %u", | |
2114 | 2128 | virt_dev->real_port); |
2115 | 2129 | } |
2116 | 2130 | |
... | ... | @@ -2218,8 +2232,9 @@ |
2218 | 2232 | xhci->rh_bw[port_index].num_active_tts; |
2219 | 2233 | } |
2220 | 2234 | |
2221 | - xhci_dbg(xhci, "Final bandwidth: %u, Limit: %u, Reserved: %u, " | |
2222 | - "Available: %u " "percent\n", | |
2235 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
2236 | + "Final bandwidth: %u, Limit: %u, Reserved: %u, " | |
2237 | + "Available: %u " "percent", | |
2223 | 2238 | bw_used, max_bandwidth, bw_reserved, |
2224 | 2239 | (max_bandwidth - bw_used - bw_reserved) * 100 / |
2225 | 2240 | max_bandwidth); |
... | ... | @@ -2825,8 +2840,9 @@ |
2825 | 2840 | * XXX: No idea how this hardware will react when stream rings |
2826 | 2841 | * are enabled. |
2827 | 2842 | */ |
2828 | - xhci_dbg(xhci, "Setting up input context for " | |
2829 | - "configure endpoint command\n"); | |
2843 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
2844 | + "Setting up input context for " | |
2845 | + "configure endpoint command"); | |
2830 | 2846 | xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, |
2831 | 2847 | ep_index, &deq_state); |
2832 | 2848 | } |
... | ... | @@ -3305,8 +3321,9 @@ |
3305 | 3321 | } |
3306 | 3322 | xhci->num_active_eps -= num_dropped_eps; |
3307 | 3323 | if (num_dropped_eps) |
3308 | - xhci_dbg(xhci, "Dropped %u ep ctxs, flags = 0x%x, " | |
3309 | - "%u now active.\n", | |
3324 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
3325 | + "Dropped %u ep ctxs, flags = 0x%x, " | |
3326 | + "%u now active.", | |
3310 | 3327 | num_dropped_eps, drop_flags, |
3311 | 3328 | xhci->num_active_eps); |
3312 | 3329 | } |
3313 | 3330 | |
... | ... | @@ -3568,13 +3585,15 @@ |
3568 | 3585 | static int xhci_reserve_host_control_ep_resources(struct xhci_hcd *xhci) |
3569 | 3586 | { |
3570 | 3587 | if (xhci->num_active_eps + 1 > xhci->limit_active_eps) { |
3571 | - xhci_dbg(xhci, "Not enough ep ctxs: " | |
3572 | - "%u active, need to add 1, limit is %u.\n", | |
3588 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
3589 | + "Not enough ep ctxs: " | |
3590 | + "%u active, need to add 1, limit is %u.", | |
3573 | 3591 | xhci->num_active_eps, xhci->limit_active_eps); |
3574 | 3592 | return -ENOMEM; |
3575 | 3593 | } |
3576 | 3594 | xhci->num_active_eps += 1; |
3577 | - xhci_dbg(xhci, "Adding 1 ep ctx, %u now active.\n", | |
3595 | + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | |
3596 | + "Adding 1 ep ctx, %u now active.", | |
3578 | 3597 | xhci->num_active_eps); |
3579 | 3598 | return 0; |
3580 | 3599 | } |