Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1111918imm; Wed, 1 Aug 2018 10:22:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfAbg8+v31J+wYNF4MRnEYUYHDYjJ28s/0V9dlwxf3bO2DNbYd7pG+OWWUqUFqw5hbCoWD1 X-Received: by 2002:a63:3246:: with SMTP id y67-v6mr25053587pgy.399.1533144141361; Wed, 01 Aug 2018 10:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144141; cv=none; d=google.com; s=arc-20160816; b=myS+lfc0sGdv2oI2Cz45g0+r63tJFAOOvUMkUX4KSuk3ZQEaC5CwnaGG9tYAvssFKN yjWmABRWgNDqzFrgQ5gy/gRtJB9wGyFVfaHUkXNe3JZaVjJTflUWk54NOVue06n/M3QV cyoObgYuP9J8K01B0MIYYBc3OdXOI/iGKyFoxEck5PbLkMfgKTv1TAyqKHeTjS/f9rZW Ejbw0nuIh8EqBH29n7QEG9V+w9BijZMlJoMiZGBKG+UhjwqP0He0MlUVQJjVOvAqq+x5 XPhY8fhwy0BX8BJtDcd2WrUZmyeRXsoWmTjolB4fZx71WkPu6k1F7IxK/y+dN+ginuz8 V13g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=g1nTlS1Z1Rl3VRJGFcGDkDhvIugdNVrXCiP9h7ThJaU=; b=Ojm7G7oWNxmn54SKUnUDHjM/9keP9EFp4HtqNumfHC25zL7su4GupmMQMd9hRpshaJ z/mWp16SSv4g0U3AkTzwYsysAz06Oz4zlIleW76uhaEgUW+qOPD9Wnjq4CRU3BW/fUFw 9N3P2p2xUsD3Fyih3yAkOFxtnCMu81QY2/FlU1PXeBlaRdEODcYiSFRLRpJTXjbBnJMF 8iJk5K3+icnH4fI0Mlz2LbypifhkamQi/kz4FkpP4zbYEET1dMvUQZ4wRGsgrRpaH3pm ihwpv1UurVREwHR5+lK78lA+Zj5iYcNdWKVHPlC1c7BGUC0RCTM5LSAPQ+RfH+98WIbJ RJHg== 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 a1-v6si15973016pli.472.2018.08.01.10.22.06; Wed, 01 Aug 2018 10:22:21 -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 S2405286AbeHATGe (ORCPT + 99 others); Wed, 1 Aug 2018 15:06:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48756 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404595AbeHATGd (ORCPT ); Wed, 1 Aug 2018 15:06:33 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0CF38CC3; Wed, 1 Aug 2018 17:19:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiang Chen , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 163/246] scsi: hisi_sas: config ATA de-reset as an constrained command for v3 hw Date: Wed, 1 Aug 2018 18:51:13 +0200 Message-Id: <20180801165019.550563110@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiang Chen [ Upstream commit 9413532788df7470297dd0475995c5dc5b07f362 ] 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 Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -328,10 +328,11 @@ enum { #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) { @@ -1044,7 +1045,7 @@ static int prep_ata_v3_hw(struct hisi_hb << 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);