From patchwork Sat Jun 20 01:50:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 486955 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 8C10F140157 for ; Sat, 20 Jun 2015 11:53:37 +1000 (AEST) Received: from localhost ([::1]:60384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z67yR-00087R-Gv for incoming@patchwork.ozlabs.org; Fri, 19 Jun 2015 21:53:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z67w4-0003DK-Bv for qemu-devel@nongnu.org; Fri, 19 Jun 2015 21:51:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z67vz-0004Iw-By for qemu-devel@nongnu.org; Fri, 19 Jun 2015 21:51:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z67vw-0004H3-JZ; Fri, 19 Jun 2015 21:51:00 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 2AEF8C3011; Sat, 20 Jun 2015 01:51:00 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-29.bos.redhat.com [10.18.17.29]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5K1on34011200; Fri, 19 Jun 2015 21:50:59 -0400 From: John Snow To: qemu-block@nongnu.org Date: Fri, 19 Jun 2015 21:50:42 -0400 Message-Id: <1434765047-29333-12-git-send-email-jsnow@redhat.com> In-Reply-To: <1434765047-29333-1-git-send-email-jsnow@redhat.com> References: <1434765047-29333-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, John Snow , qemu-devel@nongnu.org, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 11/16] libqos/ahci: edit wait to be ncq aware 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 The wait command should check to make sure SACT is clear as well as the Command Issue register. Signed-off-by: John Snow --- tests/libqos/ahci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c index 9a4d510..da02e2e 100644 --- a/tests/libqos/ahci.c +++ b/tests/libqos/ahci.c @@ -908,11 +908,15 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand *cmd) /* We can't rely on STS_BSY until the command has started processing. * Therefore, we also use the Command Issue bit as indication of * a command in-flight. */ - while (BITSET(ahci_px_rreg(ahci, cmd->port, AHCI_PX_TFD), - AHCI_PX_TFD_STS_BSY) || - BITSET(ahci_px_rreg(ahci, cmd->port, AHCI_PX_CI), (1 << cmd->slot))) { + +#define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK))) + + while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) || + RSET(AHCI_PX_CI, 1 << cmd->slot) || + (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) { usleep(50); } + } void ahci_command_issue(AHCIQState *ahci, AHCICommand *cmd)