Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Ziqi Chen <quic_ziqichen@quicinc.com>
To: "Peter Wang (王信友)" <peter.wang@mediatek.com>,
	"quic_rampraka@quicinc.com" <quic_rampraka@quicinc.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"quic_nitirawa@quicinc.com" <quic_nitirawa@quicinc.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"junwoo80.lee@samsung.com" <junwoo80.lee@samsung.com>,
	"mani@kernel.org" <mani@kernel.org>,
	"quic_cang@quicinc.com" <quic_cang@quicinc.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dlemoal@kernel.org" <dlemoal@kernel.org>,
	"ahalaney@redhat.com" <ahalaney@redhat.com>,
	"quic_mnaresh@quicinc.com" <quic_mnaresh@quicinc.com>,
	"hare@suse.de" <hare@suse.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"manivannan.sadhasivam@linaro.org"
	<manivannan.sadhasivam@linaro.org>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v2] scsi: ufs: core: Add ufshcd_send_bsg_uic_cmd() for UFS BSG
Date: Tue, 19 Nov 2024 16:52:21 +0800	[thread overview]
Message-ID: <eb9fd0fd-6701-478c-a697-9453d97d604e@quicinc.com> (raw)
In-Reply-To: <d3461ef552047db3e18cf3d222163ee685e13d9f.camel@mediatek.com>

Hi Peter,

Thank you for your comment. We also recognize that the H8 Enter/Exit has 
the same issue. In fact, we have tried to add the H8 command before. 
Unfortunately, the situation with Hibern8 is complex, there are a lot of 
status checks, and some vendors have their own sequence that is 
implemented in their vendor driver by Vops. Simply including the H8 
command here would cause other issues since the vendor sequence for H8 
enter/exit is required. If we add the full sequence here, the code will 
be bloated. We haven’t come up with a good solution for the Hibern8 
situation yet. However, whether we include the H8 command or not, the 
above issue is present as well (directly call ufshcd_send_uic_cmd() via 
BSG framework).
Right now, we have tested the PA_PWRMODE case and confirmed that it 
works, so we want to quickly resolve the PA_PWRMODE issue to unblock our 
customers’ urgent cases first. As for the Hibern8 situation, we have 
plan to fix it but we want to fix it afterward, in a separated change. 
If you have any good suggestions, we can discuss separately.

BRs,
Ziqi

On 11/19/2024 2:40 PM, Peter Wang (王信友) wrote:
> On Wed, 2024-11-13 at 19:14 +0800, Ziqi Chen wrote:
> 
>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index e338867bc96c..c01f4b0c1b4f 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -4319,6 +4319,42 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba
>> *hba, struct uic_command *cmd)
>>          return ret;
>>   }
>>
>> +/**
>> + * ufshcd_send_bsg_uic_cmd - Send UIC commands requested via BSG
>> layer and retrieve the result
>> + * @hba: per adapter instance
>> + * @uic_cmd: UIC command
>> + *
>> + * Return: 0 only if success.
>> + */
>> +int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command
>> *uic_cmd)
>> +{
>> +       int ret;
>> +
>> +       if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
>> +               return 0;
>> +
>> +       ufshcd_hold(hba);
>> +
>> +       if (uic_cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE) &&
>> +           uic_cmd->command == UIC_CMD_DME_SET) {
>>
> 
> Hi Ziqi,
> 
> Should we also check if uic_cmd->command == UIC_CMD_DME_HIBER_ENTER
> or UIC_CMD_DME_HIBER_EXIT?
> 
> Thanks
> Peter
> 
> 
> 
>> +               ret = ufshcd_uic_pwr_ctrl(hba, uic_cmd);
>> +               goto out;
>> +       }
>> +
>> +       mutex_lock(&hba->uic_cmd_mutex);
>> +       ufshcd_add_delay_before_dme_cmd(hba);
>> +
>> +       ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
>> +       if (!ret)
>> +               ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
>> +
>> +       mutex_unlock(&hba->uic_cmd_mutex);
>> +
>> +out:
>> +       ufshcd_release(hba);
>> +       return ret;
>> +}
>> +
>>   /**
>>    * ufshcd_uic_change_pwr_mode - Perform the UIC power mode chage
>>    *                             using DME_SET primitives.
>> --
>> 2.34.1
>>

  reply	other threads:[~2024-11-19  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 11:14 [PATCH v2] scsi: ufs: core: Add ufshcd_send_bsg_uic_cmd() for UFS BSG Ziqi Chen
2024-11-13 18:21 ` Bean Huo
2024-11-19  6:02 ` Avri Altman
2024-11-19  6:11   ` Ziqi Chen
2024-11-19  6:40 ` Peter Wang (王信友)
2024-11-19  8:52   ` Ziqi Chen [this message]
2024-11-19  9:22     ` Peter Wang (王信友)

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=eb9fd0fd-6701-478c-a697-9453d97d604e@quicinc.com \
    --to=quic_ziqichen@quicinc.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=ahalaney@redhat.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=junwoo80.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_mnaresh@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_rampraka@quicinc.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