Skip to contentSkip to conversation

usb: xhci-mem: Fix scratchpad array issue

PATCH Superseded Ye Li 2 participants 2 messages Jan 4, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ye Li

author
#0 lore raw

PATCH 1/1 usb: xhci-mem: Fix scratchpad array issue

After updating the value of dev_context_ptrs[0], we should flush this from cache to memory. Otherwise the xhci controller won't use it.

---
 drivers/usb/host/xhci-mem.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-mem.c +2 -0
index 04ab540..0f34522 100644
@@ -369,6 +369,8 @@ static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl)
 	ctrl->dcbaa->dev_context_ptrs[0] =
 		cpu_to_le64((uintptr_t)scratchpad->sp_array);
 
+	xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[0], sizeof(__le64));
+
 	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
 	for (i = 0; i < 16; i++) {
 		if ((0x1 & page_size) != 0)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 usb: xhci-mem: Fix scratchpad array issue

Quoted 13 lines · Ye Li

After updating the value of dev_context_ptrs[0], we should flush this from cache to memory. Otherwise the xhci controller won't use it.

---
 drivers/usb/host/xhci-mem.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-mem.c +0 -0
index 04ab540..0f34522 100644

drivers/usb/host/xhci-mem.c static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl) · line 372

Quoted 4 lines
drivers/usb/host/xhci-mem.c +1 -0
@@ -369,6 +369,8 @@ static int xhci_scratchpad_alloc(struct xhci_ctrl *ctrl)
 	ctrl->dcbaa->dev_context_ptrs[0] =
 		cpu_to_le64((uintptr_t)scratchpad->sp_array);
 
+	xhci_flush_cache((uintptr_t)&ctrl->dcbaa->dev_context_ptrs[0], sizeof(__le64));

Don't you want to use some sizeof(ctrl->dcbaa->dev_context_ptrs[0]) instead of sizeof(__le64) here ?

btw Bin, A-B/R-B please.

Quoted 5 lines
drivers/usb/host/xhci-mem.c +1 -0
+
 	page_size = xhci_readl(&hcor->or_pagesize) & 0xffff;
 	for (i = 0; i < 16; i++) {
 		if ((0x1 & page_size) != 0)
Signature · 2 lines
Best regards,
Marek Vasut