# LSI SAS 9207-8i SGL Internal HBA Disk Controller = no TRIM?

## BobWya

Hi folks,

I recently upgraded my aging X58 motherboard with an LSI SAS/SATA HBA Controller (speed bump from 3G from the built-in Intel SATA controller to 6G).

It shows up as:

```
05:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2308 PCI-Express Fusion-MPT SAS-2 (rev 05)

        Subsystem: LSI Logic / Symbios Logic Device 3020

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+

        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 0, Cache Line Size: 256 bytes

        Interrupt: pin A routed to IRQ 26

        Region 0: I/O ports at c000 [size=256]

        Region 1: Memory at fbcf0000 (64-bit, non-prefetchable) [size=64K]

        Region 3: Memory at fbc80000 (64-bit, non-prefetchable) [size=256K]

        Expansion ROM at fbb00000 [disabled] [size=1M]

        Capabilities: [50] Power Management version 3

                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)

                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-

        Capabilities: [68] Express (v2) Endpoint, MSI 00

                DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us

                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+

                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+

                        RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+ FLReset-

                        MaxPayload 128 bytes, MaxReadReq 512 bytes

                DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-

                LnkCap: Port #0, Speed 8GT/s, Width x8, ASPM L0s, Exit Latency L0s <64ns, L1 <1us

                        ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+

                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+

                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-

                LnkSta: Speed 5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-

                DevCap2: Completion Timeout: Range BC, TimeoutDis+, LTR-, OBFF Not Supported

                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled

                LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-

                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-

                         Compliance De-emphasis: -6dB

                LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-

                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-

        Capabilities: [d0] Vital Product Data

                Unknown small resource type 00, will not decode more.

        Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+

                Address: 0000000000000000  Data: 0000

        Capabilities: [c0] MSI-X: Enable+ Count=16 Masked-

                Vector table: BAR=1 offset=0000e000

                PBA: BAR=1 offset=0000f000

        Capabilities: [100 v2] Advanced Error Reporting

                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-

                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-

                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-

                CESta:  RxErr+ BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-

                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+

                AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-

        Capabilities: [1e0 v1] #19

        Capabilities: [1c0 v1] Power Budgeting <?>

        Capabilities: [190 v1] #16

        Capabilities: [148 v1] Alternative Routing-ID Interpretation (ARI)

                ARICap: MFVC- ACS-, Next Function: 0

                ARICtl: MFVC- ACS-, Function Group: 0

        Kernel driver in use: mpt2sas

        Kernel modules: mpt2sas

```

```
lsmod | egrep "(ata|scsi|sas)"

mvsas                  60272  0 

libsas                 72372  1 mvsas

libata                181518  3 ahci,libahci,libsas

mpt2sas               155413  18 

raid_class             12788  1 mpt2sas

scsi_transport_sas     33468  3 mvsas,mpt2sas,libsas

scsi_mod              147543  8 scsi_transport_sas,mvsas,mpt2sas,libata,libsas,sd_mod,sr_mod,raid_class
```

I did some tests. All my Linux distros boot (Arch, Gentoo, SUSE Tumbleweed). Disk speed is substantially improved for my Samsung 830 SSDs (max read from ~270Mb/s to >500Mb/s).

The Samsung 830 SSDs I have (all 256Mb models) are up to date on the latest firmware:

```
=== START OF INFORMATION SECTION ===

Model Family:     Samsung based SSDs

Device Model:     SAMSUNG SSD 830 Series

Serial Number:    S0WKNEAC300626

LU WWN Device Id: 5 002538 043584d30

Firmware Version: CXM03B1Q

User Capacity:    256,060,514,304 bytes [256 GB]

Sector Size:      512 bytes logical/physical

Rotation Rate:    Solid State Device

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   ACS-2 T13/2015-D revision 2

SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)

Local Time is:    Tue Dec 30 22:40:51 2014 GMT

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

```

Then I noticed that my discard flag (for my ext4 partitions) was being flagged as error during boot. This was the same regardless of (the Linux) distro.

Manually trying to TRIM my root FS (ext4) results in...

```
fstrim -v /

fstrim: /: the discard operation is not supported
```

Trim works fine with the built-in Marvel and Intel SATA Host Controller cards. The Samsung SSD's are being used as individual drives (no LVM, or RAID).

This is very annoying since, in all other respects it's a great card (e.g. suspend/resume support is perfect)... I thought TRIM pass through for SATA SSD's would be a given for a modern, 200.00 GBP PCIe 3.0 card that advertises Windows, Linux and BSD support. I even checked with Allan Jude (who co-presents the BSD Now! podcast) that this card was decent buy before crippling my wallet.   :Mad: 

At present it looks like I'll end up having to pop the SSD's out of their hot-swap bays and hook them up to the Intel controller to TRIM them. Anyone got a better idea or suggestion?   :Crying or Very sad: 

Thanks

Bob

----------

## s4e8

ahci and mvsas(libsas based) expose sata protocol to kernel, but mpt2sas expose sas/scsi protocol to kernel. So the TRIM/DISCARD (scsi UNMAP, WRITE_SAME) functionality need to handled by HBA firmware. You need to upgrade firmware to support it.

----------

## BobWya

@s4e8

The Firmware updating utility - despite being impressive (I could flash the LSI HBA device straight from Linux, from a KDE graphical environment, with my root FS partition on a SSD connected directly to the LSI 9207-8i HBA!!) - sadly still did not resolve the issue. The latest 9207-8i MPTFW-20.00.00.00-IT Firmware still does not get me TRIM support.

I've started a Support Ticket with LSI as a result.

Thanks for the suggestion anyway. At least I've discovered the neat Management Utility LSI produces...   :Cool: 

Bob

----------

## s4e8

 *BobWya wrote:*   

> @s4e8
> 
> The Firmware updating utility - despite being impressive (I could flash the LSI HBA device straight from Linux, from a KDE graphical environment, with my root FS partition on a SSD connected directly to the LSI 9207-8i HBA!!) - sadly still did not resolve the issue. The latest 9207-8i MPTFW-20.00.00.00-IT Firmware still does not get me TRIM support.
> 
> I've started a Support Ticket with LSI as a result.
> ...

 

LSI firmware require SSD supports deterministic read after trim (read zero). 

http://comments.gmane.org/gmane.linux.scsi/88189

----------

## BobWya

 *s4e8 wrote:*   

> 
> 
> LSI firmware require SSD supports deterministic read after trim (read zero). 
> 
> http://comments.gmane.org/gmane.linux.scsi/88189

 

Thanks... I guess!! So that means I'm screwed...   :Shocked: 

Oh well. I just can't seem to win... I've got 2 door-stops now (a Marvel-based SAS Controller that doesn't support suspend/resume for Linux and has shit transfer speeds for SATA 6G)...

I had a feeling I should just have sucked it up and forked out for a brand new Intel X99 setup...   :Rolling Eyes:   :Crying or Very sad: 

Bob

----------

