broken TRIM support for JMS578 in uas mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I cannot issue TRIM commands to SSD behind a JMS578-based sata to
usb-c adapter. Tried with Fedora 28 kernel and with latest
4.18.0-0.rc6.git0.1.vanilla.knurd.1.fc28.x86_64
lsblk -D shows that discard is not enabled, but the SSD has this
capability (see below)

However Windows 10 successfully TRIMs the device. Also the
trimcheck.exe tool validates the TRIM operation. This makes me think
the linux uas driver needs additional reverse engineering or support
from Jmicron about this chipset.

Steps to Reproduce:
[root@localhost ~]# blkdiscard -v /dev/sda

Actual results:
blkdiscard: /dev/sda: BLKDISCARD ioctl failed: Operation not supported

Expected results:
/dev/sda: Discarded 250059350016 bytes from the offset 0

Additional info:

I believe smartmontools website
[https://www.smartmontools.org/wiki/Supported_USB-Devices] incorrectly
lists this usb bridge as JMS567, because their firmware upgrade tool
identifies the device as 578, something that is suggested by the PID
(0x0578 and not 0x0567), and I've been able to successfully try out
several firmware versions available on usbdev.ru while the attempts
for 567 failed. Also smartmontools drivedb.h update suggests also this
is indeed a 578 https://www.smartmontools.org/ticket/841

---

[root@localhost ~]$ grep $ /sys/block/sda/queue/discard_*
/sys/block/sda/queue/discard_granularity:0
/sys/block/sda/queue/discard_max_bytes:0
/sys/block/sda/queue/discard_max_hw_bytes:0
/sys/block/sda/queue/discard_zeroes_data:0

---

[root@localhost ~]# lsblk -D /dev/sda
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda           0        0B       0B         0
└─sda1        0        0B       0B         0

---

dmesg:
[ 1842.832155] usb 2-2: new SuperSpeed USB device number 3 using xhci_hcd
[ 1842.845457] usb 2-2: New USB device found, idVendor=152d,
idProduct=0578, bcdDevice= 2.04
[ 1842.845461] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1842.845463] usb 2-2: Product: HDD USB Device
[ 1842.845464] usb 2-2: Manufacturer: JMicron
[ 1842.845466] usb 2-2: SerialNumber: 339AE81B6296382
[ 1842.851744] scsi host1: uas
[ 1842.852472] scsi 1:0:0:0: Direct-Access     sobetter Ext
  0204 PQ: 0 ANSI: 6
[ 1842.853765] sd 1:0:0:0: Attached scsi generic sg0 type 0
[ 1842.854104] sd 1:0:0:0: [sda] 488397168 512-byte logical blocks:
(250 GB/233 GiB)
[ 1842.854106] sd 1:0:0:0: [sda] 4096-byte physical blocks
[ 1842.854264] sd 1:0:0:0: [sda] Write Protect is off
[ 1842.854266] sd 1:0:0:0: [sda] Mode Sense: 53 00 00 08
[ 1842.854573] sd 1:0:0:0: [sda] Disabling FUA
[ 1842.854575] sd 1:0:0:0: [sda] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
[ 1842.865814]  sda: sda1
[ 1842.867420] sd 1:0:0:0: [sda] Attached SCSI disk

---

[root@localhost ~]# lsusb.py -e
[...]
 2-2             152d:0578 00  3.00 5000MBit/s 896mA 1IF  (JMicron HDD
USB Device 339AE81B6296382)
                   (EP) 00: Control  attr 00 len 07 max 200
---

[root@localhost ~]# lsusb -v -d 152d:0578

Bus 002 Device 003: ID 152d:0578 JMicron Technology Corp. / JMicron
USA Technology Corp. JMS567 SATA 6Gb/s bridge
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         9
  idVendor           0x152d JMicron Technology Corp. / JMicron USA
Technology Corp.
  idProduct          0x0578 JMS567 SATA 6Gb/s bridge
  bcdDevice            2.04
  iManufacturer           1 JMicron
  iProduct                2 HDD USB Device
  iSerial                 3 339AE81B6296382
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          121
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               7
        MaxStreams             32
        Data-out pipe (0x04)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000f0e
      BESL Link Power Management (LPM) Supported
    BESL value     3840 us
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat          32 micro seconds
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x000c
  (Bus Powered)
  U1 Enabled
  U2 Enabled

---

[asus@localhost ~]$ sudo sg_readcap -l /dev/sda
Read Capacity results:
   Protection: prot_en=0, p_type=0, p_i_exponent=0
   Logical block provisioning: lbpme=0, lbprz=0
   Last logical block address=488397167 (0x1d1c596f), Number of
