From patchwork Mon Feb 10 12:33:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 231781 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 1E3F4C352A3 for ; Mon, 10 Feb 2020 13:14:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB8922070A for ; Mon, 10 Feb 2020 13:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581340452; bh=bsjo9ACvB7iO0PMfSLRDDBfCN2w9FOAxmPKsKFvA4fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EUimdjJDrbeFBDSyy5N4k3FfPZa14KfgFoPlMt209g2mmnykWHPsJGG7t0w+ISCld a0Etsj1iCxoqlOXVQy0qCc1GAtGov/wHVr8xL5/OX4tdOszuhU86LTDwq546x7BAtV FsRLczO0X6eMa5QddSzayUgFuINJ2svAYRulWo4M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729635AbgBJNOK (ORCPT ); Mon, 10 Feb 2020 08:14:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:34308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728443AbgBJMif (ORCPT ); Mon, 10 Feb 2020 07:38:35 -0500 Received: from localhost (unknown [209.37.97.194]) (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 05C4324650; Mon, 10 Feb 2020 12:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338315; bh=bsjo9ACvB7iO0PMfSLRDDBfCN2w9FOAxmPKsKFvA4fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZH1IVPT4i1m4aCtYAOXJP1mYf/EInkvHhNFekZEkIQpvR4tEcC+B7CvlogU55SGlM qu2JpvX85VLZtSno5igOrhYuPaw0Nz4g5fwUu4Z9lqLkV5+O1gwtCIX9xr5vhbLQKf 4u1X4bi/90LktEKYw0x3eybX64azLWOrq3mGiFK0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Alim Akhtar , Asutosh Das , Can Guo , "Martin K. Petersen" Subject: [PATCH 5.4 241/309] scsi: ufs: Recheck bkops level if bkops is disabled Date: Mon, 10 Feb 2020 04:33:17 -0800 Message-Id: <20200210122429.657334182@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122406.106356946@linuxfoundation.org> References: <20200210122406.106356946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Asutosh Das commit 24366c2afbb0539fb14eff330d4e3a5db5c0a3ef upstream. bkops level should be rechecked upon receiving an exception. Currently the level is being cached and never updated. Update bkops each time the level is checked. Also do not use the cached bkops level value if it is disabled and then enabled. Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device) Link: https://lore.kernel.org/r/1574751214-8321-2-git-send-email-cang@qti.qualcomm.com Reviewed-by: Bean Huo Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar Signed-off-by: Asutosh Das Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ufs/ufshcd.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5023,6 +5023,7 @@ static int ufshcd_disable_auto_bkops(str hba->auto_bkops_enabled = false; trace_ufshcd_auto_bkops_state(dev_name(hba->dev), "Disabled"); + hba->is_urgent_bkops_lvl_checked = false; out: return err; } @@ -5047,6 +5048,7 @@ static void ufshcd_force_reset_auto_bkop hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS; ufshcd_disable_auto_bkops(hba); } + hba->is_urgent_bkops_lvl_checked = false; } static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status) @@ -5093,6 +5095,7 @@ static int ufshcd_bkops_ctrl(struct ufs_ err = ufshcd_enable_auto_bkops(hba); else err = ufshcd_disable_auto_bkops(hba); + hba->urgent_bkops_lvl = curr_status; out: return err; }