Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4167271pxu; Mon, 30 Nov 2020 20:16:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCwhNgpFmLeykbcmRq2Mc7SVaR4kZz4JACMfIR5Y6MItM1mHEcUkOg/XeuHolBBj0VMF52 X-Received: by 2002:a50:fc96:: with SMTP id f22mr1172676edq.162.1606796214633; Mon, 30 Nov 2020 20:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606796214; cv=none; d=google.com; s=arc-20160816; b=qegcjmOrdfrl3EGx2CkPIyZORut1Z/RZtHAo2YJiIPcNrUB/DG3intHUCnONHjV8+K Osb+DP+ZucuaLlDrqnzawT6LNnYfVSS/dXrW1UGI6wtSP49gTg78JBZaMSt01ifu2S+T DVCJXfNeq8tpz1oWPjW7zn/ymuQyAnuHyftk0m6ieTLB51gu2x3ekzIgpbCo+eKgTg4t CvGuOnm75s+tRLpRI0zyBa+Yd86xlBjy66vgj1mi6iTuBMiUHdGwB3Tnr8ndZAAah/SO N9VIXJi+SfXwS2H4xwssqZ/+1NwLOpRLeaaUclQOUW+AE8OxWPOMrj9+A9ixisRYP6cS 7Hyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SjMD9bQldHP+OyjD7Z2cInyvaBJMPV+xGE4lVAtEPlE=; b=xgHvKoEiSnd9nyQThxh80T/6whLBOpCQEajCs8gmwyR5lLa3e8vb/ZVX6QYgjcuYjd UiyP0OmO5hrUoGkFJEx143C79vi81M1Yo0dzxy0mdtDz0L8Wq5n43+qNYe9zEJkquRge T5lQWdoh1kpe+U15h7maHra6nvYoBrkJZ32koUXWUqNQWzSa0Fw5qkh/l/2bLp70KssY d3Yp8ppVZcXaFYDUMH5VW8bNj9D5p2Bp0gOhfjVszAadybm7Of4o4FcYRnNBqO1tfyOm +quY8CDXNl4e5T4AnxOcY/QjGwDGpwZ9ngG9I9ft1bHiF9B8iPO3TjxeOM9LEeadPKtM +hzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y4ggzrxI; 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 o60si382774eda.61.2020.11.30.20.16.32; Mon, 30 Nov 2020 20:16:54 -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=default header.b=Y4ggzrxI; 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 S1728154AbgLAEOv (ORCPT + 99 others); Mon, 30 Nov 2020 23:14:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:60272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728056AbgLAEOv (ORCPT ); Mon, 30 Nov 2020 23:14:51 -0500 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49A1420725; Tue, 1 Dec 2020 04:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606796050; bh=PlLOAxsEMv5+xbPFqK55E56Pqe82bs9RFICqdVs/xuA=; h=From:To:Cc:Subject:Date:From; b=Y4ggzrxIARtzC+hrMoiQOKkijo7yTCg4STb2dZUi3eZkQTkSQQEPfH2/8YEYRYlI9 cJENdFlu6VYC2XBvPKd3HVMFrU8Aim0ULyFSqNlmmHgBPVWjYaw0nIuM7VqeIlhpTO oAlzQOMnE681ybFQS1wph88vFF6CDFJ75ra8qZmM= 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 , Jaegeuk Kim Subject: [PATCH] scsi: ufs: clear uac for RPMB after ufshcd resets Date: Mon, 30 Nov 2020 20:14:02 -0800 Message-Id: <20201201041402.3860525-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Randall Huang 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 --- drivers/scsi/ufs/ufshcd.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dba3ee307307..c728c00b58db 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; -- 2.29.2.454.gaff20da3a2-goog