Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1941497ima; Thu, 25 Oct 2018 07:20:08 -0700 (PDT) X-Google-Smtp-Source: AJdET5ehDSzEEmXyVpnl9WwuIegaT2uDG4Yx4bPPgxXugmTOMq9Or7fZE9+BbeNZaIlZlr6j345e X-Received: by 2002:a17:902:b58c:: with SMTP id a12-v6mr1677155pls.226.1540477208737; Thu, 25 Oct 2018 07:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477208; cv=none; d=google.com; s=arc-20160816; b=kBpA3ARb8xSgkvq7V/tuw1Kg0dZDELf1cULqu/XvGwZV+du1+cjs0uvcT0QDFoQQGn mqdvRXsx1lt5U4t5ZPp3EquexDxdc92B2cDj+2c66M3IiPCrgomO87jirH53Lq4DiYtd qvGxKoZ0ozAXF1CIeic4iVrv4tAPYz8uELvRyZVp5R6jc8sSTg3vvb281nLg2c0zWr6/ slHUSzQaJO9zLUb64iYhUYXDOiv5RNyguBertMrI0XJf29/qYCWCd7bG6mELafC4ou0w DSlRDVsgybWi9fxHtJGkN8G4b8310MIQKgkdvFYfv0atz5jqiETccIHRvTtE4aBgT3PX dY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=meAjfzDca9y521f2shMVNcLnrDDic+HgnnfGEkrzSQ4=; b=IQeBNHSmsk3j6vfFrvCsVlwli3AW9RJ3Ap5rdR07TlrdzbUa8VjdnhGceSRrRPdwp0 wNtvdPHn3M/pLoUhMv1OOdaiXDHV1c+/D+UoeFIHeAsLzryOUO40utfJGIbakOcuwxad u40tAvBohwkulzW3H9G2zjVA+Blv2kNh6gFwvWJWVYprwwa3INvKvCTVM9wFdOqiA1cz GUVZVQ9wyondJ4iI7CHCGvu8OKLTSjWhbiyBACUuhtfZqIy/hUgxoOAC5DIT+mhSjJLB Oc7pGclnk32gvPIV3CKJ0EgplQlJ2MM075wAdHAaaxqob2h5Cr4+kwlLBIvWvdiCl0W6 ytnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VUIMCljK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si8292081pgg.530.2018.10.25.07.19.41; Thu, 25 Oct 2018 07:20:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VUIMCljK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730406AbeJYWwN (ORCPT + 99 others); Thu, 25 Oct 2018 18:52:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:34092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727716AbeJYWwK (ORCPT ); Thu, 25 Oct 2018 18:52:10 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B32EF20834; Thu, 25 Oct 2018 14:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477152; bh=FWABHLHHRkZeqCr26W1zkfxud6/AlP/YdrEaEFFjyy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUIMCljK/j0kD38iQH4MtqgbqY1SIWS7k01egVMXYPMVNIZAmA5+Wq3WRNU1JchEN ybyz9woN4g9yZ7dhWkknv8GNuJCc28zIOScnUH29KDrAl7Ta1jQreZYJOww/O4Qf7U I5R9iCUjeoIWXbKcgQHF3PdLNKxvFubKJ5NlGKWs= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Suman Tripathi , Tejun Heo , Sasha Levin Subject: [PATCH AUTOSEL 3.18 10/98] ahci_xgene: Fix the DMA state machine lockup for the ATA_CMD_PACKET PIO mode command. Date: Thu, 25 Oct 2018 10:17:25 -0400 Message-Id: <20181025141853.214051-10-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Tripathi [ Upstream commit 1102407bb714dcebb43f385335bcb72f6b8843bc ] This patch addresses the issue with ATA_CMD_PACKET pio mode command for enumeration and device detection with ATAPI devices. The X-Gene AHCI controller has an errata in which it cannot clear the BSY bit after the PIO setup FIS. The dma state machine enters CMFatalErrorUpdate state and locks up. Signed-off-by: Suman Tripathi Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- drivers/ata/ahci_xgene.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 0ffd3c930bed..d33216155827 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -125,10 +125,11 @@ static int xgene_ahci_restart_engine(struct ata_port *ap) * xgene_ahci_qc_issue - Issue commands to the device * @qc: Command to issue * - * Due to Hardware errata for IDENTIFY DEVICE command, the controller cannot - * clear the BSY bit after receiving the PIO setup FIS. This results in the dma - * state machine goes into the CMFatalErrorUpdate state and locks up. By - * restarting the dma engine, it removes the controller out of lock up state. + * Due to Hardware errata for IDENTIFY DEVICE command and PACKET + * command of ATAPI protocol set, the controller cannot clear the BSY bit + * after receiving the PIO setup FIS. This results in the DMA state machine + * going into the CMFatalErrorUpdate state and locks up. By restarting the + * DMA engine, it removes the controller out of lock up state. */ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) { @@ -137,7 +138,8 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) struct xgene_ahci_context *ctx = hpriv->plat_data; int rc = 0; - if (unlikely(ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA)) + if (unlikely((ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA) || + (ctx->last_cmd[ap->port_no] == ATA_CMD_PACKET))) xgene_ahci_restart_engine(ap); rc = ahci_qc_issue(qc); -- 2.17.1