From patchwork Wed May 2 15:56:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 134846 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp847499lji; Wed, 2 May 2018 08:58:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqUoy60ShSgMKYSl+mffE4OUE5qk+RJ59XrSv3mfAgewuZwOZSfBu5fhVYqzAk62JvS1NJo X-Received: by 2002:a63:642:: with SMTP id 63-v6mr16500885pgg.10.1525276733752; Wed, 02 May 2018 08:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525276733; cv=none; d=google.com; s=arc-20160816; b=Ffw/ywAcg2bFBGOkMsUEKsSIWHnExMIB+tBVqeWCfzPdtsw1vDKueEeBnGP1FnUR9L 123XaALAgvY4gQRAp6V1tUXakoCjPTltaS4TOoorUG4rsSdvlJ0/KhkPONAzqySQMaC6 /1vqsjs5+Rawxib5xcs3yZ6UO3GMVjXmxyk04yg+T0vetW6RXDjQ2AH8/smyxAH5ygmC 4hqei+riVeNC9PbLEkXQuTcmRPm04xjGCy3s8zShzx21y1PGmMX0aJYWFAd4U8jR0otT gOkJYZriN26UU3nFNqukX7xKMWODNaYCs8/SMfpDCfGZW3KWMsk+SqbcM/e8Qzt7W1qr MCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=EB6sEDlYsBd3cWVrey/b9j5DLUmnxEqFwRhqX1BMtgY=; b=qXRLmQYzfMe7nh2vKu+TNAtZAQyzMlD2ewdEZAZ3ARE7iQElrKz2tfm/vS8ffk0EuR JS6kAhQ+PqgykldHG89A6wNk852wSOrEuU+0YucKh2GJ4YAlP98uIXgQYOYQRn8IlcSJ 1lZnK4mSVKO2jv1zPkhzojrwSPwz21+LPO5moLBtHRV/T1ihaHEzPjLedcpZB8+KXmNl VWXK1XTsG66HTErvd67T2QStx1F4C/48DUiJ1CDMN+fpfoOOV7opoH35pCgNuBFrYOvB Uh++JAX4r9tFQEbcOdeT0EI+a1PZfht86UlT4NcGssNoZvrBpTi47ykghxX3DQLY32Zy +ksw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1-v6si11629610pld.168.2018.05.02.08.58.53; Wed, 02 May 2018 08:58:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752252AbeEBP6u (ORCPT + 29 others); Wed, 2 May 2018 11:58:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:54543 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751704AbeEBP53 (ORCPT ); Wed, 2 May 2018 11:57:29 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DF28DC59AF84D; Wed, 2 May 2018 23:57:23 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Wed, 2 May 2018 23:57:18 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 08/11] scsi: hisi_sas: config ATA de-reset as an constrained command for v3 hw Date: Wed, 2 May 2018 23:56:31 +0800 Message-ID: <1525276594-92173-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525276594-92173-1-git-send-email-john.garry@huawei.com> References: <1525276594-92173-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen As a unconstrained command, a command can be sent to SATA disk even if SATA disk status is BUSY, ERR or DRQ. If an ATA reset assert is successful but ATA reset de-assert fails, then it will retry the reset de-assert. If reset de- assert retry is successful, we think it is okay to probe the device but actually it still has Err status. Apparently we need to retry the ATA reset assertion and de- assertion instead for this mentioned scenario. As such, we config ATA reset assert as a constrained command, if ATA reset de-assert fails, then ATA reset de-assert retry will also fail. Then we will retry the proper process of ATA reset assert and de-assert again. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index ffa3cea..026faee 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -351,10 +351,11 @@ struct hisi_sas_err_record_v3 { #define DIR_TO_DEVICE 2 #define DIR_RESERVED 3 -#define CMD_IS_UNCONSTRAINT(cmd) \ - ((cmd == ATA_CMD_READ_LOG_EXT) || \ - (cmd == ATA_CMD_READ_LOG_DMA_EXT) || \ - (cmd == ATA_CMD_DEV_RESET)) +#define FIS_CMD_IS_UNCONSTRAINED(fis) \ + ((fis.command == ATA_CMD_READ_LOG_EXT) || \ + (fis.command == ATA_CMD_READ_LOG_DMA_EXT) || \ + ((fis.command == ATA_CMD_DEV_RESET) && \ + ((fis.control & ATA_SRST) != 0))) static u32 hisi_sas_read32(struct hisi_hba *hisi_hba, u32 off) { @@ -1075,7 +1076,7 @@ static int prep_ata_v3_hw(struct hisi_hba *hisi_hba, << CMD_HDR_FRAME_TYPE_OFF; dw1 |= sas_dev->device_id << CMD_HDR_DEV_ID_OFF; - if (CMD_IS_UNCONSTRAINT(task->ata_task.fis.command)) + if (FIS_CMD_IS_UNCONSTRAINED(task->ata_task.fis)) dw1 |= 1 << CMD_HDR_UNCON_CMD_OFF; hdr->dw1 = cpu_to_le32(dw1);