lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tjkfcmbdjsr5jieqjhxe57w4uhhpzqiwdidlenr3ytaifyijyc@ddocvrk6357q>
Date: Tue, 20 Jan 2026 18:59:12 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Ram Kumar Dwivedi <ram.dwivedi@....qualcomm.com>
Cc: alim.akhtar@...sung.com, avri.altman@....com, bvanassche@....org, 
	robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org, 
	James.Bottomley@...senpartnership.com, martin.petersen@...cle.com, linux-arm-msm@...r.kernel.org, 
	linux-scsi@...r.kernel.org, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V5 3/4] scsi: ufs: core Enforce minimum pm level for
 sysfs configuration

On Tue, Jan 13, 2026 at 01:30:45PM +0530, Ram Kumar Dwivedi wrote:
> Some UFS platforms only support a limited subset of power levels.
> Currently, the sysfs interface allows users to set any pm level
> without validating the minimum supported value. If an unsupported
> level is selected, suspend may fail.
> 
> Introduce an pm_lvl_min field in the ufs_hba structure and use it
> to clamp the pm level requested via sysfs so that only supported
> levels are accepted. Platforms that require a minimum pm level
> can set this field during probe.
> 
> Signed-off-by: Ram Kumar Dwivedi <ram.dwivedi@....qualcomm.com>

Reviewed-by: Manivannan Sadhasivam <mani@...nel.org>

- Mani

> ---
>  drivers/ufs/core/ufs-sysfs.c | 2 +-
>  include/ufs/ufshcd.h         | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
> index b33f8656edb5..02e5468ad49d 100644
> --- a/drivers/ufs/core/ufs-sysfs.c
> +++ b/drivers/ufs/core/ufs-sysfs.c
> @@ -141,7 +141,7 @@ static inline ssize_t ufs_sysfs_pm_lvl_store(struct device *dev,
>  	if (kstrtoul(buf, 0, &value))
>  		return -EINVAL;
>  
> -	if (value >= UFS_PM_LVL_MAX)
> +	if (value >= UFS_PM_LVL_MAX || value < hba->pm_lvl_min)
>  		return -EINVAL;
>  
>  	if (ufs_pm_lvl_states[value].dev_state == UFS_DEEPSLEEP_PWR_MODE &&
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 19154228780b..a64c19563b03 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -834,6 +834,7 @@ enum ufshcd_mcq_opr {
>   * @uic_link_state: active state of the link to the UFS device.
>   * @rpm_lvl: desired UFS power management level during runtime PM.
>   * @spm_lvl: desired UFS power management level during system PM.
> + * @pm_lvl_min: minimum supported power management level.
>   * @pm_op_in_progress: whether or not a PM operation is in progress.
>   * @ahit: value of Auto-Hibernate Idle Timer register.
>   * @outstanding_tasks: Bits representing outstanding task requests
> @@ -972,6 +973,7 @@ struct ufs_hba {
>  	enum ufs_pm_level rpm_lvl;
>  	/* Desired UFS power management level during system PM */
>  	enum ufs_pm_level spm_lvl;
> +	enum ufs_pm_level pm_lvl_min;
>  	int pm_op_in_progress;
>  
>  	/* Auto-Hibernate Idle Timer register value */
> -- 
> 2.34.1
> 

-- 
மணிவண்ணன் சதாசிவம்

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