From patchwork Sun Sep 20 20:53:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 520048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 264F0140180 for ; Mon, 21 Sep 2015 06:54:04 +1000 (AEST) Received: from localhost ([::1]:53640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdlcY-0005op-BS for incoming@patchwork.ozlabs.org; Sun, 20 Sep 2015 16:54:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zdlbx-0004iu-LC for qemu-devel@nongnu.org; Sun, 20 Sep 2015 16:53:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zdlbs-0008U1-HX for qemu-devel@nongnu.org; Sun, 20 Sep 2015 16:53:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:37799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zdlbs-0008TL-7z; Sun, 20 Sep 2015 16:53:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 226A4ADD4; Sun, 20 Sep 2015 20:53:19 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Sun, 20 Sep 2015 22:53:13 +0200 Message-Id: <1442782398-41762-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1442782398-41762-1-git-send-email-agraf@suse.de> References: <1442782398-41762-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Peter Maydell , Mark Cave-Ayland , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 2/7] mac_dbdma: always clear FLUSH bit once DBDMA channel flush is complete 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 From: Mark Cave-Ayland The code to flush the DBDMA channel was effectively duplicated in dbdma_control_write(), except for the fact that the copy executed outside of a RUN bit transition was broken by not clearing the FLUSH bit once the flush was complete. Newer PPC Linux kernels would timeout waiting for the FLUSH bit to clear again after submitting a FLUSH command. Fix this by always clearing the FLUSH bit once the channel flush is complete and removing the repeated code. Reported-by: Aurelien Jarno Signed-off-by: Mark Cave-Ayland Reviewed-by: Aurelien Jarno Signed-off-by: Alexander Graf --- hw/misc/macio/mac_dbdma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index b25e851..779683c 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -590,10 +590,11 @@ dbdma_control_write(DBDMA_channel *ch) if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) { /* RUN is cleared */ status &= ~(ACTIVE|DEAD); - if ((status & FLUSH) && ch->flush) { - ch->flush(&ch->io); - status &= ~FLUSH; - } + } + + if ((status & FLUSH) && ch->flush) { + ch->flush(&ch->io); + status &= ~FLUSH; } DBDMA_DPRINTF(" status 0x%08x\n", status); @@ -603,9 +604,6 @@ dbdma_control_write(DBDMA_channel *ch) if (status & ACTIVE) { DBDMA_kick(dbdma_from_ch(ch)); } - if ((status & FLUSH) && ch->flush) { - ch->flush(&ch->io); - } } static void dbdma_write(void *opaque, hwaddr addr,