Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp707419ybk; Wed, 20 May 2020 09:57:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy32HERLT28Fl2kGJOM4QzQAryAOnNTJW5GEpPToa/A9Wpl6FlGxkczlocMVhDv2tAuT5yP X-Received: by 2002:a17:906:c01:: with SMTP id s1mr16524ejf.370.1589993860096; Wed, 20 May 2020 09:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589993860; cv=none; d=google.com; s=arc-20160816; b=B1Acnne+3Y+fIvs/u4NKjNMtv8FgAfSoCpKGt7JosycXxALfoXtoQj6s1lPZqcdnkn SJeB66d3GyE9m7SMufZaCSuz2YodSsG6zrq6hYyNLp+vUKtedIz4ae/+8NZ0Rw+2h0Uf t/sL0ICtETLmj9DGeeD0/7yfNxNJORf0UjDY1WqH79fdLOSJQqDzjojl2Z08VkMpw/NV /Snsyx9CdFzP5N2MPYTroVZjQb1rAc5M0wvgdakDd8Ix97tCaYSLbAPligDWIesWOOsm lcI1QSaTiABIFOz0tujFjFnGhCKqUYtHNti439zY0NHPiAKOuDlIe0J/KNLlx1pMkXjz X7/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=fPU9FrcmOGKQPbx+xpLCEeVLHsVWTWvsU+CO+NzO6BM=; b=Ij30DAm7MiMyvvZNgk3G6TzL9w9ggtUXOwcH5mQsQ8Y2FuOcXu2BvOJi/RFuJwXN8x LzJHGejAqzrQRF/n1g2ClDD8Pdi9R5xyNHhtHD/BNhNYh3GucbtL5tdyBsAf+AEgrMZm Vl9M4jIzJ4jhv9JQkPZVuyoVZQ6lXlo4Z5g78oe2sZQwksWP/eHObYlyVFCw4TLSlRIo pLdWarKDnai/MHP24SfIW3tXmvqUcS4ksjVwoPhJDwWg6ciKXmhgSCrapKjnurh9grTC FOKPyk1umkGIL9cPQ1qoTQT5KzIYYHpLIlNVQUH9WAOcxLlTC8to3vtbN1IiYCDbYIj7 wPtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="iS75Jwd/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p32si1884656edd.139.2020.05.20.09.57.17; Wed, 20 May 2020 09:57:40 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b="iS75Jwd/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbgETQz4 (ORCPT + 99 others); Wed, 20 May 2020 12:55:56 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:46942 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgETQzz (ORCPT ); Wed, 20 May 2020 12:55:55 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589993755; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=fPU9FrcmOGKQPbx+xpLCEeVLHsVWTWvsU+CO+NzO6BM=; b=iS75Jwd/Gi6/fkg2xgecLo2hO7Z2pWuzaq12M0jhh5WdXXLNutyazruLoWgSOnqRSXAN8q5G XPdmHxb53KJAMWIBYz0SntGIL+XIObfamb5b6jNxK6q0ciE2SwUjyQtIz8zPLNS/eoqyctMf XFBF+goVe/cnQCtFfe9rcaR+X/w= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ec56112.7f64ed020f48-smtp-out-n02; Wed, 20 May 2020 16:55:46 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6C3C7C43391; Wed, 20 May 2020 16:55:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.8.176] (cpe-70-95-149-85.san.res.rr.com [70.95.149.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5BE96C433C6; Wed, 20 May 2020 16:55:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5BE96C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=asutoshd@codeaurora.org Subject: Re: [PATCH v3 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling To: Pedro Sousa , "cang@codeaurora.org" , "rnayak@codeaurora.org" , "vinholikatti@gmail.com" , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" Cc: "linux-scsi@vger.kernel.org" , "kernel-team@android.com" , "saravanak@google.com" , "salyzyn@google.com" , Andy Gross , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "open list:ARM/QUALCOMM SUPPORT" , open list References: <1571849351-819-1-git-send-email-asutoshd@codeaurora.org> <1571849351-819-2-git-send-email-asutoshd@codeaurora.org> From: "Asutosh Das (asd)" Message-ID: <06fbd425-3815-690a-22bc-a362c5deca6d@codeaurora.org> Date: Wed, 20 May 2020 09:55:43 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pedro, On 11/11/2019 7:54 AM, Pedro Sousa wrote: > Hi Asutosh, > > Please check comments. Sorry for missing out on this and thanks for your review. > > -----Original Message----- > From: Asutosh Das > Sent: Wednesday, October 23, 2019 5:49 PM > To: cang@codeaurora.org; rnayak@codeaurora.org; vinholikatti@gmail.com; jejb@linux.vnet.ibm.com; martin.petersen@oracle.com > Cc: linux-scsi@vger.kernel.org; kernel-team@android.com; saravanak@google.com; salyzyn@google.com; Asutosh Das ; Andy Gross ; Alim Akhtar ; Avri Altman ; Pedro Sousa ; James E.J. Bottomley ; open list:ARM/QUALCOMM SUPPORT ; open list > Subject: [PATCH v3 2/2] scsi: ufs-qcom: enter and exit hibern8 during clock scaling > > Qualcomm controller needs to be in hibern8 before scaling clocks. > This change puts the controller in hibern8 state before scaling > and brings it out after scaling of clocks. > > Signed-off-by: Asutosh Das > --- > drivers/scsi/ufs/ufs-qcom.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c > index a5b7148..55b1de5 100644 > --- a/drivers/scsi/ufs/ufs-qcom.c > +++ b/drivers/scsi/ufs/ufs-qcom.c > @@ -1305,18 +1305,27 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, > int err = 0; > > if (status == PRE_CHANGE) { > + err = ufshcd_uic_hibern8_enter(hba); > + if (err) > + return err; > if (scale_up) > err = ufs_qcom_clk_scale_up_pre_change(hba); > else > err = ufs_qcom_clk_scale_down_pre_change(hba); > + if (err) > + ufshcd_uic_hibern8_exit(hba); > + > } else { > if (scale_up) > err = ufs_qcom_clk_scale_up_post_change(hba); > else > err = ufs_qcom_clk_scale_down_post_change(hba); > > - if (err || !dev_req_params) > + > + if (err || !dev_req_params) { > + ufshcd_uic_hibern8_exit(hba); > goto out; > + } > > ufs_qcom_cfg_timers(hba, > dev_req_params->gear_rx, > @@ -1324,6 +1333,7 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, > dev_req_params->hs_rate, > false); > ufs_qcom_update_bus_bw_vote(host); > + ufshcd_uic_hibern8_exit(hba); > > Here you are creating the possibility of returning a success even if hibern8 exit fails. > If hibern8 exit fails the ufs recovery will be triggered and "err" variable will not get updated > in this function, how is this handled? Did you tested this possibility? > > } > > out: > Yes - I agree with your comment. The error should be propagated from this function correctly to the caller. I'll push another version. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project