diff mbox series

usb-xhci: Reset ERSTSZ together with ERSTBA

Message ID 20170911070909.41129-1-aik@ozlabs.ru
State Accepted
Headers show
Series usb-xhci: Reset ERSTSZ together with ERSTBA | expand

Commit Message

Alexey Kardashevskiy Sept. 11, 2017, 7:09 a.m. UTC
When shutting down the adapter, SLOF writes 0 to the Event Ring Segment
Table Base Address Register (ERSTBA) but does not reset the Event Ring
Segment Table Size Register (ERSTSZ) which makes QEMU do DMA access
at zero address which fails in unassigned_mem_accepts.

This resets ERSTSZ right before resetting ERSTBA so these 2 registers
can stay in sync.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 lib/libusb/usb-xhci.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c
index 9f8b276..3ce6c00 100644
--- a/lib/libusb/usb-xhci.c
+++ b/lib/libusb/usb-xhci.c
@@ -873,6 +873,7 @@  static bool xhci_hcd_init(struct xhci_hcd *xhcd)
 
 	return true;
 fail_erst_entries:
+	write_reg32(&irs->erstsz, 0);
 	write_reg64(&irs->erstba, 0);
 	mb();
 	SLOF_dma_map_out(xhcd->erst.dma, (void *)xhcd->erst.entries, XHCI_EVENT_TRBS_SIZE);
@@ -916,6 +917,7 @@  static bool xhci_hcd_exit(struct xhci_hcd *xhcd)
 	}
 
 	irs = &xhcd->run_regs->irs[0];
+	write_reg32(&irs->erstsz, 0);
 	write_reg64(&irs->erstba, 0);
 	mb();
 	if (xhcd->erst.entries) {