scsi: ufs: core: Print UFSHCD capabilities in controller's sysfs node
Userspace may want to manually control when the data should go into WriteBooster buffer. The control happens via "wb_on" node, but presently, there is no simple way to check if WriteBooster is supported and enabled. Expose the Write Booster and Clock Scaling capabilities to be able to determine if the Write Booster is available and if its manual control is blocked by Clock Scaling mechanism. Link: https://lore.kernel.org/r/20220829081845.v8.1.Ibf9efc9be50783eeee55befa2270b7d38552354c@changeid Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Daniil Lunev <dlunev@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
9806d1b895
commit
2286ade07d
@ -1600,6 +1600,43 @@ Description: This entry shows the status of HPB.
|
||||
|
||||
The file is read only.
|
||||
|
||||
Contact: Daniil Lunev <dlunev@chromium.org>
|
||||
What: /sys/bus/platform/drivers/ufshcd/*/capabilities/
|
||||
What: /sys/bus/platform/devices/*.ufs/capabilities/
|
||||
Date: August 2022
|
||||
Description: The group represents the effective capabilities of the
|
||||
host-device pair. i.e. the capabilities which are enabled in the
|
||||
driver for the specific host controller, supported by the host
|
||||
controller and are supported and/or have compatible
|
||||
configuration on the device side.
|
||||
|
||||
Contact: Daniil Lunev <dlunev@chromium.org>
|
||||
What: /sys/bus/platform/drivers/ufshcd/*/capabilities/clock_scaling
|
||||
What: /sys/bus/platform/devices/*.ufs/capabilities/clock_scaling
|
||||
Date: August 2022
|
||||
Contact: Daniil Lunev <dlunev@chromium.org>
|
||||
Description: Indicates status of clock scaling.
|
||||
|
||||
== ============================
|
||||
0 Clock scaling is not supported.
|
||||
1 Clock scaling is supported.
|
||||
== ============================
|
||||
|
||||
The file is read only.
|
||||
|
||||
What: /sys/bus/platform/drivers/ufshcd/*/capabilities/write_booster
|
||||
What: /sys/bus/platform/devices/*.ufs/capabilities/write_booster
|
||||
Date: August 2022
|
||||
Contact: Daniil Lunev <dlunev@chromium.org>
|
||||
Description: Indicates status of Write Booster.
|
||||
|
||||
== ============================
|
||||
0 Write Booster can not be enabled.
|
||||
1 Write Booster can be enabled.
|
||||
== ============================
|
||||
|
||||
The file is read only.
|
||||
|
||||
What: /sys/class/scsi_device/*/device/hpb_param_sysfs/activation_thld
|
||||
Date: February 2021
|
||||
Contact: Avri Altman <avri.altman@wdc.com>
|
||||
|
@ -325,6 +325,40 @@ static const struct attribute_group ufs_sysfs_default_group = {
|
||||
.attrs = ufs_sysfs_ufshcd_attrs,
|
||||
};
|
||||
|
||||
static ssize_t clock_scaling_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct ufs_hba *hba = dev_get_drvdata(dev);
|
||||
|
||||
return sysfs_emit(buf, "%d\n", ufshcd_is_clkscaling_supported(hba));
|
||||
}
|
||||
|
||||
static ssize_t write_booster_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct ufs_hba *hba = dev_get_drvdata(dev);
|
||||
|
||||
return sysfs_emit(buf, "%d\n", ufshcd_is_wb_allowed(hba));
|
||||
}
|
||||
|
||||
static DEVICE_ATTR_RO(clock_scaling);
|
||||
static DEVICE_ATTR_RO(write_booster);
|
||||
|
||||
/*
|
||||
* See Documentation/ABI/testing/sysfs-driver-ufs for the semantics of this
|
||||
* group.
|
||||
*/
|
||||
static struct attribute *ufs_sysfs_capabilities_attrs[] = {
|
||||
&dev_attr_clock_scaling.attr,
|
||||
&dev_attr_write_booster.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct attribute_group ufs_sysfs_capabilities_group = {
|
||||
.name = "capabilities",
|
||||
.attrs = ufs_sysfs_capabilities_attrs,
|
||||
};
|
||||
|
||||
static ssize_t monitor_enable_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
@ -1180,6 +1214,7 @@ static const struct attribute_group ufs_sysfs_attributes_group = {
|
||||
|
||||
static const struct attribute_group *ufs_sysfs_groups[] = {
|
||||
&ufs_sysfs_default_group,
|
||||
&ufs_sysfs_capabilities_group,
|
||||
&ufs_sysfs_monitor_group,
|
||||
&ufs_sysfs_device_descriptor_group,
|
||||
&ufs_sysfs_interconnect_descriptor_group,
|
||||
|
Loading…
Reference in New Issue
Block a user