From patchwork Wed Dec 21 09:25:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangxingui X-Patchwork-Id: 35307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3426997wrn; Wed, 21 Dec 2022 01:34:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbqVEO55Z4Lu6+lu7lTU19t2tFdvHEZFLYkI31YwKao8QGLElXHniGG6g1cCp33UVYoOqN X-Received: by 2002:a17:907:7ea1:b0:7c4:f752:e95c with SMTP id qb33-20020a1709077ea100b007c4f752e95cmr964611ejc.1.1671615258050; Wed, 21 Dec 2022 01:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671615258; cv=none; d=google.com; s=arc-20160816; b=cLnvERwlnSkSl3VkjXOgZarmVCiWZsbiCfkHicTWJhDbqrOyA2q8pilF2Jm3Qyi9TX mYQldq9NOCEnMnLmwpK6kS8kgTt6na/LueTVB+P018/RytAI3C/Vht+m7tsYksuUkbaN hRiGSXfuStgpW46FLvtMICueRL4DY3WGJf0irgVJzcgwuMi6RX1NiQrPoA08mQBJypra DVyPY3+TKjA2/LUtVzlfqwsOS6StNhgs7qp9bcCdDQMUScMofQhLOGDzk9epzVzgrXSF 48qr5wy0nKJazoeSjmpxzKalbsMt54bAiQIWQemvdvdhUufhN6zC5rZJkoETzJB6Xzj/ JHKA== 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=C2FsJg2Q+kzgWMbBCDju5KSHLCNLD3gzCCK3M9wGv58=; b=bOhkZ2Khzcs7UFDIJ6oU7vgxJgEU+Frj1XawoinBVEX/dQp7K5N2EPOhGmEqWz435D np6tVeGPqH7Lmgrf/9ayfO7fvsWMk4WGoRvuvS6JMGhYLAyUU6Ok0GrFQeG88cSF5pi5 2GZ7SJ/i23iZ3S1Fm+oV/BzKQ50xFljCvyRCKkP1itSknSClFrF8ZIWKVFgBAWpNbwiX geiv7ZbJGj1s9DS+tXfW49FziQ9bXUvvvnfPMXR+ATInZa4hAEJZ1isk5WIuRQ3o/c2u JpfR3GgclQp3Rhd9NOcQ3rfD0anLBTIJD2Uwc92J3d53zcKDI77o5IQP1y2405Keucfw leIQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020aa7c385000000b0045782fcb80asi11693718edq.225.2022.12.21.01.33.54; Wed, 21 Dec 2022 01:34:18 -0800 (PST) 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 S234454AbiLUJcH (ORCPT + 99 others); Wed, 21 Dec 2022 04:32:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231614AbiLUJbx (ORCPT ); Wed, 21 Dec 2022 04:31:53 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C91E8FCC; Wed, 21 Dec 2022 01:31:49 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NcSq33Lm7zmWfc; Wed, 21 Dec 2022 17:30:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 17:31:47 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH v3 1/3] scsi: libsas: Add sas_device_task_abort() Date: Wed, 21 Dec 2022 09:25:12 +0000 Message-ID: <20221221092514.4091-2-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221221092514.4091-1-yangxingui@huawei.com> References: <20221221092514.4091-1-yangxingui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500012.china.huawei.com (7.185.36.89) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752815640613413171?= X-GMAIL-MSGID: =?utf-8?q?1752815640613413171?= Add support for abort all active IOs for device, and define a LLDD interface lldd_device_task_abort for LLDD to implement. Signed-off-by: Xingui Yang --- drivers/scsi/libsas/sas_scsi_host.c | 9 +++++++++ include/scsi/libsas.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index a36fa1c128a8..4ac7cffcbada 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -1230,6 +1230,15 @@ void sas_task_abort(struct sas_task *task) } EXPORT_SYMBOL_GPL(sas_task_abort); +void sas_device_task_abort(struct domain_device *dev) +{ + struct sas_internal *i = + to_sas_internal(dev->port->ha->core.shost->transportt); + if (i->dft->lldd_device_task_abort) + i->dft->lldd_device_task_abort(dev); +} +EXPORT_SYMBOL_GPL(sas_device_task_abort); + int sas_slave_alloc(struct scsi_device *sdev) { if (dev_is_sata(sdev_to_domain_dev(sdev)) && sdev->lun) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 1aee3d0ebbb2..1bf1cfb13912 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -678,6 +678,7 @@ struct sas_domain_function_template { int (*lldd_abort_task_set)(struct domain_device *, u8 *lun); int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); int (*lldd_I_T_nexus_reset)(struct domain_device *); + int (*lldd_device_task_abort)(struct domain_device *dev); int (*lldd_ata_check_ready)(struct domain_device *); void (*lldd_ata_set_dmamode)(struct domain_device *); int (*lldd_lu_reset)(struct domain_device *, u8 *lun); @@ -743,6 +744,7 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *); void sas_init_dev(struct domain_device *); void sas_task_abort(struct sas_task *); +void sas_device_task_abort(struct domain_device *dev); int sas_eh_abort_handler(struct scsi_cmnd *cmd); int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); int sas_eh_target_reset_handler(struct scsi_cmnd *cmd); From patchwork Wed Dec 21 09:25:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangxingui X-Patchwork-Id: 35309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3427017wrn; Wed, 21 Dec 2022 01:34:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtq/GufLgdMf+Efi0/isx5aUx4iqZ7C3D0QFS5Ht86yO2ol9MyXAx/SfxJZuXOl8IogAqO X-Received: by 2002:a17:902:cf01:b0:18b:3389:2caf with SMTP id i1-20020a170902cf0100b0018b33892cafmr18802842plg.59.1671615260911; Wed, 21 Dec 2022 01:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671615260; cv=none; d=google.com; s=arc-20160816; b=XKCINtFV6tpDtI0b5aH7JiV07eGQFYiEgbfSsZIgUK2UAlK5D9WhDZDtHz0TR5QtJe SlA92IkRb8eb5+oJFvqC15vjfHoOjwAUbFbirlMhvkgD1YmRmmuzg0vE6XRCpgx5OJq9 sL8w5wHBkReS95GfpXUa4yotBdnVpuwRxBGYDvSonT4ehLlMZchSm42m+B7FnCYwKTmx 9Vpkws4celQgh/wFUorEnoG8dXtkQ+wqy8xeG0WWO9ZqeoQcdNICiqsnf1qgki7K7mAG wB0GeASAOMJPVwywts7JIgqMFlO2aLs412o91aMyEAXD7jMpv6voNQaYF3sJz1v6LKqY ZFtQ== 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=fuLqpwVPzRWNFlVi2F3dBv8mv8fUqsHEYX5YRJtgCuc=; b=OzNpA6wXjk2y5ACyY23HoS1+lUeA8k1Qxw6BxYnyMlRb2pTDkajfHv7QuDeI7qTGyj ovh/qmbTA47CpF6LRGXEs6NBjbjlFYsN8YNEQTFGSBaJhE2oiAjBB1HHNNeVh3PXju/g 2IVZLkPDtCfw4YxXy+9QVw2PeVmKZivOiirxsbv4b93n2ypIUzmwN5ACy7GpuzeSsNCJ 5jUTkNo6+gwMcXbMwPZdosqRJ0eYsk0UG7vob52yl8wfTMd9SR2ssnU7sw/JTbH8K2aZ NW+udhOOLLiMKpi94wBolKpeYGFziwuc06QaKmh6MjC1vxGwASRdXdmUuq54t7/Vc5OE G5og== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a170902ba8700b001895608367csi2515932pls.535.2022.12.21.01.34.08; Wed, 21 Dec 2022 01:34:20 -0800 (PST) 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 S234580AbiLUJcS (ORCPT + 99 others); Wed, 21 Dec 2022 04:32:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234352AbiLUJby (ORCPT ); Wed, 21 Dec 2022 04:31:54 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CAAB205D8; Wed, 21 Dec 2022 01:31:49 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NcSlH0Bw9zqT7Z; Wed, 21 Dec 2022 17:27:23 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 17:31:47 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH v3 2/3] scsi: libsas: Directly kick-off EH when device removed with active IO Date: Wed, 21 Dec 2022 09:25:13 +0000 Message-ID: <20221221092514.4091-3-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221221092514.4091-1-yangxingui@huawei.com> References: <20221221092514.4091-1-yangxingui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500012.china.huawei.com (7.185.36.89) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752815643934580830?= X-GMAIL-MSGID: =?utf-8?q?1752815643934580830?= If the device is gone, call sas_device_task_abort() directly and abort active IO to kick-off EH Immediately. This avoids having to wait for block layer timeouts. Signed-off-by: Xingui Yang --- drivers/scsi/libsas/sas_discover.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index d5bc1314c341..ea5609f9967b 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -362,6 +362,9 @@ static void sas_destruct_ports(struct asd_sas_port *port) void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) { + if (test_bit(SAS_DEV_GONE, &dev->state)) + sas_device_task_abort(dev); + if (!test_bit(SAS_DEV_DESTROY, &dev->state) && !list_empty(&dev->disco_list_node)) { /* this rphy never saw sas_rphy_add */ From patchwork Wed Dec 21 09:25:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangxingui X-Patchwork-Id: 35308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3427009wrn; Wed, 21 Dec 2022 01:34:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6MWP9Dw5FgJoPXZUACDy0nFkWsDSgkyf4y6j98IspkAeeNu1w3sPvSPfbzihXpnUiR4RC X-Received: by 2002:a17:906:78c:b0:7ad:e52c:12e6 with SMTP id l12-20020a170906078c00b007ade52c12e6mr801740ejc.41.1671615260039; Wed, 21 Dec 2022 01:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671615260; cv=none; d=google.com; s=arc-20160816; b=lq+5osqaF7X7/H1g9kirW/cu3iuWYwxFiiudwlBzt66gXwuGgRYaftS1oX0G/5KfBo RaibfVHvEFPUmthY4LBn9lzxjnifxENXNwgSkWs0eLSbthoKojEATP6MWPwO1++5I/5C pTJhCxXmBMTCpXndzcAmQAct0YhpJHZumwx4h/v72PvmXFN1S5290+cMKAnr6ltKNieP 6yHu1isb7wklMRpbyA1zIiurYOSI23qqv9i3qgwP3FovU5MnOhRhtB1wJ62uOS3907EY r43FA5fE7HZtXiTfgT9trelLc+1MRfdfR7lY8hbwbS+2WsNzAXxInwXt/SWZrNllxAhG VFOQ== 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=rQJvTn0QeKvsNaF1/VPJHARisGQm5g1tYeL17YtUbIc=; b=SRZ8g9kuXeEhMwdRWLI3YAHpCTLCJYF4QGwjJBjNRpPhEtNliBzlhZtmMAvsC0a/6F Gxljwj+usHu9N6y/viA8x5vX0MPCHFr8us1PUXmwlmmHaYYaGIyE3pBNNJ6g3+FjZuUC iHdbj3tGE0em5GQrQ4lRo2f4uIg4mZrsJfbmkDeAaqZI1LVc6T9xOAhQ8YFbkc+Q0Q11 t04e6XciqK6ntKzctOPf3RprSHszP1V0BJt/kTCWtnzea90jcjhPglgEE/3R83uCMl4U rIiXuyUKBF9q5S5aL/TRGQ4M5jEt/kki0us15sifGK5/hyr5elIyFDxHFCplVJcbJgso YAmA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a1709065d0b00b007c08fa910a4si3058452ejt.557.2022.12.21.01.33.57; Wed, 21 Dec 2022 01:34:20 -0800 (PST) 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 S234511AbiLUJcN (ORCPT + 99 others); Wed, 21 Dec 2022 04:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbiLUJbx (ORCPT ); Wed, 21 Dec 2022 04:31:53 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C9F2205D7; Wed, 21 Dec 2022 01:31:49 -0800 (PST) Received: from dggpemm500012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NcSq35yNJzmWZ8; Wed, 21 Dec 2022 17:30:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpemm500012.china.huawei.com (7.185.36.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 17:31:47 +0800 From: Xingui Yang To: , , CC: , , , , , Subject: [PATCH v3 3/3] scsi: hisi_sas: Implement lldd_device_task_abort() Date: Wed, 21 Dec 2022 09:25:14 +0000 Message-ID: <20221221092514.4091-4-yangxingui@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221221092514.4091-1-yangxingui@huawei.com> References: <20221221092514.4091-1-yangxingui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500012.china.huawei.com (7.185.36.89) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752815642684988322?= X-GMAIL-MSGID: =?utf-8?q?1752815642684988322?= Implement lldd_device_task_abort() to abort active io for device. Signed-off-by: Xingui Yang --- drivers/scsi/hisi_sas/hisi_sas_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 41ba22f6c7f0..647479e54b62 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1839,6 +1839,24 @@ static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha) return TMF_RESP_FUNC_COMPLETE; } +static int hisi_sas_device_task_abort(struct domain_device *dev) +{ + struct hisi_sas_device *sas_dev = dev->lldd_dev; + struct hisi_sas_slot *slot, *slot2; + struct sas_task *task; + + spin_lock(&sas_dev->lock); + list_for_each_entry_safe(slot, slot2, &sas_dev->list, entry) { + task = slot->task; + if (unlikely(!task || !task->lldd_task || !task->dev)) + continue; + sas_task_abort(task); + } + spin_unlock(&sas_dev->lock); + + return 0; +} + static int hisi_sas_query_task(struct sas_task *task) { int rc = TMF_RESP_FUNC_FAILED; @@ -2029,6 +2047,7 @@ static struct sas_domain_function_template hisi_sas_transport_ops = { .lldd_abort_task_set = hisi_sas_abort_task_set, .lldd_I_T_nexus_reset = hisi_sas_I_T_nexus_reset, .lldd_lu_reset = hisi_sas_lu_reset, + .lldd_device_task_abort = hisi_sas_device_task_abort, .lldd_query_task = hisi_sas_query_task, .lldd_clear_nexus_ha = hisi_sas_clear_nexus_ha, .lldd_port_formed = hisi_sas_port_formed,