提交 8f2c6b7c 编写于 作者: J Jonathan Bell 提交者: Zheng Zengkai

xhci: Use more event ring segment table entries

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

Users have reported log spam created by "Event Ring Full" xHC event
TRBs. These are caused by interrupt latency in conjunction with a very
busy set of devices on the bus. The errors are benign, but throughput
will suffer as the xHC will pause processing of transfers until the
event ring is drained by the kernel. Expand the number of event TRB slots
available by increasing the number of event ring segments in the ERST.

Controllers have a hardware-defined limit as to the number of ERST
entries they can process, so make the actual number in use
min(ERST_MAX_SEGS, hw_max).
Signed-off-by: NJonathan Bell <jonathan@raspberrypi.org>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7cffd5da
...@@ -2512,9 +2512,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ...@@ -2512,9 +2512,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
* Event ring setup: Allocate a normal ring, but also setup * Event ring setup: Allocate a normal ring, but also setup
* the event ring segment table (ERST). Section 4.9.3. * the event ring segment table (ERST). Section 4.9.3.
*/ */
val2 = 1 << HCS_ERST_MAX(xhci->hcs_params2);
val2 = min_t(unsigned int, ERST_MAX_SEGS, val2);
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Allocating event ring"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Allocating event ring");
xhci->event_ring = xhci_ring_alloc(xhci, ERST_NUM_SEGS, 1, TYPE_EVENT, xhci->event_ring = xhci_ring_alloc(xhci, val2, 1, TYPE_EVENT,
0, flags); 0, flags);
if (!xhci->event_ring) if (!xhci->event_ring)
goto fail; goto fail;
if (xhci_check_trb_in_td_math(xhci) < 0) if (xhci_check_trb_in_td_math(xhci) < 0)
...@@ -2527,7 +2529,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ...@@ -2527,7 +2529,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
/* set ERST count with the number of entries in the segment table */ /* set ERST count with the number of entries in the segment table */
val = readl(&xhci->ir_set->erst_size); val = readl(&xhci->ir_set->erst_size);
val &= ERST_SIZE_MASK; val &= ERST_SIZE_MASK;
val |= ERST_NUM_SEGS; val |= val2;
xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"// Write ERST size = %i to ir_set 0 (some bits preserved)", "// Write ERST size = %i to ir_set 0 (some bits preserved)",
val); val);
......
...@@ -1649,8 +1649,8 @@ struct urb_priv { ...@@ -1649,8 +1649,8 @@ struct urb_priv {
* Each segment table entry is 4*32bits long. 1K seems like an ok size: * Each segment table entry is 4*32bits long. 1K seems like an ok size:
* (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table,
* meaning 64 ring segments. * meaning 64 ring segments.
* Initial allocated size of the ERST, in number of entries */ * Maximum number of segments in the ERST */
#define ERST_NUM_SEGS 1 #define ERST_MAX_SEGS 8
/* Initial allocated size of the ERST, in number of entries */ /* Initial allocated size of the ERST, in number of entries */
#define ERST_SIZE 64 #define ERST_SIZE 64
/* Initial number of event segment rings allocated */ /* Initial number of event segment rings allocated */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册