From patchwork Mon Sep 11 07:09:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 812231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xrJvM0BPBz9s8J for ; Mon, 11 Sep 2017 17:09:19 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xrJvL6Q68zDrnV for ; Mon, 11 Sep 2017 17:09:18 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=ozlabs.ru (client-ip=107.173.13.209; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Received: from ozlabs.ru (ozlabs.ru [107.173.13.209]) by lists.ozlabs.org (Postfix) with ESMTP id 3xrJvH3c2zzDrZl for ; Mon, 11 Sep 2017 17:09:14 +1000 (AEST) Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id D453B3A60001; Mon, 11 Sep 2017 03:10:24 -0400 (EDT) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Mon, 11 Sep 2017 17:09:09 +1000 Message-Id: <20170911070909.41129-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 Subject: [SLOF] [PATCH slof] usb-xhci: Reset ERSTSZ together with ERSTBA X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" 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 --- 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) {