Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6273855rwn; Tue, 13 Sep 2022 01:26:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VlrXGxOKxtknw0qLiFlIj09v0CZdYujxlKXiO7gqg/tzDm62Tgr7yT87W5QpS0IzKPGiA X-Received: by 2002:a17:903:1250:b0:172:614b:5f01 with SMTP id u16-20020a170903125000b00172614b5f01mr31222865plh.103.1663057566766; Tue, 13 Sep 2022 01:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663057566; cv=none; d=google.com; s=arc-20160816; b=d6U/JyNUglAtspMDSEp7nDv5JP1hp4LG/lnR6l3BFafljYwUfVzTptjjRqKm0562RX P8Jut/xKDUfjQKB8M9GAOC9GRNSHkHs3nD61YqXukVQK1jRzCfnZDOQ/Wj3LTK4Kt+VS nKlTkKZwfq/Rs/ptIZeGlFSqZI/QnkiZgA5fCXliRD0pTVkO0WWsfRyAYXfZyZT3ZOrA gJ2JJsZmaMR/hWoqtvCaGwhZXJwUeHAbx+AoPh2Fg8gpPgM7Ttwi6VgNrzv1V3XNb7mx 69RM38rk6xM9XXJFzS5KP9PtkFcqEJCSwsJShItVgtgg+upwpCJUUOFLspNpwbqKeJvv Y9jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=ERW53Oyymk9MuhMw46n630lKTvxMsEdOQBltMJN71Ps=; b=vqm8q3cT4ySvSA5VrKSTmLDSSYk2mJy39M8j3/SJYs6fs6DO6UIhwo/6TnFw7j1/qN xuUfLJ9jxaukvr9231Z3rTIie8woDHFDpGmbl4m4E839C+Iz07JTUoubecLMSNJzKLIV o5nnEGvczcyvjGu/H/oPA826g+SCEdH4r7aR4W7G3GDICsQSvpbBk99ZDrCbvryGa9GA WKQKtqRT7paIe1ETs18r5KZVCiBF5N+Hl7vOK4ErxCD7uabPakoImnc9hL5XCKAS7RPh YSsO2FtybmagqdSoVa2eH1MkKUQ+X6RTh98wyZJdd9zUZ5hgusZModw8PZSyw6Kz5HMy A+DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=hjUuMY4o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q135-20020a632a8d000000b0043941cf40f1si1542651pgq.740.2022.09.13.01.25.54; Tue, 13 Sep 2022 01:26:06 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=hjUuMY4o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231287AbiIMHyW (ORCPT + 99 others); Tue, 13 Sep 2022 03:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbiIMHyP (ORCPT ); Tue, 13 Sep 2022 03:54:15 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F3AD5A3C2 for ; Tue, 13 Sep 2022 00:54:11 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220913075409epoutp0297925801d94ca44823ab9081b67de583~UXE072ix52848728487epoutp02R for ; Tue, 13 Sep 2022 07:54:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220913075409epoutp0297925801d94ca44823ab9081b67de583~UXE072ix52848728487epoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1663055649; bh=ERW53Oyymk9MuhMw46n630lKTvxMsEdOQBltMJN71Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjUuMY4ohrDDPQ3+WkK1ONS+2vrqkCaogyfAHJHI8buV86TpkmLAisur7bI2tVnKU r8enVo9Vsslg8pZxwMYPHjJmBE5Q+EQ8uZ8LLrM21CsZaPQF3OyCR7R2inMdJP5rnx 9c5xvZ1hKSGtFOlsN8cgg3MN1eZno9ifVtbXB4a4= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220913075408epcas2p4c597f06c76143fd96c6ac562226437a9~UXE0UeNZM2256922569epcas2p4h; Tue, 13 Sep 2022 07:54:08 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.70]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4MRbMN0080z4x9QK; Tue, 13 Sep 2022 07:54:07 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 93.CC.18832.F1730236; Tue, 13 Sep 2022 16:54:07 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220913075407epcas2p1075426e0ef45b6969e50823d59c374d3~UXEzc_oPO1025310253epcas2p1_; Tue, 13 Sep 2022 07:54:07 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220913075407epsmtrp13ec1c6fd71bb474ae86cce8a4a77e406~UXEzcLYCO3251432514epsmtrp1-; Tue, 13 Sep 2022 07:54:07 +0000 (GMT) X-AuditID: b6c32a45-cdfff70000014990-b7-6320371f2995 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 8A.FA.18644.F1730236; Tue, 13 Sep 2022 16:54:07 +0900 (KST) Received: from rack03.dsn.sec.samsung.com (unknown [10.229.95.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220913075407epsmtip16590d1e0c89026163947332c542ddcb7~UXEzQ-Rac3034330343epsmtip1I; Tue, 13 Sep 2022 07:54:07 +0000 (GMT) From: SEO HOYOUNG 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, bvanassche@acm.org, bhoon95.kim@samsung.com, kwmad.kim@samsung.com Cc: SEO HOYOUNG Subject: [PATCH v2] scsi: ufs: add a variant operation in struct ufs_hba_variant_ops Date: Tue, 13 Sep 2022 04:37:03 +0900 Message-Id: <20220912193703.102267-1-hy50.seo@samsung.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJJsWRmVeSWpSXmKPExsWy7bCmma68uUKyQVuTlcWDedvYLF7+vMpm cfBhJ4vF16XPWC2mffjJbLF68QMWi0U3tjFZ3NxylMXi8q45bBbd13ewWSw//o/Jgdvj8hVv jwmLDjB6fF/fwebx8ektFo++LasYPT5vkvNoP9DNFMAelW2TkZqYklqkkJqXnJ+SmZduq+Qd HO8cb2pmYKhraGlhrqSQl5ibaqvk4hOg65aZA3SjkkJZYk4pUCggsbhYSd/Opii/tCRVISO/ uMRWKbUgJafAvECvODG3uDQvXS8vtcTK0MDAyBSoMCE7Y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X5c+Y7WY9uEns8XqxQ9YLBbd2MZkcXPLURaLy7vmsFl0X9/BZrH8+D8mB26Py1e8 PSYsOsDo8X19B5vHx6e3WDz6tqxi9Pi8Sc6j/UA3UwB7FJdNSmpOZllqkb5dAlfG9lMPmQv6 ZSomTlzJ3sC4QbyLkZNDQsBE4sXG40xdjFwcQgI7GCX2zL7ODpGQkPi/uIkJwhaWuN9yhBXE FhL4xijx+KEiiM0moCGx5tghsGYRgRYmidbXr5hBEswCahKf7y5jAbGFBUIkrky6wgZiswio Spx/tgnM5hWwkpi8bBvUAnmJRQ2/wWxOAQuJ/m9TmCGWmUv8eAhh8woISpyc+YQFYr68RPPW 2cwTGAVmIUnNQpJawMi0ilEytaA4Nz232LDAKC+1XK84Mbe4NC9dLzk/dxMjOCK0tHYw7ln1 Qe8QIxMH4yFGCQ5mJRHe7aryyUK8KYmVValF+fFFpTmpxYcYpTlYlMR5L3SdjBcSSE8sSc1O TS1ILYLJMnFwSjUwufj8UPZdZvpz2k6mRS/tvmp3S69bIK1SFMdeevxva1OQQtLO1VEOFVqC 1022TM0T+1cSpv3HoEiIt153+tbtpw5pf5BnrnRbVmJ9hbf8Pvv5pn/1XBMPsB25sed7U63L 2j+evxgfqpQnRch7f75zXeH/1PabaaILbwuZzhYpqGjvkv/TxXAqhSuo7ciLZZwfVrjMi736 wqrF5PVxE7cfT76e+rqR6VSuf6dIa3FBs3WOe3Tj+4V2rSxb5Ld5BGaqWa0/x8iqtO7QyZ/b xBtXpUmeWpx30/WD6BW5sppL7hlSQr9i4kzdq/Jlfxp+LDwvU69vdvrcj6uftp+cxSgTetvt /IvQ7clVQt8/LF6ixFKckWioxVxUnAgAz/1nofcCAAA= X-CMS-MailID: 20220913075407epcas2p1075426e0ef45b6969e50823d59c374d3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220913075407epcas2p1075426e0ef45b6969e50823d59c374d3 References: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DATE_IN_PAST_12_24, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,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 Add ufs_hba_variant_ops about vendor error in check_error. It need to reset when occurred ah8 related error. At that time could not recovery with pwr cmd. So add vendor error check function at ufs_hba_variant_ops. v1->v2 fixed warm message of auto build test Signed-off-by: SEO HOYOUNG --- drivers/ufs/core/ufshcd-priv.h | 7 +++++++ drivers/ufs/core/ufshcd.c | 2 ++ drivers/ufs/host/ufs-exynos.c | 20 ++++++++++++++++++++ include/ufs/ufshcd.h | 1 + 4 files changed, 30 insertions(+) diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h index d00dba17297d..6172da4d3484 100644 --- a/drivers/ufs/core/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -221,6 +221,13 @@ static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, hba->vops->config_scaling_param(hba, p, data); } +static inline void ufshcd_vops_check_int_error(struct ufs_hba *hba, + bool *queue_eh_work) +{ + if (hba->vops & hba->vops->check_int_error) + hba->vops->check_int_error(hba, queue_eh_work); +} + extern const struct ufs_pm_lvl_states ufs_pm_lvl_states[]; /** diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 7c15cbc737b4..39ee5192f26a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -6542,6 +6542,8 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status) queue_eh_work = true; } + ufshcd_vops_check_int_error(hba, &queue_eh_work); + if (queue_eh_work) { /* * update the transfer error masks to sticky bits, let's do this diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c index eced97538082..5d9db6870a66 100644 --- a/drivers/ufs/host/ufs-exynos.c +++ b/drivers/ufs/host/ufs-exynos.c @@ -67,6 +67,10 @@ #define CLK_CTRL_EN_MASK (REFCLK_CTRL_EN |\ UNIPRO_PCLK_CTRL_EN |\ UNIPRO_MCLK_CTRL_EN) + +#define HCI_AH8_STATE 0x50C +#define HCI_AH8_STATE_ERROR BIT(16) + /* Device fatal error */ #define DFES_ERR_EN BIT(31) #define DFES_DEF_L2_ERRS (UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF |\ @@ -1376,6 +1380,21 @@ static void exynos_ufs_hibern8_notify(struct ufs_hba *hba, } } +static void exynos_ufs_check_int_error(struct ufs_hba *hba, bool *queue_eh_work) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + u32 val; + + if (ufshcd_is_auto_hibern8_supported(hba)) { + val = hci_readl(ufs, HCI_AH8_STATE); + + if (val & HCI_AH8_STATE_ERROR) { + ufshcd_set_link_broken(hba); + *queue_eh_work = true; + } + } +} + static int exynos_ufs_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op, enum ufs_notify_change_status status) { @@ -1569,6 +1588,7 @@ static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .setup_xfer_req = exynos_ufs_specify_nexus_t_xfer_req, .setup_task_mgmt = exynos_ufs_specify_nexus_t_tm_req, .hibern8_notify = exynos_ufs_hibern8_notify, + .check_int_error = exynos_ufs_check_int_error, .suspend = exynos_ufs_suspend, .resume = exynos_ufs_resume, }; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 24c97e0772bb..40078c4b9f55 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -335,6 +335,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); + void (*check_int_error)(struct ufs_hba *hba, bool *queue_eh_work); }; /* clock gating state */ -- 2.26.0