Skip to content

Commit 34b6719

Browse files
matnymangregkh
authored andcommitted
xhci: remove XHCI_TRUST_TX_LENGTH quirk
If this quirk was set then driver would treat transfer events with 'Success' completion code as 'Short packet' if there were untransferred bytes left. This is so common that turn it into default behavior. xhci_warn_ratelimited() is no longer used after this, so remove it. A success event with untransferred bytes left doesn't always mean a misbehaving controller. If there was an error mid a multi-TRB TD it's allowed to issue a success event for the last TRB in that TD. See xhci 1.2 spec 4.9.1 Transfer Descriptors "Note: If an error is detected while processing a multi-TRB TD, the xHC shall generate a Transfer Event for the TRB that the error was detected on with the appropriate error Condition Code, then may advance to the next TD. If in the process of advancing to the next TD, a Transfer TRB is encountered with its IOC flag set, then the Condition Code of the Transfer Event generated for that Transfer TRB should be Success, because there was no error actually associated with the TRB that generated the Event. However, an xHC implementation may redundantly assert the original error Condition Code." Co-developed-by: Niklas Neronin <[email protected]> Signed-off-by: Niklas Neronin <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 15a2797 commit 34b6719

File tree

4 files changed

+10
-30
lines changed

4 files changed

+10
-30
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -270,17 +270,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
270270
"QUIRK: Fresco Logic revision %u "
271271
"has broken MSI implementation",
272272
pdev->revision);
273-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
274273
}
275274

276275
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
277276
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
278277
xhci->quirks |= XHCI_BROKEN_STREAMS;
279278

280-
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
281-
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100)
282-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
283-
284279
if (pdev->vendor == PCI_VENDOR_ID_NEC)
285280
xhci->quirks |= XHCI_NEC_HOST;
286281

@@ -307,11 +302,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
307302
xhci->quirks |= XHCI_RESET_ON_RESUME;
308303
}
309304

310-
if (pdev->vendor == PCI_VENDOR_ID_AMD) {
311-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
312-
if (pdev->device == 0x43f7)
313-
xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
314-
}
305+
if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43f7)
306+
xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
315307

316308
if ((pdev->vendor == PCI_VENDOR_ID_AMD) &&
317309
((pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4) ||
@@ -399,12 +391,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
399391
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
400392
pdev->device == PCI_DEVICE_ID_EJ168) {
401393
xhci->quirks |= XHCI_RESET_ON_RESUME;
402-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
403394
xhci->quirks |= XHCI_BROKEN_STREAMS;
404395
}
405396
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
406397
pdev->device == 0x0014) {
407-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
408398
xhci->quirks |= XHCI_ZERO_64B_REGS;
409399
}
410400
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
@@ -434,7 +424,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
434424
}
435425
if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
436426
pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) {
437-
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
438427
xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
439428
}
440429
if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&

drivers/usb/host/xhci-rcar.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ static int xhci_rcar_resume_quirk(struct usb_hcd *hcd)
214214
*/
215215
#define SET_XHCI_PLAT_PRIV_FOR_RCAR(firmware) \
216216
.firmware_name = firmware, \
217-
.quirks = XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH | \
218-
XHCI_SLOW_SUSPEND, \
217+
.quirks = XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND, \
219218
.init_quirk = xhci_rcar_init_quirk, \
220219
.plat_start = xhci_rcar_start, \
221220
.resume_quirk = xhci_rcar_resume_quirk,
@@ -229,8 +228,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
229228
};
230229

231230
static const struct xhci_plat_priv xhci_plat_renesas_rzv2m = {
232-
.quirks = XHCI_NO_64BIT_SUPPORT | XHCI_TRUST_TX_LENGTH |
233-
XHCI_SLOW_SUSPEND,
231+
.quirks = XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND,
234232
.init_quirk = xhci_rzv2m_init_quirk,
235233
.plat_start = xhci_rzv2m_start,
236234
};

drivers/usb/host/xhci-ring.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,8 +2397,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,
23972397
break;
23982398
if (remaining) {
23992399
frame->status = short_framestatus;
2400-
if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2401-
sum_trbs_for_length = true;
2400+
sum_trbs_for_length = true;
24022401
break;
24032402
}
24042403
frame->status = 0;
@@ -2648,15 +2647,11 @@ static int handle_tx_event(struct xhci_hcd *xhci,
26482647
* transfer type
26492648
*/
26502649
case COMP_SUCCESS:
2651-
if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
2652-
break;
2653-
if (xhci->quirks & XHCI_TRUST_TX_LENGTH ||
2654-
ep_ring->last_td_was_short)
2650+
if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
26552651
trb_comp_code = COMP_SHORT_PACKET;
2656-
else
2657-
xhci_warn_ratelimited(xhci,
2658-
"WARN Successful completion on short TX for slot %u ep %u: needs XHCI_TRUST_TX_LENGTH quirk?\n",
2659-
slot_id, ep_index);
2652+
xhci_dbg(xhci, "Successful completion on short TX for slot %u ep %u with last td short %d\n",
2653+
slot_id, ep_index, ep_ring->last_td_was_short);
2654+
}
26602655
break;
26612656
case COMP_SHORT_PACKET:
26622657
break;

drivers/usb/host/xhci.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ struct xhci_hcd {
15881588
#define XHCI_RESET_ON_RESUME BIT_ULL(7)
15891589
#define XHCI_SW_BW_CHECKING BIT_ULL(8)
15901590
#define XHCI_AMD_0x96_HOST BIT_ULL(9)
1591-
#define XHCI_TRUST_TX_LENGTH BIT_ULL(10)
1591+
#define XHCI_TRUST_TX_LENGTH BIT_ULL(10) /* Deprecated */
15921592
#define XHCI_LPM_SUPPORT BIT_ULL(11)
15931593
#define XHCI_INTEL_HOST BIT_ULL(12)
15941594
#define XHCI_SPURIOUS_REBOOT BIT_ULL(13)
@@ -1725,8 +1725,6 @@ static inline bool xhci_has_one_roothub(struct xhci_hcd *xhci)
17251725
dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
17261726
#define xhci_warn(xhci, fmt, args...) \
17271727
dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1728-
#define xhci_warn_ratelimited(xhci, fmt, args...) \
1729-
dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
17301728
#define xhci_info(xhci, fmt, args...) \
17311729
dev_info(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
17321730

0 commit comments

Comments
 (0)