From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Nitin Rawat <quic_nitirawa@quicinc.com>,
vkoul@kernel.org, kishon@kernel.org,
manivannan.sadhasivam@linaro.org,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, bvanassche@acm.org,
andersson@kernel.org, neil.armstrong@linaro.org
Cc: quic_rdwivedi@quicinc.com, quic_cang@quicinc.com,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH V4 10/11] scsi: ufs: qcom : Introduce phy_power_on/off wrapper function
Date: Fri, 9 May 2025 14:00:48 +0200 [thread overview]
Message-ID: <4a72ea06-22a8-4f8c-92ad-b5b3afa25b70@oss.qualcomm.com> (raw)
In-Reply-To: <be69cd1e-c04c-4976-9be1-390631316d3f@quicinc.com>
On 5/9/25 1:49 PM, Nitin Rawat wrote:
>
>
> On 5/9/2025 5:07 PM, Konrad Dybcio wrote:
>> On 5/3/25 6:24 PM, Nitin Rawat wrote:
>>> Introduce ufs_qcom_phy_power_on and ufs_qcom_phy_power_off wrapper
>>> functions with mutex protection to ensure safe usage of is_phy_pwr_on
>>> and prevent possible race conditions.
>>>
>>> Co-developed-by: Can Guo <quic_cang@quicinc.com>
>>> Signed-off-by: Can Guo <quic_cang@quicinc.com>
>>> Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
>>> ---
>>
>> The PHY framework does the same thing internally already, this seems
>> unnecessary
>
> Hi Konrad,
>
> Thanks for the review. There are scenarios where ufshcd_link_startup() can call ufshcd_vops_link_startup_notify() multiple times during retries. This leads to the PHY reference count increasing continuously, preventing proper re-initialization of the PHY.
I'm assuming you're talking about the scenario where it jumps into
ufs_qcom_power_up_sequence() - you have a label in there called
`out_disable_phy` - add a phy_power_off() after phy_calibrate if
things fail and you should be good to go if I'm reading things right.
Please include something resembling a call stack in the commit message,
as currently everyone reviewing this has to make guesses about why this
needs to be done
> Recently, this issue was addressed with patch 7bac65687510 ("scsi: ufs:
> qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()"). However, I still want to maintain a reference count (ref_cnt) to safeguard against similar conditions in the code. Additionally, this approach helps avoid unnecessary phy_power_on and phy_power_off calls. Please let me know your thoughts.
These unnecessary calls only amount to a couple of jumps and compares,
just like your wrappers, as the framework keeps track of the enable
count as well
Konrad
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2025-05-09 12:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-03 16:24 [PATCH V4 00/11] Refactor ufs phy powerup sequence Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 01/11] scsi: ufs: qcom: add a new phy calibrate API call Nitin Rawat
2025-05-09 12:06 ` Konrad Dybcio
2025-05-03 16:24 ` [PATCH V4 02/11] phy: qcom-qmp-ufs: Rename qmp_ufs_enable and qmp_ufs_power_on Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 03/11] phy: qcom-qmp-ufs: Refactor phy_power_on and phy_calibrate callbacks Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 04/11] phy: qcom-qmp-ufs: Refactor UFS PHY reset Nitin Rawat
2025-05-04 15:27 ` Dmitry Baryshkov
2025-05-03 16:24 ` [PATCH V4 05/11] phy: qcom-qmp-ufs: Remove qmp_ufs_com_init() Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 06/11] phy: qcom-qmp-ufs: Rename qmp_ufs_power_off Nitin Rawat
2025-05-04 15:37 ` Dmitry Baryshkov
2025-05-04 15:52 ` Nitin Rawat
2025-05-06 11:53 ` Dmitry Baryshkov
2025-05-07 15:05 ` Nitin Rawat
2025-05-04 15:57 ` Dmitry Baryshkov
2025-05-03 16:24 ` [PATCH V4 07/11] phy: qcom-qmp-ufs: Remove qmp_ufs_exit() and Inline qmp_ufs_com_exit() Nitin Rawat
2025-05-04 15:56 ` Dmitry Baryshkov
2025-05-03 16:24 ` [PATCH V4 08/11] phy: qcom-qmp-ufs: refactor qmp_ufs_power_off Nitin Rawat
2025-05-04 15:57 ` Dmitry Baryshkov
2025-05-03 16:24 ` [PATCH V4 09/11] scsi: ufs: qcom : Refactor phy_power_on/off calls Nitin Rawat
2025-05-09 11:35 ` Konrad Dybcio
2025-05-10 13:49 ` Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 10/11] scsi: ufs: qcom : Introduce phy_power_on/off wrapper function Nitin Rawat
2025-05-09 11:37 ` Konrad Dybcio
2025-05-09 11:49 ` Nitin Rawat
2025-05-09 12:00 ` Konrad Dybcio [this message]
2025-05-13 13:12 ` Nitin Rawat
2025-05-03 16:24 ` [PATCH V4 11/11] scsi: ufs: qcom: Prevent calling phy_exit before phy_init Nitin Rawat
2025-05-09 11:38 ` Konrad Dybcio
2025-05-09 11:50 ` Nitin Rawat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a72ea06-22a8-4f8c-92ad-b5b3afa25b70@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=andersson@kernel.org \
--cc=bvanassche@acm.org \
--cc=kishon@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_cang@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rdwivedi@quicinc.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox