Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4560794rwb; Tue, 6 Sep 2022 09:09:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7wIuTpJsnNNACKqQo8nJTPmiVgRAeacSM9SAxa2UCliH/N3JnLhTI8zQsDuxXo20eTv+QA X-Received: by 2002:aa7:da9a:0:b0:44e:9774:c2ab with SMTP id q26-20020aa7da9a000000b0044e9774c2abmr7512027eds.10.1662480558527; Tue, 06 Sep 2022 09:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662480558; cv=none; d=google.com; s=arc-20160816; b=schX47oLcd1xgT5pIDZ9DfN7gjNMMI78HFrEJ9qrwyNpbQlvo4XSwQxKNdn/N/HOC9 +kwMb7h9z7JbKUmOLpK0+MkooXsukmrCpAXwvYkXahJ0bkLRTwi2F79hQLYMz7KoMR6r yld6/yy9nb1OKfO+PnIbi0dBHiI5mA8fHsd9aN3sgiKNVckBPBHzjTbSSK5ymqs6V+UN r7MwD1VVuvv8Af6dkD0OUpx7b0fpxUgRbOYxag5oqkgU7vrektFZxmA/5KvQ/wrQ2JBa rnnu71ur8zfRzon0+bpYehNwUlPuDb4ys8SPePk1WYbQU/Nr2zxv24q8PvbdXCeloBTY j+jg== 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=siiRHncLebz+xQpZzg+k3BHGqH4MDT/EpCERg24MRWg=; b=NIFGbfmuCz7Rkz07Teglt0SRoGbdvNioHNrXlbn/pHseN/R/HLWNhu7or8lXCYAqQP AJUxUWh2ZamwqGMqCkc2yK322WGHtYSzDIImllNslLytA8RYNFJFi9Aq/+SruFeWFdEf Bg5NPA1YdSBNg0sgf6B23SkPowtmZzosJKw/Vch7e4xiecpUXHrJ+qhGP8meycCl5ZfG 5kLRCjFRLPDA/OVu2pJRyIChDB0sjcOnEdx7g++tHrgh8K4YP/Y44NQeeXP2jBrwLzFp Re9m+46Kddd1pduJ5zakH6E3ztHci+iScx7MO1b1xOVSnA2jifIg9pYebW0JfGKWqUTi J/TA== 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 nb37-20020a1709071ca500b007387740b9c2si11532275ejc.2.2022.09.06.09.08.53; Tue, 06 Sep 2022 09:09:18 -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 S233368AbiIFP5q (ORCPT + 99 others); Tue, 6 Sep 2022 11:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238522AbiIFPzo (ORCPT ); Tue, 6 Sep 2022 11:55:44 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C74A81E3E0; Tue, 6 Sep 2022 08:14:53 -0700 (PDT) Received: from fraeml715-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MMTSK1Z7Wz67xfT; Tue, 6 Sep 2022 23:14:09 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml715-chm.china.huawei.com (10.206.15.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 17:14:51 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 16:14:48 +0100 From: John Garry To: , , , CC: , , , , , John Garry Subject: [PATCH v3 5/6] scsi: hisi_sas: Add SATA_DISK_ERR bit handling for v3 hw Date: Tue, 6 Sep 2022 23:08:09 +0800 Message-ID: <1662476890-15467-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662476890-15467-1-git-send-email-john.garry@huawei.com> References: <1662476890-15467-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: dggems701-chm.china.huawei.com (10.3.19.178) To lhrpeml500003.china.huawei.com (7.191.162.67) 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,T_SCC_BODY_TEXT_LINE 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_device_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 efe8c5be5870..a469712ed447 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) @@ -2384,14 +2386,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_device_link_abort(device, true); + } 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