Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "quic_rampraka@quicinc.com" <quic_rampraka@quicinc.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"quic_ziqichen@quicinc.com" <quic_ziqichen@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 06:40:45 +0000	[thread overview]
Message-ID: <d3461ef552047db3e18cf3d222163ee685e13d9f.camel@mediatek.com> (raw)
In-Reply-To: <20241113111409.935032-1-quic_ziqichen@quicinc.com>

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
> 

  parent reply	other threads:[~2024-11-19  6:40 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 (王信友) [this message]
2024-11-19  8:52   ` Ziqi Chen
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=d3461ef552047db3e18cf3d222163ee685e13d9f.camel@mediatek.com \
    --to=peter.wang@mediatek.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=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 \
    --cc=quic_ziqichen@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