Re: [PATCH v10] ufs: core: Add WB buffer resize support

From: Bart Van Assche
Date: Wed Apr 09 2025 - 17:18:16 EST


On 4/7/25 2:09 AM, Huan Tang wrote:
+What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/ext_wb_sup
+What: /sys/bus/platform/devices/*.ufs/device_descriptor/ext_wb_sup
+Date: April 2025
+Contact: Huan Tang <tanghuan@xxxxxxxx>
+Description:
+ This file shows extended WriteBooster features supported by
+ the device.
+
+ The file is read only.

Please remove this attribute again. I don't think that it is useful to
make the value of wExtendedWriteBoosterSupport available in sysfs.
Additionally, wExtendedWriteBoosterSupport is a bitfield and hence
exporting it directly violates the sysfs one-value-per-attribute rule.

+What: /sys/bus/platform/drivers/ufshcd/*/attributes/wb_resize_status
+What: /sys/bus/platform/devices/*.ufs/attributes/wb_resize_status
+Date: April 2025
+Contact: Huan Tang <tanghuan@xxxxxxxx>
+Description:
+ The host can check the resize operation status of the WriteBooster
+ buffer by reading this attribute.
+
+ ================ ========================================
+ idle Resize operation is not issued
+ in_progress Resize operation in progress
+ complete_success Resize operation completed successfully
+ general_fail Resize operation general failure
+ ================ ========================================

Why "general_fail" instead of "general_failure"?

+static const char * const wb_resize_en_mode[] = {
+ [WB_RESIZE_EN_IDLE] = "idle",
+ [WB_RESIZE_EN_DECREASE] = "decrease",
+ [WB_RESIZE_EN_INCREASE] = "increase",
+};

A minor comment: please remove one tab in front of "=" for the value
assignments in the above array definition.

+static ssize_t wb_resize_hint_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+ int ret;
+ u32 value;
+
+ ret = wb_read_resize_attrs(hba,
+ QUERY_ATTR_IDN_WB_BUF_RESIZE_HINT, &value);
+ if (ret)
+ goto out;
+
+ ret = sysfs_emit(buf, "%s\n", ufs_wb_resize_hint_to_string(value));
+
+out:
+ return ret;
+}

The formatting of the above code is not compliant with the Linux kernel coding style guide. Please reformat this patch, e.g. with "git clang-format HEAD^".

Otherwise this patch looks good to me.

Thanks,

Bart.