Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3502913pxu; Tue, 8 Dec 2020 13:55:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJywoC63UGuaY9Lj2f7SjrH8LPKOZAjr0TKDjqZCudbOShiOD4VYTniv/aPWmv0Ce65VHA1n X-Received: by 2002:a50:9b52:: with SMTP id a18mr3314edj.373.1607464548652; Tue, 08 Dec 2020 13:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607464548; cv=none; d=google.com; s=arc-20160816; b=cIOOR3W2cdmSiniwEuEGm3GHJOmZEIR5Hj11U4Dsc+G5RQpTN6XS3TS/TfRcKpdf6U Fp9F9GuFqT5nRq3JAcA1NxMcsHMsNjVXF0INlHk0U9yfypJPQQnap8d+5Fo1mYB9dedQ OHGjM9GZfyj8kj5WjjRylTrgWcFcFTJQi/GJKBXz3yiNHUO7jsmilezTJlTX8z3+vpt6 7Bcvy/2i39qzpOMXgsVV7+WtMFaxZyGCIXuKCbUZGjBmkOTk/ehfaPESLE3nsqr6xnbZ DWFA6/3TB5aZHkLOX02gBuixRKSXD0Ab8928vDF3d9YIV8DVYY+U71lTrVh9RcBqfAs2 H3Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=g5lhK3a1ojSx2VfMj/c6p3SOI03hxi5WvVwJxp8OL64=; b=TK+4+TKFW6276hBfo0FCA24vB5JPqt9GCoFRJJwMT2827I0tZrI+rlsM5mrdk7GJjR dnZ3b8bDDQU5Ac08Ixl58F66TjAP7CO/Unv2r7AouiYU0l+SBI/pGf4wq7cBtoyDVnrF cRIyg63UaRYT0vtXprnVSCT59xuUOi2P8HkDWBD3VcNnl24YVQcBkx9QuCW53XaasIef RLExZ2K6d9UvGrWsl5u69QaxUfYbwVyDQ2p5XyICZzrPYMx3MDSIzX9DuI1SSIFMC87I pDSXngcDgR6ZihcYn/NPX2V3DzSyY9hMOhb039unKD/pxkf+efqO+I2fVqOqC1/rDryY b0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UKski44z; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si10994981edj.87.2020.12.08.13.55.24; Tue, 08 Dec 2020 13:55:48 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=UKski44z; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729933AbgLHVv7 (ORCPT + 99 others); Tue, 8 Dec 2020 16:51:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgLHVv6 (ORCPT ); Tue, 8 Dec 2020 16:51:58 -0500 Date: Tue, 8 Dec 2020 13:51:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607464277; bh=yZmkyOw708uk+qtFAUhQepgGFTdqhLTaCVU0MzOV+iU=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=UKski44zBJYdLaTuXXc4vt9RN0SDBwl/IbQLBKuSbtU2XFv/xDIY1ytzdhosMPM6V 0y9D8KWsTrqPerOjKyUOQdjhjZkpQ1nKgzYY9DsHT1/81o1Pb0IoICen2YZIHsRXhX r3eApoF7E6LFxZLmtbhCX2yrMdEzGJoxrhq5sPjIGYMYxlEL67oewNqzhAyym9EFWT u+g71oTEiHLpUotJ+4tQ6jdmCrwODE/u87UOEQAKFBtGn5uueDBqmDlx8MQZcCoLIr vuReeUDid3nl1FSZV9HNZ+1EMrw48l6zeRuzhrJM0rHWus6SDz4SSsG5l1nNQ8Uhpz dXReF28+AjxCg== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: cang@codeaurora.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, martin.petersen@oracle.com, stanley.chu@mediatek.com, Randall Huang , Leo Liou Subject: Re: [PATCH v2] scsi: ufs: clear uac for RPMB after ufshcd resets Message-ID: References: <20201201041402.3860525-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201041402.3860525-1-jaegeuk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From 902e313f0d7ccf5e24491c2badc6dc173ce35fb1 Mon Sep 17 00:00:00 2001 From: Randall Huang Date: Tue, 24 Nov 2020 15:29:58 +0800 Subject: [PATCH] scsi: ufs: clear uac for RPMB after ufshcd resets If RPMB is not provisioned, we may see RPMB failure after UFS suspend/resume. Inject request_sense to clear uac in ufshcd reset flow. Signed-off-by: Randall Huang Signed-off-by: Leo Liou Signed-off-by: Jaegeuk Kim --- v2: - fix build warning drivers/scsi/ufs/ufshcd.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dba3ee307307..d6a3a0ba6960 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -220,6 +220,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba); static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd); static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag); static void ufshcd_hba_exit(struct ufs_hba *hba); +static int ufshcd_clear_ua_wluns(struct ufs_hba *hba); static int ufshcd_probe_hba(struct ufs_hba *hba, bool async); static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, bool skip_ref_clk); @@ -6814,7 +6815,8 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) /* Establish the link again and restore the device */ err = ufshcd_probe_hba(hba, false); - + if (!err) + ufshcd_clear_ua_wluns(hba); out: if (err) dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err); @@ -8304,13 +8306,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, * handling context. */ hba->host->eh_noresume = 1; - if (hba->wlun_dev_clr_ua) { - ret = ufshcd_send_request_sense(hba, sdp); - if (ret) - goto out; - /* Unit attention condition is cleared now */ - hba->wlun_dev_clr_ua = false; - } + ufshcd_clear_ua_wluns(hba); cmd[4] = pwr_mode << 4; @@ -8331,7 +8327,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, if (!ret) hba->curr_dev_pwr_mode = pwr_mode; -out: + scsi_device_put(sdp); hba->host->eh_noresume = 0; return ret; -- 2.29.2.576.ga3fc446d84-goog