[SLOF] [PATCH slof] usb-xhci: Reset ERSTSZ together with ERSTBA

Alexey Kardashevskiy aik at ozlabs.ru
Mon Sep 11 17:09:09 AEST 2017


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 at ozlabs.ru>
---
 lib/libusb/usb-xhci.c | 2 ++
 1 file changed, 2 insertions(+)

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) {
-- 
2.11.0



More information about the SLOF mailing list