linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: cang@codeaurora.org
To: Mark Salyzyn <salyzyn@android.com>
Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org,
	rnayak@codeaurora.org, linux-scsi@vger.kernel.org,
	kernel-team@android.com, saravanak@google.com,
	salyzyn@google.com, Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	Pedro Sousa <pedrom.sousa@synopsys.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Subhash Jadavani <subhashj@codeaurora.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] scsi: ufs: Introduce a vops for resetting host controller
Date: Fri, 01 Nov 2019 09:18:06 +0800	[thread overview]
Message-ID: <8b7e86d09cde1ea45c1ad979d88dc022@codeaurora.org> (raw)
In-Reply-To: <61b83149-e89b-bb4c-d747-a4c596c8eede@android.com>

On 2019-10-31 22:44, Mark Salyzyn wrote:
> On 10/22/19 9:13 PM, Can Guo wrote:
>> Some UFS host controllers need their specific implementations of 
>> resetting
>> to get them into a good state. Provide a new vops to allow the 
>> platform
>> driver to implement this own reset operation.
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>>   drivers/scsi/ufs/ufshcd.c | 16 ++++++++++++++++
>>   drivers/scsi/ufs/ufshcd.h | 10 ++++++++++
>>   2 files changed, 26 insertions(+)
>> 
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index c28c144..161e3c4 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -3859,6 +3859,14 @@ static int ufshcd_link_recovery(struct ufs_hba 
>> *hba)
>>   	ufshcd_set_eh_in_progress(hba);
>>   	spin_unlock_irqrestore(hba->host->host_lock, flags);
>>   +	ret = ufshcd_vops_full_reset(hba);
>> +	if (ret)
>> +		dev_warn(hba->dev, "%s: full reset returned %d\n",
>> +				  __func__, ret);
>> +
>> +	/* Reset the attached device */
>> +	ufshcd_vops_device_reset(hba);
>> +
>>   	ret = ufshcd_host_reset_and_restore(hba);
>>     	spin_lock_irqsave(hba->host->host_lock, flags);
> 
> In all your cases, especially after this adjustment,
> ufshcd_vops_full_reset is called blindly (+error checking message)
> before ufshcd_vops_device_reset. What about dropping the .full_reset
> (should really have been called .hw_reset or .host_reset) addition to
> the vops, just adding ufshcd_vops_device_reset call here before
> ufshcd_host_reset_and_restore, and in the driver folding the
> ufshcd_vops_full_reset code into the .device_reset handler?
> 
> Would that be workable? It would be simpler if so.
> 
> I can see a desire for the heads up
> (ufshcd_vops_full_reset+)ufshcd_vops_device_reset calls before
> ufshcd_host_reset_and_restore because that function will spin 10
> seconds waiting for a response from a standardized register, that
> itself could be hardware locked up requiring product specific reset
> procedures. But if that is the case, then what about all the other
> calls to ufshcd_host_reset_and_restore in this file that are not
> provided the heads up? My guess is that the host device only
> demonstrated issues in the ufshcd_link_recovery handling path? Are you
> sure this is the only path that tickles the controller into a hardware
> lockup state?
> 
> Sincerely -- Mark Salyzyn

Hi Mark Salyzyn,

Folding the "full_reset" vops inito "device_reset" vops is one choice 
for now. Shall do that.
Your guess is correct. the head up is needed in ufshcd_link_recovery() 
path because
link is already in bad state when we are here, expeically after hibern8 
exit fails.
So we need a full reset to PHY and host controller here before 
host_reset_and_restore.
But other calls to host_reset_and_restore are under good conditions.

Regards,
Can Guo.

  reply	other threads:[~2019-11-01  1:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1571804009-29787-1-git-send-email-cang@codeaurora.org>
2019-10-23  4:13 ` [PATCH v1 1/2] scsi: ufs: Introduce a vops for resetting host controller Can Guo
2019-10-23 10:39   ` [EXT] " Bean Huo (beanhuo)
2019-10-29  2:11     ` cang
2019-10-31 14:44   ` Mark Salyzyn
2019-11-01  1:18     ` cang [this message]
2019-11-04 14:28   ` Avri Altman
2019-11-04 14:34     ` [EXT] " Bean Huo (beanhuo)
2019-11-04 23:46       ` cang
2019-11-04 23:44     ` cang
2019-10-23  4:13 ` [PATCH v1 2/2] scsi: ufs-qcom: Add reset control support for " Can Guo

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=8b7e86d09cde1ea45c1ad979d88dc022@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=arnd@arndb.de \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nguyenb@codeaurora.org \
    --cc=pedrom.sousa@synopsys.com \
    --cc=rnayak@codeaurora.org \
    --cc=salyzyn@android.com \
    --cc=salyzyn@google.com \
    --cc=saravanak@google.com \
    --cc=stanley.chu@mediatek.com \
    --cc=subhashj@codeaurora.org \
    --cc=tomas.winkler@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).