logical blocks=488397168
   Logical block length=512 bytes
   Logical blocks per physical block exponent=3 [so physical block
length=4096 bytes]
   Lowest aligned logical block address=0
Hence:
   Device size: 250059350016 bytes, 238475.2 MiB, 250.06 GB

---

[asus@localhost ~]$ sudo sg_vpd -p thpv /dev/sda
abbreviation doesn't match a VPD page
Available standard VPD pages:
  ai         0x89      ATA information (SAT)
  aod        0x82      ASCII implemented operating definition (obsolete)
  adsn       0xb3      Automation device serial number (SSC)
  bl         0xb0      Block limits (SBC)
  ble        0xb7      Block limits extension (SBC)
  bdc        0xb1      Block device characteristics (SBC)
  bdce       0xb5      Block device characteristics extension (SBC)
  cfa        0x8c      CFA profile information
  dc         0x8b      Device constituents
  di         0x83      Device identification
  di_asis    0x83      Like 'di' but designators ordered as found
  di_lu      0x83      Device identification, lu only
  di_port    0x83      Device identification, target port only
  di_target  0x83      Device identification, target device only
  dtde       0xb4      Data transfer device element address (SSC)
  ei         0x86      Extended inquiry data
  iod        0x81      Implemented operating definition (obsolete)
  lbpro      0xb5      Logical block protection (SSC)
  lbpv       0xb2      Logical block provisioning (SBC)
  mas        0xb1      Manufacturer assigned serial number (SSC)
  masa       0xb1      Manufacturer assigned serial number (ADC)
  mna        0x85      Management network addresses
  mpp        0x87      Mode page policy
  oi         0xb0      OSD information
  pc         0x8a      Power condition
  psm        0x8d      Power consumption
  pslu       0x90      Protocol-specific logical unit information
  pspo       0x91      Protocol-specific port information
  ref        0xb3      Referrals (SBC)
  sad        0xb0      Sequential access device capabilities (SSC)
  sii        0x84      Software interface identification
  sinq       -1        Standard inquiry response
  sn         0x80      Unit serial number
  sp         0x88      SCSI ports
  st         0xb1      Security token (OSD)
  sbl        0xb4      Supported block lengths and protection types (SBC)
  sv         0x00      Supported VPD pages
  tas        0xb2      TapeAlert supported flags (SSC)
  tpc        0x8f      Third party copy
  zbdc       0xb6      Zoned block device characteristics

Vendor/product identifiers:
  dds        3      DDS tape family from IBM
  emc        2      EMC (company)
  hp3par     4      3PAR array (HP was Left Hand)
  ibm_lto    5      IBM LTO tape/systems
  hp_lto     6      HP LTO tape/systems
  rdac       1      RDAC array (NetApp E-Series)
  sea        0      Seagate disk

Vendor specific VPD pages:
  aci        0xc5,6      ACI revision level (HP LTO)
  datc       0xc1,0      Date code (Seagate)
  dcrl       0xc0,5      Drive component revision levels (IBM LTO)
  ddsver     0xc0,3      Firmware revision (DDS)
  devb       0xc3,0      Device behavior (Seagate)
  dsn        0xc1,5      Drive serial numbers (IBM LTO)
  ducd       0xc7,5      Device unique configuration data (IBM LTO)
  edid       0xc8,1      Extended device identification (RDAC)
  prm4       0xc3,1      Feature Parameters (RDAC)
  firm       0xc0,0      Firmware numbers (Seagate)
  frl        0xc0,6      Firmware revision level (HP LTO)
  fwr4       0xc1,1      Firmware version (RDAC)
  head       0xc4,6      Head Assy revision level (HP LTO)
  hp3par     0xc0,4      Volume information (HP/3PAR)
  hrl        0xc1,6      Hardware revision level (HP LTO)
  hwr4       0xc0,1      Hardware version (RDAC)
  jump       0xc2,0      Jump setting (Seagate)
  mech       0xc3,6      Mechanism revision level (HP LTO)
  mpds       0xc8,5      Mode parameter default settings (IBM LTO)
  pca        0xc2,6      PCA revision level (HP LTO)
  rvsi       0xca,1      Replicated volume source identifier (RDAC)
  said       0xd0,1      Storage array world wide name (RDAC)
  subs       0xc4,1      Subsystem identifier (RDAC)
  swr4       0xc2,1      Software version (RDAC)
  upr        0xc0,2      Unit path report (EMC)
  vac1       0xc9,1      Volume access control (RDAC)

---

[asus@localhost ~]$ sudo hdparm -I /dev/sda | grep -i trim
  * Data Set Management TRIM supported (limit 8 blocks)
  * Deterministic read ZEROs after TRIM
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux