Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp545039imi; Fri, 22 Jul 2022 04:42:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tCQSExqCdpnAli5tAkvRtpqVWcYaHlsex7JCKwSYNDYlz6jCfao/DkCXlzs7RHL+5R8OLQ X-Received: by 2002:a17:90b:3b45:b0:1f0:2523:a1cf with SMTP id ot5-20020a17090b3b4500b001f02523a1cfmr17084924pjb.231.1658490153903; Fri, 22 Jul 2022 04:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658490153; cv=none; d=google.com; s=arc-20160816; b=msqnSiCkKQ8bNBOZSxzi1dy25+zCIRBUrNSYo+LzcUJfOspdl3bIel32z9Wui9bmEz py3LZoZAu2h+6pkCRjLrqzJwotX/47Hcd9rupDkLMTBeQ8+9XXXlPYc43npxP52uFYeL YE8I2TAJnk22EIP+2TKH/Tb4MSOnyS9TApFJFFrtXm0+d3D6lRQOEgWQsQMSZoZUT1wh GSoTouJRWjoES22C2g1IW8jugv6C6ARSmg35iRdW+5KjKqGsbVIvlsRmLzhiJ7zBRVBd 8gcPnIxp72yyXPOkJzq84oQnPCH0MxaQPKMi328KO2/QpHGkk04Wj6UWjhHYhTCzTDg2 E/PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=b8kbCsSkW0OscWVQ3lU7uT9Yq9nGmaiHwI9py4ime7s=; b=QeTGkBgNxCfgW+VIJl3gT9qUCwN3EAlNI+fPj67+qUFeC9QJ2wSRrMYrV9kD3h/u8w Ry58qN4Y2ZewI9RTJKp9P/J6iL6Fxh4s480WTh3HC5uTQW6h84fuV0dJQIiJg1nzPNz0 Heazljg/DzEL4vmoi28lG/p94abr2xuAOY8BS0A5h1T8rDQIUwU5jIZW1UmBhHUqAci2 Egt2aoCHjhYq/MM5FbT/WKW5agj5HiwDcUNIEejjeR/1U9e50j/Xc3L/01We27vLqaTx n2IedkmMSiFyvpJUTVWQ2eQdNtzxgH8X/XupDgZSuqRYuUzWi4M1cCWvk2jDK+KDyh3H a2pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot13-20020a17090b3b4d00b001f21a6fd050si11141999pjb.39.2022.07.22.04.42.19; Fri, 22 Jul 2022 04:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235031AbiGVLbD (ORCPT + 99 others); Fri, 22 Jul 2022 07:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiGVLaq (ORCPT ); Fri, 22 Jul 2022 07:30:46 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 872B577A71; Fri, 22 Jul 2022 04:30:42 -0700 (PDT) Received: from fraeml742-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Lq6bb6NhCz67NZt; Fri, 22 Jul 2022 19:27:07 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml742-chm.china.huawei.com (10.206.15.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 22 Jul 2022 13:30:39 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 22 Jul 2022 12:30:36 +0100 From: John Garry To: , , , , , , CC: , , John Garry Subject: [PATCH 5/6] scsi: hisi_sas: Add SATA_DISK_ERR bit handling for v3 hw Date: Fri, 22 Jul 2022 19:24:08 +0800 Message-ID: <1658489049-232850-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1658489049-232850-1-git-send-email-john.garry@huawei.com> References: <1658489049-232850-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xingui Yang When CQ header dw3 SATA_DISK_ERR is set it means this SATA disk is in error state and the current IPTT is invalid. An invalid IPTT does not correspond to any slot. In this scenario, new I/Os that delivered to disk will be rejected by the, controller and all I/Os remained on the disk should be aborted, which we add here with the sas_ata_link_abort() call. Signed-off-by: Xingui Yang Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index eb86afb21aab..7be3ea23f170 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -423,6 +423,8 @@ #define CMPLT_HDR_DEV_ID_OFF 16 #define CMPLT_HDR_DEV_ID_MSK (0xffff << CMPLT_HDR_DEV_ID_OFF) /* dw3 */ +#define CMPLT_HDR_SATA_DISK_ERR_OFF 16 +#define CMPLT_HDR_SATA_DISK_ERR_MSK (0x1 << CMPLT_HDR_SATA_DISK_ERR_OFF) #define CMPLT_HDR_IO_IN_TARGET_OFF 17 #define CMPLT_HDR_IO_IN_TARGET_MSK (0x1 << CMPLT_HDR_IO_IN_TARGET_OFF) @@ -2379,14 +2381,30 @@ static irqreturn_t cq_thread_v3_hw(int irq_no, void *p) while (rd_point != wr_point) { struct hisi_sas_complete_v3_hdr *complete_hdr; struct device *dev = hisi_hba->dev; - u32 dw1; + u32 dw0, dw1, dw3; int iptt; complete_hdr = &complete_queue[rd_point]; + dw0 = le32_to_cpu(complete_hdr->dw0); dw1 = le32_to_cpu(complete_hdr->dw1); + dw3 = le32_to_cpu(complete_hdr->dw3); iptt = dw1 & CMPLT_HDR_IPTT_MSK; - if (likely(iptt < HISI_SAS_COMMAND_ENTRIES_V3_HW)) { + if (unlikely((dw0 & CMPLT_HDR_CMPLT_MSK) == 0x3) && + (dw3 & CMPLT_HDR_SATA_DISK_ERR_MSK)) { + int device_id = (dw1 & CMPLT_HDR_DEV_ID_MSK) >> + CMPLT_HDR_DEV_ID_OFF; + struct hisi_sas_itct *itct = + &hisi_hba->itct[device_id]; + struct hisi_sas_device *sas_dev = + &hisi_hba->devices[device_id]; + struct domain_device *device = sas_dev->sas_device; + + dev_err(dev, "erroneous completion disk err dev id=%d sas_addr=0x%llx CQ hdr: 0x%x 0x%x 0x%x 0x%x\n", + device_id, itct->sas_addr, dw0, dw1, + complete_hdr->act, dw3); + sas_ata_link_abort(device); + } else if (likely(iptt < HISI_SAS_COMMAND_ENTRIES_V3_HW)) { slot = &hisi_hba->slot_info[iptt]; slot->cmplt_queue_slot = rd_point; slot->cmplt_queue = queue; -- 2.35.3