From patchwork Wed Aug 15 04:33:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 177538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F36952C008D for ; Wed, 15 Aug 2012 14:34:28 +1000 (EST) Received: from localhost ([::1]:56581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1VJK-0006oT-Q5 for incoming@patchwork.ozlabs.org; Wed, 15 Aug 2012 00:34:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1VJ1-0006ik-HR for qemu-devel@nongnu.org; Wed, 15 Aug 2012 00:34:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1VJ0-0008PE-BU for qemu-devel@nongnu.org; Wed, 15 Aug 2012 00:34:07 -0400 Received: from ozlabs.org ([203.10.76.45]:59025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1VJ0-0008Ou-04; Wed, 15 Aug 2012 00:34:06 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id B989D2C009D; Wed, 15 Aug 2012 14:34:00 +1000 (EST) From: David Gibson To: agraf@suse.de Date: Wed, 15 Aug 2012 14:33:47 +1000 Message-Id: <1345005228-4380-7-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1345005228-4380-1-git-send-email-david@gibson.dropbear.id.au> References: <1345005228-4380-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, paulus@samba.org, David Gibson Subject: [Qemu-devel] [PATCH 6/7] pseries: Clear TCE state when resetting PAPR VIO devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When we reset the system, the reset method for VIO bus devices resets the state of their request queue (if present) as it should. However it was not resetting the state of their TCE table (DMA translation) if present. This patch corrects that bug, and also removes some small code duplication in the reset paths. Signed-off-by: David Gibson --- hw/spapr_vio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 7ca4452..298e239 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -324,9 +324,7 @@ static void spapr_vio_quiesce_one(VIOsPAPRDevice *dev) } dev->dma = spapr_tce_new_dma_context(liobn, pc->rtce_window_size); - dev->crq.qladdr = 0; - dev->crq.qsize = 0; - dev->crq.qnext = 0; + free_crq(dev); } static void rtas_set_tce_bypass(sPAPREnvironment *spapr, uint32_t token, @@ -409,9 +407,8 @@ static void spapr_vio_busdev_reset(DeviceState *qdev) VIOsPAPRDevice *dev = DO_UPCAST(VIOsPAPRDevice, qdev, qdev); VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev); - if (dev->crq.qsize) { - free_crq(dev); - } + /* Shut down the request queue and TCEs if necessary */ + spapr_vio_quiesce_one(dev); if (pc->reset) { pc->reset(dev);