linux-imx/Documentation/ABI/testing/sysfs-block-device
Damien Le Moal 1b22cfb141 scsi: core: Allow enabling and disabling command duration limits
Add the sysfs scsi_device attribute cdl_enable to allow a user to enable or
disable a device command duration limits feature. CDL is disabled by
default. This feature must be explicitly enabled by a user by setting the
cdl_enable attribute to 1.

The new function scsi_cdl_enable() does not do anything beside setting the
cdl_enable field of struct scsi_device in the case of a (real) SCSI device
(e.g. a SAS HDD). For ATA devices, the command duration limits feature
needs to be enabled/disabled using the ATA feature sub-page of the control
mode page. To do so, the scsi_cdl_enable() function checks if this mode
page is supported using scsi_mode_sense(). If it is, scsi_mode_select() is
used to enable and disable CDL.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Co-developed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20230511011356.227789-10-nks@flawful.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-05-22 17:05:19 -04:00

4.1 KiB

What: /sys/block/*/device/sw_activity Date: Jun, 2008 KernelVersion: v2.6.27 Contact: linux-ide@vger.kernel.org Description: (RW) Used by drivers which support software controlled activity LEDs.

	It has the following valid values:

	==	========================================================
	0	OFF - the LED is not activated on activity
	1	BLINK_ON - the LED blinks on every 10ms when activity is
		detected.
	2	BLINK_OFF - the LED is on when idle, and blinks off
		every 10ms when activity is detected.
	==	========================================================

	Note that the user must turn sw_activity OFF it they wish to
	control the activity LED via the em_message file.

What: /sys/block/*/device/unload_heads Date: Sep, 2008 KernelVersion: v2.6.28 Contact: linux-ide@vger.kernel.org Description: (RW) Hard disk shock protection

	Writing an integer value to this file will take the heads of the
	respective drive off the platter and block all I/O operations
	for the specified number of milliseconds.

	- If the device does not support the unload heads feature,
	  access is denied with -EOPNOTSUPP.
	- The maximal value accepted for a timeout is 30000
	  milliseconds.
	- A previously set timeout can be cancelled and disk can resume
	  normal operation immediately by specifying a timeout of 0.
	- Some hard drives only comply with an earlier version of the
	  ATA standard, but support the unload feature nonetheless.
	  There is no safe way Linux can detect these devices, so this
	  is not enabled by default. If it is known that your device
	  does support the unload feature, then you can tell the kernel
	  to enable it by writing -1. It can be disabled again by
	  writing -2.
	- Values below -2 are rejected with -EINVAL

	For more information, see
	Documentation/admin-guide/laptops/disk-shock-protection.rst

What: /sys/block/*/device/ncq_prio_enable Date: Oct, 2016 KernelVersion: v4.10 Contact: linux-ide@vger.kernel.org Description: (RW) Write to the file to turn on or off the SATA NCQ (native command queueing) priority support. By default this feature is turned off. If the device does not support the SATA NCQ priority feature, writing "1" to this file results in an error (see ncq_prio_supported).

What: /sys/block/*/device/sas_ncq_prio_enable Date: Oct, 2016 KernelVersion: v4.10 Contact: linux-ide@vger.kernel.org Description: (RW) This is the equivalent of the ncq_prio_enable attribute file for SATA devices connected to a SAS host-bus-adapter (HBA) implementing support for the SATA NCQ priority feature. This file does not exist if the HBA driver does not implement support for the SATA NCQ priority feature, regardless of the device support for this feature (see sas_ncq_prio_supported).

What: /sys/block/*/device/ncq_prio_supported Date: Aug, 2021 KernelVersion: v5.15 Contact: linux-ide@vger.kernel.org Description: (RO) Indicates if the device supports the SATA NCQ (native command queueing) priority feature.

What: /sys/block/*/device/sas_ncq_prio_supported Date: Aug, 2021 KernelVersion: v5.15 Contact: linux-ide@vger.kernel.org Description: (RO) This is the equivalent of the ncq_prio_supported attribute file for SATA devices connected to a SAS host-bus-adapter (HBA) implementing support for the SATA NCQ priority feature. This file does not exist if the HBA driver does not implement support for the SATA NCQ priority feature, regardless of the device support for this feature.

What: /sys/block/*/device/cdl_supported Date: May, 2023 KernelVersion: v6.5 Contact: linux-scsi@vger.kernel.org Description: (RO) Indicates if the device supports the command duration limits feature found in some ATA and SCSI devices.

What: /sys/block/*/device/cdl_enable Date: May, 2023 KernelVersion: v6.5 Contact: linux-scsi@vger.kernel.org Description: (RW) For a device supporting the command duration limits feature, write to the file to turn on or off the feature. By default this feature is turned off. Writing "1" to this file enables the use of command duration limits for read and write commands in the kernel and turns on the feature on the device. Writing "0" disables the feature.