Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1907448pxb; Sun, 18 Apr 2021 10:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP0q5jKnZR+Eb5pIInQ9litFfQTNK7Dj+Emk3yLkUpWUjqp/eeC4avJVVt71wIeUrmxRKs X-Received: by 2002:a17:906:b355:: with SMTP id cd21mr17844541ejb.504.1618768594200; Sun, 18 Apr 2021 10:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618768594; cv=none; d=google.com; s=arc-20160816; b=PMKr+NiC5M4na4e2PHTPf53S6xTSgSLs+HLsEpiJdcyRdIoym0+VoMHnrL8ocwd9J1 g0asjRDylJCROyLFsqmbnsMC16OCsSPO5igpe2zKKzgiZEiQOM1MxfLsmMJ9wCyLhycR XgVKtWqFdj5nhMaNhF6zxrQfIdrgjWDbLQldqT29qXF6f9StaX27Kq28KY3OihjIcd8c goFHux9Gb2+zfS7wTXib5xhtO+w9Dq4HocevU02OCcIvamSGiF44FCzULBcpZw4nrqxu 10OacCco/qewO/2Gmc+JQTVI40WhZSpV+Jf/sPb5/06OLTwuc3b4NSXUSzkINsUMFm85 sWBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=JEhxNBiJCd4YEdh5ndn4/SF90I3IsTk5LZefFkcYrPA=; b=Nc+f8XC2cBk88TXFKa9dLBME1UccNaqQ9TGnERaLa0QVw2dKskIYCu/blgAZrkzSnf wOK3WKnMmhSskLhokNzzidngoMadauoGWRpJrqPrrFDZu4soSylz5VESF9kSCVeCK+Du dWghnkdS4WfvBYWs34G8eGHk56dkRqns1Dd47mbrDlCBLb2DItgIDl9cKvZPUkZ2pCHK lQCquEmzEBRHbQdMII6Fv6jaL54HGvMC7Ln7cQnQjfMeakTmsTPkkayzpmB4KJiDHw+g vT82tdJj6bfBlEW2OGnAbLlFQYxt1OT90H0Ari7f39DCVoUZSZTe5HZ7w4Tx7li3oJqd UVlA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si10060397ejb.264.2021.04.18.10.56.09; Sun, 18 Apr 2021 10:56:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232539AbhDRRv5 (ORCPT + 99 others); Sun, 18 Apr 2021 13:51:57 -0400 Received: from mga02.intel.com ([134.134.136.20]:27417 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbhDRRvz (ORCPT ); Sun, 18 Apr 2021 13:51:55 -0400 IronPort-SDR: ZlSbyQ6zrqlLlTiCLvcB+NK7wS/zxv1B6AkgtkEHRlMYw5++3ywuJcsSfemVrOCxsCquOlATIm 7pYX/SVhPfRg== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="182365273" X-IronPort-AV: E=Sophos;i="5.82,232,1613462400"; d="scan'208";a="182365273" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2021 10:51:25 -0700 IronPort-SDR: zSd+fLIuQFKo/U1wfd8IDTq8CI+947dtrdK8O0hi9ecBrpM2effepD/3f2kBAGExIPvQLkqDqv iGYb5DvUwBpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,232,1613462400"; d="scan'208";a="419737749" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga008.fm.intel.com with ESMTP; 18 Apr 2021 10:51:22 -0700 Subject: Re: [PATCH] scsi: ufs: Check for bkops in runtime suspend To: Avri Altman , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alex Lemberg References: <20210418072150.3288-1-avri.altman@wdc.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <2b66db28-2caa-8121-342d-c95c23412876@intel.com> Date: Sun, 18 Apr 2021 20:51:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210418072150.3288-1-avri.altman@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/04/21 10:21 am, Avri Altman wrote: > The UFS driver allowed BKOPS and WB Flush operations to be completed on > Runtime suspend. Adding the DeepSleep support, this is no longer true: > the driver will ignore BKOPS and WB Flush states, and force a link state > transition to UIC_LINK_OFF_STATE. > > Do not ignore BKOPS and WB Flush on runtme suspend flow. > > fixes: fe1d4c2ebcae (scsi: ufs: Add DeepSleep feature) > > Suggested-by: Alex Lemberg > Signed-off-by: Avri Altman > --- > drivers/scsi/ufs/ufshcd.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 58d7f264c664..1a0cac670aba 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -8755,7 +8755,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) > * In the case of DeepSleep, the device is expected to remain powered > * with the link off, so do not check for bkops. > */ > - check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba); > + check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba) || > + hba->dev_info.b_rpm_dev_flush_capable; Can you explain this some more? If hba->dev_info.b_rpm_dev_flush_capable is true, then ufshcd_set_dev_pwr_mode() was not called, so ufshcd_is_ufs_dev_deepsleep() is false i.e. the same result for the condition above. However, it is assumed DeepSleep has the link off so that a full reset and restore is done upon resume, which is necessary to exit DeepSleep. So if you wanted to have DeepSleep with the link on, then the resume logic would also need changes. > ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops); > if (ret) > goto set_dev_active; >