usb: uas: expose US_FL_NO_ATA_1X in sysfs as ata_passthrough_disabled
Subsystems (4)
PATCH 1/2 usb: uas: expose US_FL_NO_ATA_1X in sysfs as ata_passthrough_disabled
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy. However, it does not expose any meaningful information whether the command was disabled by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message.
---
v2:
- rename the attribute to ata_passthrough_disabled (to match others),
- add a proper documentation,
- add the ABI documentation for scsi to MAINTAINERS as appropriate,
- add a second patch to expose the information also for the usb-storage driver,
--- .../ABI/testing/sysfs-class-scsi_device | 10 ++++++++++ MAINTAINERS | 1 + drivers/usb/storage/uas.c | 20 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-scsi_device
Documentation/ABI/testing/sysfs-class-scsi_device new file +10 -0
@@ -0,0 +1,10 @@ +What: /sys/class/scsi_device/*/device/ata_passthrough_disabled +Date: Nov, 2026 +KernelVersion: v7.5 +Contact: [email protected] +Description: (RO) Indicates whether the driver blocks access from userspace + to ATA passthrough commands. Contains a value of '1' when such + commands are denied as the hardware is considered buggy and they + might interfere with a correct operation of the drive. Note that + a value of '0' does not necessarily mean that ATA passthrough is + available as it may not be supported by the hardware at all.
MAINTAINERS +1 -0
@@ -25293,6 +25293,7 @@ S: Maintained Q: https://patchwork.kernel.org/project/linux-scsi/list/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git +F: Documentation/ABI/testing/sysfs-class-scsi_* F: Documentation/devicetree/bindings/scsi/ F: drivers/scsi/ F: drivers/ufs/
drivers/usb/storage/uas.c +20 -0
@@ -910,6 +910,25 @@ static int uas_sdev_configure(struct scsi_device *sdev,return 0 ; } +/* Sysfs interface */ +static ssize_t ata_passthrough_disabled_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct scsi_device *sdev =to_scsi_device (dev); +struct uas_dev_info *devinfo = sdev->hostdata; + +return sysfs_emit (buf,"%d\n" , !!(devinfo->flags &US_FL_NO_ATA_1X )); +} + +static DEVICE_ATTR_RO (ata_passthrough_disabled); + +static struct attribute *uas_sdev_attrs[] = { + &dev_attr_ata_passthrough_disabled.attr, +NULL , +}; + +ATTRIBUTE_GROUPS (uas_sdev); +static const struct scsi_host_template uas_host_template = { .module =THIS_MODULE , .name ="uas" ,
@@ -929,6 +948,7 @@ static const struct scsi_host_template uas_host_template = { .dma_alignment = 511, .dma_boundary = PAGE_SIZE - 1, .cmd_size = sizeof(struct uas_cmd_info), + .sdev_groups = uas_sdev_groups, }; #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
Signature · 1 line
2.47.3
PATCH 2/2 usb: mass storage: expose ata_passthrough_disabled in sysfs
The mass storage driver blocks access to ATA passthrough commands for some devices it considers buggy. As in the case of the uas driver, indicate this in sysfs.
---
v2:
- add this patch to the series
--- drivers/usb/storage/scsiglue.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/storage/scsiglue.c +13 -0
@@ -572,6 +572,18 @@ US_DO_ALL_FLAGS* Sysfs interface ***********************************************************************/ +/* Output routine for the sysfs ata_passthrough_disabled file */ +static ssize_t ata_passthrough_disabled_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct scsi_device *sdev =to_scsi_device (dev); +struct us_data *us =host_to_us (sdev->host); + +return sysfs_emit (buf,"%d\n" , !!(us->fflags &US_FL_NO_ATA_1X )); +} + +static DEVICE_ATTR_RO (ata_passthrough_disabled); +/* Output routine for the sysfs max_sectors file */ static ssize_t max_sectors_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -602,6 +614,7 @@ static ssize_t max_sectors_store(struct device *dev, struct device_attribute *atstatic DEVICE_ATTR_RW (max_sectors);static struct attribute *usb_sdev_attrs[] = { + &dev_attr_ata_passthrough_disabled.attr, &dev_attr_max_sectors.attr,NULL , };
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this 2-patch series and found no issues.
Sashiko has reviewed this 2-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]
Oliver Neukum
maintainerQuoted 6 lines · Mateusz Jończyk
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy. However, it does not expose any meaningful information whether the command was disabled by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message.
Hi,
thank you for handling this. One thing though. This requires putting the emit code into every driver. Can we centralize that somehow?
Regards
Oliver
W dniu 23.11.2026 o 09:27, Oliver Neukum pisze:
Quoted 11 lines · Mateusz Jończyk
Quoted 6 lines
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy. However, it does not expose any meaningful information whether the command was disabled by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message.
Hi,
thank you for handling this. One thing though. This requires putting the emit code into every driver. Can we centralize that somehow?
Not really, short of moving the handling of the ata_passthrough_disabled attribute into the middle SCSI layer (which would also likely involve moving the whole of US_FL_NO_ATA_1X logic from uas_queuecommand_lck() there). Is this what you mean?
This attribute is really specific to the USB drivers, but it lives in different fields in the UAS and mass storage drivers.
Greetings,
Mateusz
Oliver Neukum
maintainerQuoted 9 lines · Mateusz Jończyk
W dniu 23.11.2026 o 09:27, Oliver Neukum pisze:
Quoted 2 lines
thank you for handling this. One thing though. This requires putting the emit code into every driver. Can we centralize that somehow?
Not really, short of moving the handling of the
ata_passthrough_disabledattribute into the middle SCSI layer (which would also likely involve moving the whole ofUS_FL_NO_ATA_1Xlogic fromuas_queuecommand_lck()there). Is this what you mean?
Now that you mention it, shouldn't that be where it ought to be anyway? Usually the SCSI layer generates or filters commands, while the LLDD determine what command sets a device will accept and reports that.
Regards
Oliver
W dniu 23.11.2026 o 12:41, Oliver Neukum pisze:
Quoted 8 lines · Mateusz Jończyk
Quoted 5 lines
W dniu 23.11.2026 o 09:27, Oliver Neukum pisze:
> thank you for handling this. One thing though. This requires putting > the emit code into every driver. Can we centralize that somehow?
Quoted 9 lines
Quoted 4 lines
Not really, short of moving the handling of the
ata_passthrough_disabledattribute into the middle SCSI layer (which would also likely involve moving the whole ofUS_FL_NO_ATA_1Xlogic fromuas_queuecommand_lck()there). Is this what you mean?Now that you mention it, shouldn't that be where it ought to be anyway? Usually the SCSI layer generates or filters commands, while the LLDD determine what command sets a device will accept and reports that.
OK, I will prepare a patch series as appropriate and report back.
Greetings,
Mateusz
Quoted 9 lines · Mateusz Jończyk
The uas driver blocks access to ATA passthrough commands for some devices it considers buggy. However, it does not expose any meaningful information whether the command was disabled by the driver or is genuinly not supported by the hardware. This creates a problem for the smartmontools program and makes it difficult for it to provide a useful error message.
[...]
Quoted 6 lines
Documentation/ABI/testing/sysfs-class-scsi_device new file +0
-0
Documentation/ABI/testing/sysfs-class-scsi_device line 10
Quoted 10 lines
Documentation/ABI/testing/sysfs-class-scsi_device new file +10
-0@@ -0,0 +1,10 @@ +What: /sys/class/scsi_device/*/device/ata_passthrough_disabled +Date: Nov, 2026 +KernelVersion: v7.5 +Contact: [email protected] +Description: (RO) Indicates whether the driver blocks access from userspace + to ATA passthrough commands. Contains a value of '1' when such + commands are denied as the hardware is considered buggy and they + might interfere with a correct operation of the drive. Note that + a value of '0' does not necessarily mean that ATA passthrough is + available as it may not be supported by the hardware at all.
Would it make sense to explicitly mention something about "USB quirk flag US_FL_NO_ATA_1X" in this documentation entry?
Nathan