From patchwork Mon Sep 13 07:55:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 12488107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2704FC433F5 for ; Mon, 13 Sep 2021 08:12:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FA1260D42 for ; Mon, 13 Sep 2021 08:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237947AbhIMINO (ORCPT ); Mon, 13 Sep 2021 04:13:14 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:44521 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235824AbhIMINM (ORCPT ); Mon, 13 Sep 2021 04:13:12 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210913081155epoutp042776bbb245e146b4c573aa98674dc2b5~kU3JMUrrh2102621026epoutp04Y for ; Mon, 13 Sep 2021 08:11:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210913081155epoutp042776bbb245e146b4c573aa98674dc2b5~kU3JMUrrh2102621026epoutp04Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1631520715; bh=qkn/feqQnJexSTxjhu5p2rZcvkOa0ceuyo47ocuUOgE=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=TgXhqE6D2aTi9XkWiexdeti6SkMavqFHP8TJjj4MaafDkA+gP5EKZ66cUJrcFeCa1 T2m4pf+vFhjzud2oGF1SQgwhYZK61GAHztnXEUELKnHlxPbzerb8SVcUiNI+nmNMhA 53yFpKIqVatb1Jh5F82ITOL3xZWNev0FVZRyS07k= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210913081154epcas2p3f934a781ed0a6c2720e5ebf0e1bf6478~kU3IZxgWt0226702267epcas2p31; Mon, 13 Sep 2021 08:11:54 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.187]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4H7K2H5HRjz4x9QQ; Mon, 13 Sep 2021 08:11:51 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 8C.AC.09472.6C70F316; Mon, 13 Sep 2021 17:11:50 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20210913081150epcas2p11f98eed5939bf082981e2a4d6fd9a059~kU3EMZ-h_0432704327epcas2p1M; Mon, 13 Sep 2021 08:11:50 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210913081150epsmtrp1966de2a11b7ace4b037f942849b1c8dc~kU3ELh4ON1350813508epsmtrp1d; Mon, 13 Sep 2021 08:11:50 +0000 (GMT) X-AuditID: b6c32a48-d75ff70000002500-f7-613f07c64b01 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AA.DD.09091.5C70F316; Mon, 13 Sep 2021 17:11:49 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210913081149epsmtip13f1635850f653b72f57518d395b1b1ed~kU3D8Mdst0411604116epsmtip1v; Mon, 13 Sep 2021 08:11:49 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, cang@codeaurora.org, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, bhoon95.kim@samsung.com Cc: Kiwoong Kim Subject: [PATCH v2 1/3] scsi: ufs: introduce vendor isr Date: Mon, 13 Sep 2021 16:55:53 +0900 Message-Id: <6801341a6c4d533597050eb1aaa5bf18214fc47f.1631519695.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDJsWRmVeSWpSXmKPExsWy7bCmue4xdvtEgz9/pCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWLxdekzVotP65exWqxe/IDFYtGNbUwWN7ccZbG4vGsOm0X39R1sFsuP/2Oy 6Lp7g9Fi6b+3LA58Hpf7epk8Fu95yeQxYdEBRo/v6zvYPD4+vcXi0bdlFaPH501yHu0HupkC OKJybDJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTdMnOADldS KEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFBgaFugVJ+YWl+al6yXn51oZGhgYmQJV JuRkHHtwnr1guUDFkePvmRoYL/J2MXJySAiYSDyePoGxi5GLQ0hgB6PE3JUTWCGcT4wSN391 skE43xglZk2axgbTsnn1H6iWv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C OKK4bFJSczLLUov07RK4Mo49OM9esFyg4sjx90wNjBd5uxg5OSQETCQ2r/7D2MXIxSEksJtR 4tHBlywQCUmJEzufM0LYwhL3W46wQhR9Y5TYeecfM0iCTUBT4unNqUwgCRGBc0wSUy8vZQJJ MAuoS+yacALMFhYwl3j5sBPMZhFQldiz8ToriM0rEC0x7dZqVogNchI3z3WCDeUUsJS4/xei V0jAQqJ/8yZGXOITGAUWMDKsYpRMLSjOTc8tNiwwzEst1ytOzC0uzUvXS87P3cQIjgYtzR2M 21d90DvEyMTBeIhRgoNZSYR32xvbRCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8F7pOxgsJpCeW pGanphakFsFkmTg4pRqYLh16/OdPQjGvQMC3zWIP16+90xZTVrzDI83kv1OLtYCsdc3svP9p fQdO2/6LNud9d/1Mw8SpFd7BCiUCXxttLRjSmYKf3fijxlY+20DvyAf27affFFxaoP6Id4e3 wkr7n2viC//7n/H//v6O36YHQfqxU+4rvDvn94/fKdzBqUoyp+hF9/dJm199Vv53238Vqy2j LEfNusyZxc/qZ6wMCss1aH/MxLi01XeWRLP3+g5p0RL7Vy/DkxgfCHYb5x5junXygdLMpYUh Z5X4a7I0FG4unXLudqSwYOV7/pStqccX7djx53/bFcuOnUYmDHO32/3/JFMWrMf2t2Lh8jjv Zd7SSy8u+xnx7t9sLf9aJZbijERDLeai4kQACO/QrfUCAAA= X-CMS-MailID: 20210913081150epcas2p11f98eed5939bf082981e2a4d6fd9a059 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210913081150epcas2p11f98eed5939bf082981e2a4d6fd9a059 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch is to activate some interrupt sources that aren't defined in UFSHCI specifications. Those purpose could be error handling, workaround or whatever. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/ufshcd.c | 14 +++++++++++++- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3841ab49..604c505 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -218,6 +218,13 @@ static struct ufs_dev_fix ufs_fixups[] = { END_FIX }; +static inline irqreturn_t +ufshcd_vendor_isr_def(struct ufs_hba *hba) +{ + return IRQ_NONE; +} +DEFINE_STATIC_CALL(vendor_isr, ufshcd_vendor_isr_def); + static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba); static void ufshcd_async_scan(void *data, async_cookie_t cookie); static int ufshcd_reset_and_restore(struct ufs_hba *hba); @@ -6445,7 +6452,9 @@ static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba) */ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) { - irqreturn_t retval = IRQ_NONE; + irqreturn_t retval; + + retval = static_call(vendor_isr)(hba); if (intr_status & UFSHCD_UIC_MASK) retval |= ufshcd_uic_cmd_compl(hba, intr_status); @@ -8533,6 +8542,9 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba) if (err) dev_err(hba->dev, "%s: variant %s init failed err %d\n", __func__, ufshcd_get_var_name(hba), err); + + if (hba->vops->intr) + static_call_update(vendor_isr, *hba->vops->intr); out: return err; } diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 52ea6f3..7af5d5b 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -356,6 +356,7 @@ struct ufs_hba_variant_ops { const union ufs_crypto_cfg_entry *cfg, int slot); void (*event_notify)(struct ufs_hba *hba, enum ufs_event_type evt, void *data); + irqreturn_t (*intr)(struct ufs_hba *hba); }; /* clock gating state */ From patchwork Mon Sep 13 07:55:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 12488109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2550BC433FE for ; Mon, 13 Sep 2021 08:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F212460E90 for ; Mon, 13 Sep 2021 08:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237966AbhIMINP (ORCPT ); Mon, 13 Sep 2021 04:13:15 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:21998 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237921AbhIMINM (ORCPT ); Mon, 13 Sep 2021 04:13:12 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210913081155epoutp028c3b793bd3a95fddac97045e211eb958~kU3Jt1wWK2028620286epoutp02C for ; Mon, 13 Sep 2021 08:11:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210913081155epoutp028c3b793bd3a95fddac97045e211eb958~kU3Jt1wWK2028620286epoutp02C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1631520715; bh=87QFDn3C/DoVwFJwy2ZSjEIn7gw+sSRF8SjelsTGOJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=A6+aLQtEOJy0pUPTNjOiH/ELi3Q5uHJNeXNnmMYr4zE6PgGR+fumHM+3FYVATqS5V JBDKiVsgeVCjnbLEhToZ5gnY49NY+PUYjVx6mqmegoiM+H1yKtuyotXREk2XQE8u28 0qglGqOewabVwdjDPalnE0SKiLQViqtp6hEVykfA= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20210913081155epcas2p2cf5131d48b65472075888b07a8bbae8f~kU3JCoU0j0646006460epcas2p2s; Mon, 13 Sep 2021 08:11:55 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.184]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4H7K2K3v8cz4x9Qb; Mon, 13 Sep 2021 08:11:53 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 3E.44.09816.7C70F316; Mon, 13 Sep 2021 17:11:51 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20210913081151epcas2p453eb6c6de01466060724d1445b443572~kU3FR-2mA3163831638epcas2p4r; Mon, 13 Sep 2021 08:11:51 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210913081151epsmtrp1c26c9509afd9244e60b7d8d46c59dfeb~kU3FQuZhY1350813508epsmtrp1e; Mon, 13 Sep 2021 08:11:51 +0000 (GMT) X-AuditID: b6c32a46-63bff70000002658-3f-613f07c7850b Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id BF.CE.08750.6C70F316; Mon, 13 Sep 2021 17:11:51 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210913081150epsmtip184e72205ce3264d62bca860f7a9e2d2e~kU3FCOK550411604116epsmtip1w; Mon, 13 Sep 2021 08:11:50 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, cang@codeaurora.org, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, bhoon95.kim@samsung.com Cc: Kiwoong Kim Subject: [PATCH v2 2/3] scsi: ufs: introduce force requeue Date: Mon, 13 Sep 2021 16:55:54 +0900 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFJsWRmVeSWpSXmKPExsWy7bCmhe5xdvtEg7/b9SxOPlnDZvFg3jY2 i5c/r7JZHHzYyWLxdekzVotP65exWqxe/IDFYtGNbUwWN7ccZbG4vGsOm0X39R1sFsuP/2Oy 6Lp7g9Fi6b+3LA58Hpf7epk8Fu95yeQxYdEBRo/v6zvYPD4+vcXi0bdlFaPH501yHu0HupkC OKJybDJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTdMnOADldS KEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFBgaFugVJ+YWl+al6yXn51oZGhgYmQJV JuRkHH0uV3CLv+JsYzNjA+Nnni5GTg4JAROJddd2sncxcnEICexglJj/biczhPOJUWLp34tM EM5nRonly/6zwbSs73jJCJHYxShxb99lqJYfjBL/rs4Eq2IT0JR4enMqE4gtIrCPSeLornQQ m1lAXWLXhBNAcQ4OYQEriUWvWEHCLAKqEoeabjGC2LwC0RKPVi1hhVgmJ3HzXCcziM0pYClx /+8JJlQ2F1DNVA6JAzvOMUI0uEgs+XERqllY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XhBNANgeHsICVxKJXrCBhFgFViUNNt8CG8gpESzxatYQVYoGcxM1zncwgNqeApcT9vyfA xggJWEj0b97EiEt8AqPAAkaGVYySqQXFuem5xYYFRnmp5XrFibnFpXnpesn5uZsYwZGgpbWD cc+qD3qHGJk4GA8xSnAwK4nwbntjmyjEm5JYWZValB9fVJqTWnyIUZqDRUmc90LXyXghgfTE ktTs1NSC1CKYLBMHp1QDU+vbE36mfkKdlV+F0xgf54Rq9kmxXdp5+/kPm59zPp1M37w5tfjW pVxl3sOl50TdXrLf2uOU596S4/GZ+d43x8rNJ71P7wq/uqiT49wdwfj2tv/23ke/GcQfrmm1 4JKZ+z/5Cbts4aR0jnYl6be9OjNuRydOE/4g1L9WPHhblUX1O7Vv7svqfKf8r+pQ/NN0pea6 TL/b+9Ya0Y9h5XM/rGsrV9jTJTLRL0uC41ruDBZHNdHlRxWk8g4fMFW56rLj/8sPN5n3dTR9 v/FzDttxxmD2w2xMh+ZIz2xfcmdKQse3s+cEJL5rvsz0Z3BoDbv1dxKb88bDfkufP91UFvvn LdviLbkGOR8/BUR4bDCsV2Ipzkg01GIuKk4EALuioRvzAgAA X-CMS-MailID: 20210913081151epcas2p453eb6c6de01466060724d1445b443572 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210913081151epcas2p453eb6c6de01466060724d1445b443572 References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When a data command is completed but its data integrity isn't guaranteed, the driver doesn't return any errors but user land could face various abnormal symtoms. All the pending commands should be queued again only if those events could be detected before the commands are completed. Because it could be a disaster, especially if the command is write. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/ufshcd.c | 8 ++++++-- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 604c505..6550052 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5294,8 +5294,11 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) ufshcd_update_monitor(hba, lrbp); ufshcd_add_command_trace(hba, index, UFS_CMD_COMP); - result = retry_requests ? DID_BUS_BUSY << 16 : - ufshcd_transfer_rsp_status(hba, lrbp); + if (hba->force_requeue) + result = DID_REQUEUE << 16; + else + result = retry_requests ? DID_BUS_BUSY << 16 : + ufshcd_transfer_rsp_status(hba, lrbp); scsi_dma_unmap(cmd); cmd->result = result; /* Mark completed command as NULL in LRB */ @@ -6200,6 +6203,7 @@ static void ufshcd_err_handler(struct Scsi_Host *host) /* Fatal errors need reset */ if (needs_reset) { hba->force_reset = false; + hba->force_requeue = false; spin_unlock_irqrestore(hba->host->host_lock, flags); err = ufshcd_reset_and_restore(hba); if (err) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 7af5d5b..642c547 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -855,6 +855,7 @@ struct ufs_hba { bool force_reset; bool force_pmc; bool silence_err_logs; + bool force_requeue; /* Device management request data */ struct ufs_dev_cmd dev_cmd; From patchwork Mon Sep 13 07:55:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 12488111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A19BFC433EF for ; Mon, 13 Sep 2021 08:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D9C460D42 for ; Mon, 13 Sep 2021 08:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237999AbhIMINU (ORCPT ); Mon, 13 Sep 2021 04:13:20 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:22022 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237914AbhIMINN (ORCPT ); Mon, 13 Sep 2021 04:13:13 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210913081156epoutp028ecc11151f4aa08ebc97fea24a2ebbcf~kU3KI6LTx1748017480epoutp02b for ; Mon, 13 Sep 2021 08:11:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210913081156epoutp028ecc11151f4aa08ebc97fea24a2ebbcf~kU3KI6LTx1748017480epoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1631520716; bh=swn3c0mDNJ/0hlD7Do34gPFEkYMDRPAATDWWj2Pi0sc=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=K9uTRG+3Z5Lt98nKtKeYTioJnmTIxZg8UqM+3V3g9nx+56j2JzsPUI2qR6nYtG/+Y pzdfRwV9SnxCyO9+Dnm+Jk14PWNJI7agRC7GklI23VnfzSIoh/2Tl7YbiCwDOvoEwl KZ4XdHoE8zzPGG4OVd19LBuOGpsfD26SUjGkHkzg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20210913081155epcas2p18d703a2887b2f6211a5a913f6325c751~kU3JjJjoa0434804348epcas2p1M; Mon, 13 Sep 2021 08:11:55 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.190]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4H7K2K6W12z4x9Px; Mon, 13 Sep 2021 08:11:53 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id DD.AC.09472.8C70F316; Mon, 13 Sep 2021 17:11:52 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210913081152epcas2p2eac4a8dbef33164a150dccf2e282dcce~kU3GHqJtB0641906419epcas2p2p; Mon, 13 Sep 2021 08:11:52 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210913081152epsmtrp1ea874e3c703c9ee8bcef2e0ff1377e2e~kU3GG30sr1354313543epsmtrp1K; Mon, 13 Sep 2021 08:11:52 +0000 (GMT) X-AuditID: b6c32a48-d75ff70000002500-fd-613f07c85b0a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id C0.DE.08750.7C70F316; Mon, 13 Sep 2021 17:11:52 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210913081151epsmtip17921edbefd78aeeede98be637d1dedc1~kU3F8Z8Qr0411604116epsmtip1x; Mon, 13 Sep 2021 08:11:51 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, cang@codeaurora.org, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, bhoon95.kim@samsung.com Cc: Kiwoong Kim Subject: [PATCH v2 3/3] scsi: ufs: ufs-exynos: implement exynos isr Date: Mon, 13 Sep 2021 16:55:55 +0900 Message-Id: <746e059782953fca6c21945297151d2bb73d3370.1631519695.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJsWRmVeSWpSXmKPExsWy7bCmhe4JdvtEg3071S1OPlnDZvFg3jY2 i5c/r7JZHHzYyWLxdekzVotP65exWqxe/IDFYtGNbUwWN7ccZbG4vGsOm0X39R1sFsuP/2Oy 6Lp7g9Fi6b+3LA58Hpf7epk8Fu95yeQxYdEBRo/v6zvYPD4+vcXi0bdlFaPH501yHu0HupkC OKJybDJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlVx8AnTdMnOADldS KEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFBgaFugVJ+YWl+al6yXn51oZGhgYmQJV JuRkLDney1Qw36Ri3tLnrA2Mk7S6GDk5JARMJLYfeMXSxcjFISSwg1Hi6vRPTBDOJ0aJrwsf sUI4nxkl/n59zgbT8vnxO6jELkaJJxNXM0M4PxglNny5xQJSxSagKfH05lQmEFtEYB+TxNFd 6SA2s4C6xK4JJ8DiwgLOEvfbuoBsDg4WAVWJaT2aIGFegWiJTfOmsEIsk5O4ea6TGcTmFLCU uP8XohXB5gKqmcohsf/xLSaIBheJRadeMELYwhKvjm9hh7ClJF72t0HZ9RL7pjawQjT3MEo8 3fcPqsFYYtazdkaQg5iBHli/Sx/ElBBQljgC8RazAJ9Ex+G/7BBhXomONiGIRmWJX5MmQw2R lJh58w7UJg+J9X1vGSHBA7Tp7KFGxgmM8rMQFixgZFzFKJZaUJybnlpsVGCCHHubGMGpVMtj B+Pstx/0DjEycT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k7GCwmkJ5ak ZqemFqQWwWSZODilGpiY1AtY9/nZ3Gr5WMaXcvj3N/383OBtt2ffvMZ/Jjiyj+MoF9eTA7dL 49qTLt+JjeYJ6FeY+VG3aMnKnjMeF+Jilx7q8178my/7z9dqNwmnhSe7vp6fwSzwpLt0e1cU 93we36SpymlK+4PZw7tOCLLZFtz13mn9IbpoYe20oNnNroE2+/56zpUJ4BRUN737V8Pdbsez irdlQcv8Pa7I7LWRtH0iK9V7cc6GX7cfpa2fL+Gs2jjBJOywy5wX2XcWip9covH6jbB3+4rp czi1orcxTKr6d1HwyMqSskZ5m/Q/uY8YpqSYLPA/dpdr+iLr3CtvXU5vtOPMTdNdGFg4v/nr bYuNi6TucrCzp0yozlRiKc5INNRiLipOBACl7xX+8wIAAA== X-CMS-MailID: 20210913081152epcas2p2eac4a8dbef33164a150dccf2e282dcce X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210913081152epcas2p2eac4a8dbef33164a150dccf2e282dcce References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch is to raise recovery in some abnormal conditions using an vendor specific interrupt for some cases, such as a situation that some contexts of a pending request in the host isn't the same with those of its corresponding UPIUs if they should have been the same exactly. The representative case is shown like below. In the case, a broken UTRD entry, for internal coherent problem or whatever, that had smaller value of PRDT length than expected was transferred to the host. So, the host raised an interrupt of transfer complete even if device didn't finish its data transfer because the host sees a fetched version of UTRD to determine if data tranfer is over or not. Then the application level seemed to recogize this as a sort of corruption and this symptom led to boot failure. [5: init: 1] init: Failed to copy /avb into /metadata/gsi/dsu/avb/: No such file or directory [5: init: 1] init: [libfs_mgr]Created logical partition system on device /dev/block/dm-0 [4: init: 1] init: [libfs_mgr]Created logical partition vendor on device /dev/block/dm-1 [4: init: 1] init: [libfs_avb]total vbmeta size mismatch: 13504 (expected: 15616) [4: init: 1] init: [libfs_avb]VerifyVbmetaImages failed [4: init: 1] init: Failed to open AvbHandle: No such file or directory If the issued command would be write, it could be a disaster because some parts of its entire data chunk may be not written or more than the chunk may be written. Using the VENDOR_SPECIFIC_IS.RX_UPIU_HIT_ERROR, the host can detect the abnormal condition right when an DATA IN for offset bigger than expected for the broken value (i.e. PRDT length in this case) is received, do something for recovery and system will keep going safe. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/ufs-exynos.c | 84 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index a14dd8c..b0c8843 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -21,6 +21,7 @@ #include "unipro.h" #include "ufs-exynos.h" +#include "../scsi_transport_api.h" /* * Exynos's Vendor specific registers for UFSHCI @@ -31,6 +32,8 @@ #define HCI_RXPRDT_ENTRY_SIZE 0x04 #define HCI_1US_TO_CNT_VAL 0x0C #define CNT_VAL_1US_MASK 0x3FF +#define VENDOR_SPECIFIC_IS 0x38 +#define VENDOR_SPECIFIC_IE 0x3C #define HCI_UTRL_NEXUS_TYPE 0x40 #define HCI_UTMRL_NEXUS_TYPE 0x44 #define HCI_SW_RST 0x50 @@ -74,6 +77,18 @@ UIC_TRANSPORT_NO_CONNECTION_RX |\ UIC_TRANSPORT_BAD_TC) +enum exynos_ufs_vs_interrupt { + /* + * This occurs when information of a pending request isn't + * the same with incoming UPIU for the request. For example, + * if UFS driver rings with task tag #1, subsequential UPIUs + * for this must have one as the value of task tag. But if + * it's corrutped until the host receives it or incoming UPIUs + * has an unexpected value for task tag, this raises. + */ + RX_UPIU_HIT_ERROR = 1 << 19, +}; + enum { UNIPRO_L1_5 = 0,/* PHY Adapter */ UNIPRO_L2, /* Data Link */ @@ -996,6 +1011,10 @@ static int exynos_ufs_init(struct ufs_hba *hba) goto out; exynos_ufs_specify_phy_time_attr(ufs); exynos_ufs_config_smu(ufs); + + /* enable vendor interrupts */ + hci_writel(ufs, VENDOR_SPECIFIC_IE, RX_UPIU_HIT_ERROR); + return 0; phy_off: @@ -1005,26 +1024,34 @@ static int exynos_ufs_init(struct ufs_hba *hba) return ret; } -static int exynos_ufs_host_reset(struct ufs_hba *hba) +static int exynos_ufs_host_reset(struct exynos_ufs *ufs) { - struct exynos_ufs *ufs = ufshcd_get_variant(hba); unsigned long timeout = jiffies + msecs_to_jiffies(1); - u32 val; - int ret = 0; - - exynos_ufs_disable_auto_ctrl_hcc_save(ufs, &val); + /* host reset */ hci_writel(ufs, UFS_SW_RST_MASK, HCI_SW_RST); - do { if (!(hci_readl(ufs, HCI_SW_RST) & UFS_SW_RST_MASK)) - goto out; + return 0; + cpu_relax(); } while (time_before(jiffies, timeout)); - dev_err(hba->dev, "timeout host sw-reset\n"); - ret = -ETIMEDOUT; + pr_err("timeout host sw-reset\n"); + return -ETIMEDOUT; +} + +static int exynos_ufs_host_init(struct ufs_hba *hba) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + u32 val; + int ret; + + exynos_ufs_disable_auto_ctrl_hcc_save(ufs, &val); + + ret = exynos_ufs_host_reset(ufs); + if (ret) + return ret; -out: exynos_ufs_auto_ctrl_hcc_restore(ufs, &val); return ret; } @@ -1110,7 +1137,7 @@ static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba, switch (status) { case PRE_CHANGE: - ret = exynos_ufs_host_reset(hba); + ret = exynos_ufs_host_init(hba); if (ret) return ret; exynos_ufs_dev_hw_reset(hba); @@ -1198,6 +1225,38 @@ static int exynos_ufs_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) return 0; } +static irqreturn_t exynos_ufs_isr(struct ufs_hba *hba) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + u32 status; + unsigned long flags; + + if (!hba->priv) return IRQ_HANDLED; + status = hci_readl(ufs, VENDOR_SPECIFIC_IS); + hci_writel(ufs, status, VENDOR_SPECIFIC_IS); + /* + * If host doesn't guarantee integrity of UTP transmission, + * it needs to be reset immediately to make it unable to + * proceed requests. Because w/o this, if UTP functions + * in host doesn't work properly for such system power margins, + * DATA IN from broken devices or whatever in the real world, + * some unexpected events could happen, such as transferring + * a broken DATA IN to a device. It could be various types of + * problems on the level of file system. In this case, I think + * blocking the host's functionality is the best strategy. + * Perhaps, if its root cause is temporary, system could recover. + */ + if (status & RX_UPIU_HIT_ERROR) { + pr_err("%s: status: 0x%08x\n", __func__, status); + hba->force_reset = true; + hba->force_requeue = true; + scsi_schedule_eh(hba->host); + spin_unlock_irqrestore(hba->host->host_lock, flags); + return IRQ_HANDLED; + } + return IRQ_NONE; +} + static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name = "exynos_ufs", .init = exynos_ufs_init, @@ -1209,6 +1268,7 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .hibern8_notify = exynos_ufs_hibern8_notify, .suspend = exynos_ufs_suspend, .resume = exynos_ufs_resume, + .intr = exynos_ufs_isr, }; static int exynos_ufs_probe(struct platform_device *pdev)