Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp855610ybz; Fri, 17 Apr 2020 11:15:25 -0700 (PDT) X-Google-Smtp-Source: APiQypIeunDfe2aqKB6roy5EtzCSbI7+3k0JRk7kfqGoyT1PXuvv2CGrclKsHgmQ51ntctCFoLIv X-Received: by 2002:a50:8d02:: with SMTP id s2mr4404825eds.81.1587147325169; Fri, 17 Apr 2020 11:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587147325; cv=none; d=google.com; s=arc-20160816; b=VqKoV9J1npqeccM57sMF+DK1yljMxztU0pLoa0BfSlC6X+49Vf5EIDkODIm7c6PjGW baujJbjp6nSRG9vcCDwQH/3/fqDM3I1NOU7HTRJXWPnbT/jvGF2FJscK7vf/iLk+1qIx ew5ReYuKfM1/VIKrOwt44eM7u1y4tT5V11fv2ez6sMlAaaJqnybIZBae7UcUt9uThupT prFfYeqClIdtBUZM1vCL9cy9SfxLr4y7vX+qX6nxydKIPMSKRzCLkCKHe5IRzreuHcAH LGAyOGYI30FAiNJP18MBL3BhyTST3jkhyu9FH9+iFrN5Fa03u3sW0m4o2jKatMGhI0AV M6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=ZPz4c7rs/J4yvDkVsqsO6MPyp8jBkGC5MbwUBNlrl90=; b=HSOnb63u1yGDXhExKf0LIBD/97bYvfzF6j7nHjIQrovOARI9mR9xB2xj9tK6PHFgwT N7d5VRnMKNarCsY/Cpnwq5cTemv8uX/yQy8Lao6Skxl0GJDJe1MwUDUEfd+otR6u0p8h nSCGGN/K0p3hggrU5PwWxtXw9tJOOUHv0rgU7/6Mif7lmUb7lPfdokeswHxsE4rnuj1r 4AzMtikuWvHvmFex/pk8fZd9X7PSmnYfKuhBkc2rwU4nJVw8XCrdQ0VeAE4AE/K+wJYB ZtpUxM+jUOcQQRL1R1aDcRh0KXakUolS9i8r+jeRazqqA/RhrPolw81BDifcXyuOVCmH b8qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Sk6QXVIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si14002642eds.600.2020.04.17.11.14.56; Fri, 17 Apr 2020 11:15:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Sk6QXVIr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730748AbgDQSK4 (ORCPT + 99 others); Fri, 17 Apr 2020 14:10:56 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:56428 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730512AbgDQSKU (ORCPT ); Fri, 17 Apr 2020 14:10:20 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200417181018epoutp046be518f77a4b1f2158e1e86e7a9bd0ec~Grc3tAnOw1452214522epoutp04P for ; Fri, 17 Apr 2020 18:10:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200417181018epoutp046be518f77a4b1f2158e1e86e7a9bd0ec~Grc3tAnOw1452214522epoutp04P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587147018; bh=ZPz4c7rs/J4yvDkVsqsO6MPyp8jBkGC5MbwUBNlrl90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sk6QXVIrIived9p0rOteg/kN7cgbJm+28nlEdvrthDZEuyusIoDAmOiTyWgtli8P+ p7qqwhc8AiNIKWjUt+wXiHctA2McemuLaQacxm1mHXuk1LD9Xe6+TBAm5f5vgVEQ3A 9qk3d9V1shUdkgNMWZQVYCg6K4SAfLqsm+jB8Qxg= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20200417181017epcas5p431965f3c43030dbd4f1e4da2089a72ad~Grc2jonzf0789107891epcas5p44; Fri, 17 Apr 2020 18:10:17 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D0.26.04778.901F99E5; Sat, 18 Apr 2020 03:10:17 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20200417181016epcas5p2ee7ac86d743ceee9076690dc5b1e2f08~Grc1k8_Li2908329083epcas5p28; Fri, 17 Apr 2020 18:10:16 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200417181016epsmtrp21f2b776f5522f2fa635b1a24193b6d96~Grc1kIOB11925319253epsmtrp2C; Fri, 17 Apr 2020 18:10:16 +0000 (GMT) X-AuditID: b6c32a4a-33bff700000012aa-21-5e99f109ea0e Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EF.D0.04024.801F99E5; Sat, 18 Apr 2020 03:10:16 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.108.73.139]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200417181014epsmtip17135e62ed861b5744dded85dd6b07524~GrczthsVI2097520975epsmtip1F; Fri, 17 Apr 2020 18:10:14 +0000 (GMT) From: Alim Akhtar To: robh@kernel.org Cc: devicetree@vger.kernel.org, linux-scsi@vger.kernel.org, krzk@kernel.org, avri.altman@wdc.com, martin.petersen@oracle.com, kwmad.kim@samsung.com, stanley.chu@mediatek.com, cang@codeaurora.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alim Akhtar Subject: [PATCH v6 05/10] scsi: ufs: add quirk to fix abnormal ocs fatal error Date: Fri, 17 Apr 2020 23:29:39 +0530 Message-Id: <20200417175944.47189-6-alim.akhtar@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200417175944.47189-1-alim.akhtar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42LZdlhTU5fz48w4g58vxCwezNvGZvHy51U2 i0/rl7FazD9yjtXi/PkN7BY3txxlsdj0+BqrxeVdc9gsZpzfx2TRfX0Hm8Xy4/+YLP7v2cFu sXTrTUYHXo/Lfb1MHptWdbJ5bF5S79Fycj+Lx8ent1g8+rasYvT4vEnOo/1AN1MARxSXTUpq TmZZapG+XQJXxtwJHxkL7vFUtDy6z97AeIiri5GTQ0LARGLDnj/sXYxcHEICuxkldtz/yQbh fGKUeN94CMr5xijxau8rVpiW9vXzmSESexklXt9uAnI4gJwWJokjTCA1bALaEnenbwGzRQSE JY58a2MEsZkFbjBJPFjpAmILCwRInPr6EGwmi4CqxNLJy8DqeQVsJHa3f2aC2CUvsXrDAWYQ m1PAVqKtZSkTyF4JgftsErt3nGGEKHKRuPRtPTOELSzx6vgWdghbSuLzu71sILdJCGRL9Owy hgjXSCydd4wFwraXOHBlDgtICbOApsT6XfoQZ/JJ9P5+wgTRySvR0SYEUa0q0fzuKlSntMTE 7m5oiHhIzD86CxqIExglzm9ewjSBU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4VPwnxTb1P6ryqfG91 n978YtGpbs+1F/+mGs1OuFX/7VzgITsvg7jMs1+Pf0jw/2G1Yum/dR+2SymxFGckGmoxFxUn AgCk5ziyYgIAAA== X-CMS-MailID: 20200417181016epcas5p2ee7ac86d743ceee9076690dc5b1e2f08 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P X-CMS-RootMailID: 20200417181016epcas5p2ee7ac86d743ceee9076690dc5b1e2f08 References: <20200417175944.47189-1-alim.akhtar@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kiwoong Kim Some architectures determines if fatal error for OCS occurrs to check status in response upiu. This patch is to prevent from reporting command results with that. Signed-off-by: Kiwoong Kim Signed-off-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 6 ++++++ drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b32fcedcdcb9..8c07caff0a5c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4794,6 +4794,12 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) /* overall command status of utrd */ ocs = ufshcd_get_tr_ocs(lrbp); + if (hba->quirks & UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR) { + if (be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_1) & + MASK_RSP_UPIU_RESULT) + ocs = OCS_SUCCESS; + } + switch (ocs) { case OCS_SUCCESS: result = ufshcd_get_req_rsp(lrbp->ucd_rsp_ptr); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index a9b9ace9fc72..e1d09c2c4302 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -541,6 +541,12 @@ enum ufshcd_quirks { * resolution of the values of PRDTO and PRDTL in UTRD as byte. */ UFSHCD_QUIRK_PRDT_BYTE_GRAN = 1 << 9, + + /* + * This quirk needs to be enabled if the host controller reports + * OCS FATAL ERROR with device error through sense data + */ + UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR = 1 << 10, }; enum ufshcd_caps { -- 2.17.1