diff mbox series

[v2] ufs: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd

Message ID 20250414120257.247858-1-arthur.simchaev@sandisk.com
State New
Headers show
Series [v2] ufs: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd | expand

Commit Message

Arthur Simchaev April 14, 2025, 12:02 p.m. UTC
This patch adds functionality to allow user-level applications to send
the Hibern8 Enter command via the BSG framework. With this feature,
applications can perform H8 stress tests. Also can be used as one
of the triggers for the Eye monitor measurement feature added to the
M-PHY v5 specification.
For completion, allow the sibling functionality of hibern8 exit as well.

Signed-off-by: Arthur Simchaev <arthur.simchaev@sandisk.com>

---
Changed since v1:
 - elaborate commit log
---
 drivers/ufs/core/ufshcd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

kernel test robot April 15, 2025, 1:54 p.m. UTC | #1
Hi Arthur,

kernel test robot noticed the following build errors:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.15-rc2 next-20250415]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arthur-Simchaev/ufs-bsg-Add-hibern8-enter-exit-to-ufshcd_send_bsg_uic_cmd/20250414-200404
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20250414120257.247858-1-arthur.simchaev%40sandisk.com
patch subject: [PATCH v2] ufs: bsg: Add hibern8 enter/exit to ufshcd_send_bsg_uic_cmd
config: s390-randconfig-002-20250415 (https://download.01.org/0day-ci/archive/20250415/202504152111.1Huykiqb-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250415/202504152111.1Huykiqb-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504152111.1Huykiqb-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/ufs/core/ufshcd.c: In function 'ufshcd_send_bsg_uic_cmd':
>> drivers/ufs/core/ufshcd.c:4360:9: error: too many arguments to function 'ufshcd_uic_hibern8_exit'
      ret = ufshcd_uic_hibern8_exit(hba, uic_cmd);
            ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/ufs/core/ufshcd-priv.h:7:0,
                    from drivers/ufs/core/ufshcd.c:31:
   include/ufs/ufshcd.h:1331:5: note: declared here
    int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);
        ^~~~~~~~~~~~~~~~~~~~~~~


vim +/ufshcd_uic_hibern8_exit +4360 drivers/ufs/core/ufshcd.c

  4331	
  4332	/**
  4333	 * ufshcd_send_bsg_uic_cmd - Send UIC commands requested via BSG layer and retrieve the result
  4334	 * @hba: per adapter instance
  4335	 * @uic_cmd: UIC command
  4336	 *
  4337	 * Return: 0 only if success.
  4338	 */
  4339	int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
  4340	{
  4341		int ret;
  4342	
  4343		if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
  4344			return 0;
  4345	
  4346		ufshcd_hold(hba);
  4347	
  4348		if (uic_cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE) &&
  4349		    uic_cmd->command == UIC_CMD_DME_SET) {
  4350			ret = ufshcd_uic_pwr_ctrl(hba, uic_cmd);
  4351			goto out;
  4352		}
  4353	
  4354		if (uic_cmd->command == UIC_CMD_DME_HIBER_ENTER) {
  4355			ret = ufshcd_uic_hibern8_enter(hba);
  4356			goto out;
  4357		}
  4358	
  4359		if (uic_cmd->command == UIC_CMD_DME_HIBER_EXIT) {
> 4360			ret = ufshcd_uic_hibern8_exit(hba, uic_cmd);
  4361			goto out;
  4362		}
  4363	
  4364		mutex_lock(&hba->uic_cmd_mutex);
  4365		ufshcd_add_delay_before_dme_cmd(hba);
  4366	
  4367		ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
  4368		if (!ret)
  4369			ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
  4370	
  4371		mutex_unlock(&hba->uic_cmd_mutex);
  4372	
  4373	out:
  4374		ufshcd_release(hba);
  4375		return ret;
  4376	}
  4377
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index be65fc4b5ccd..536b54ccc860 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4363,6 +4363,16 @@  int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 		goto out;
 	}
 
+	if (uic_cmd->command == UIC_CMD_DME_HIBER_ENTER) {
+		ret = ufshcd_uic_hibern8_enter(hba);
+		goto out;
+	}
+
+	if (uic_cmd->command == UIC_CMD_DME_HIBER_EXIT) {
+		ret = ufshcd_uic_hibern8_exit(hba, uic_cmd);
+		goto out;
+	}
+
 	mutex_lock(&hba->uic_cmd_mutex);
 	ufshcd_add_delay_before_dme_cmd(hba);