Re: [PATCH v4] ufs: sysfs: Add WB partial flush mode support
From: Bart Van Assche
Date: Tue Nov 24 2026 - 13:30:40 EST
On 11/16/26 4:47 PM, Daniel Lee wrote:
> Introduce UFS_ATTRIBUTE_RW and UFS_FLAG_RW to support writable attributes
> and flags.
Thank you for having addressed my v3 comments. Please split this patch
into a series: (1) convert the UFS_FLAG() / UFS_ATTRIBUTE() bodies into
helper functions without changing behavior, (2) introduce
UFS_ATTRIBUTE_RW() and UFS_FLAG_RW() and (3) add the partial flush mode
attributes and flag.
That will make both reviewing and bisecting easier.
> + ufshcd_rpm_put_sync(hba);
> + if (ret > 0)
> + ret = -EINVAL;
> + if (ret)
> + goto out;
This changes the error code reported to user space for all existing
flag and attribute sysfs entries: negative error codes are now passed
through instead of being converted into -EINVAL. I'm fine with this
change but please move it into a separate patch and explain it in the
patch description.
> +static bool ufshcd_is_wb_pinned_pfm_supported(struct ufs_hba *hba)
> +{
> + return ufshcd_is_wb_allowed(hba) &&
> + hba->dev_info.b_presrv_uspc_en &&
> + (hba->dev_info.ext_wb_sup & UFS_DEV_WB_PINNED_PFM);
> +}
Why does pinned mode require bWriteBoosterBufferPreserveUserSpaceEn
while FIFO mode doesn't? Please add a comment that refers to the
relevant section of JESD220G.
> +/* Possible values for bWriteBoosterBufferPartialFlushMode */
> +enum wb_partial_flush_mode {
> + WB_PARTIAL_FLUSH_NONE = 0,
> + WB_PARTIAL_FLUSH_FIFO = 1,
> + WB_PARTIAL_FLUSH_PINNED = 2,
> + NUM_WB_PARTIAL_FLUSH_MODES = 3,
> };
Please leave NUM_WB_PARTIAL_FLUSH_MODES out of this enum since the
enum documents values defined by the UFS standard. Using
ARRAY_SIZE(wb_partial_flush_modes) in ufs-sysfs.c instead should be
sufficient.
> + mode = sysfs_match_string(wb_partial_flush_modes, buf);
> + if (mode < 0)
> + return -EINVAL;
> +
> + switch (mode) {
[ ... ]
> + default:
> + return -EINVAL;
> + }
The default case is unreachable because sysfs_match_string() only
returns valid indexes into wb_partial_flush_modes[].
> + Buffer.
> + The attribute is read only.
Please use "read-only" consistently in the new ABI entries.
Thanks,
Bart.