M.2 PCIe-to-SATA adapters ASM1166 and JMB585

I bought from AliExpress two PCIe-to-SATA M.2 adapters:

  • ASM1166 M.2 PCIe to 6xSATA
  • JMB585 M.2 PCIe to 5xSATA
    They where detected with kernel 5.15, but I am waiting for a power supply to test with an actual SATA HDD. Maybe VisionFive2 can become a NAS with 5 HDDs or 6 HDDs. :slight_smile:
root@starfive:~# uname -a
Linux starfive 5.15.0-starfive #3 SMP Sat Feb 25 13:32:46 UTC 2023 riscv64 GNU/Linux
root@starfive:~# lspci -v
0001:01:00.0 SATA controller: ASMedia Technology Inc. ASM1166 Serial ATA Controller (rev 02) (prog-if 01 [AHCI 1.0])
	Subsystem: ZyDAS Technology Corp. ASM1166 Serial ATA Controller
	Flags: bus master, fast devsel, latency 0, IRQ 60
	Memory at 38080000 (32-bit, non-prefetchable) [size=8K]
	Memory at 38082000 (32-bit, non-prefetchable) [size=8K]
	Expansion ROM at 38000000 [virtual] [disabled] [size=512K]
	Capabilities: [40] Power Management version 3
	Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [80] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [130] Secondary PCI Express
	Kernel driver in use: ahci
root@starfive:~# lspci -v
0001:01:00.0 SATA controller: JMicron Technology Corp. JMB58x AHCI SATA controller (prog-if 01 [AHCI 1.0])
	Subsystem: JMicron Technology Corp. JMB58x AHCI SATA controller
	Flags: bus master, fast devsel, latency 0, IRQ 60
	I/O ports at <unassigned> [disabled]
	I/O ports at <unassigned> [disabled]
	I/O ports at <unassigned> [disabled]
	I/O ports at <unassigned> [disabled]
	I/O ports at <unassigned> [disabled]
	Memory at 38010000 (32-bit, non-prefetchable) [size=8K]
	Expansion ROM at 38000000 [virtual] [disabled] [size=64K]
	Capabilities: [80] Power Management version 3
	Capabilities: [90] MSI: Enable+ Count=1/8 Maskable- 64bit+
	Capabilities: [c0] Express Legacy Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [150] Device Serial Number 00-00-00-00-00-00-00-00
	Capabilities: [160] Power Budgeting <?>
	Capabilities: [1b8] Latency Tolerance Reporting
	Capabilities: [300] Secondary PCI Express
	Capabilities: [900] L1 PM Substates
	Kernel driver in use: ahci
2 Likes

I like the idea, but I doubt the transmission rate is satisfactory.

2 Likes

Network bindwidth is not enough. :sweat_smile:
And, RAID can provide safty.

Synology DS118 NAS has Realtek RTD1296 (Quad Core@1.4GHz), 1 SATA, 1GB DDR4 and 1 x RJ-45 1GbE. VisionFive2 can be an interesting alternative. If using both network interfaces (2 x 125MB/s), the LAN bandwidth is bellow the PCIe bandwidth (500 MB/s).

I’m ignoring the RAID safety, the actual LAN bandwidth and the actual PCIe bandwidth. :blush:

2 Likes

I connected a Kingston UV500 to JMB585.
Reading using dd averages at 180MB/s.

root@starfive:~# dd if=/dev/sda of=/dev/null bs=1M status=progress
480022364160 bytes (480 GB, 447 GiB) copied, 2559 s, 188 MB/s
457862+1 records in
457862+1 records out
480103981056 bytes (480 GB, 447 GiB) copied, 2563.27 s, 187 MB/s

I could see the partitions using fdisk:

root@starfive:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.38).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk model: KINGSTON SUV5004
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 2EE6FD09-5568-4336-B0E9-F46EAD760552

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1085439   1083392   529M Windows recovery environment
/dev/sda2  1085440   1290239    204800   100M EFI System
/dev/sda3  1290240   1323007     32768    16M Microsoft reserved
/dev/sda4  1323008 937701375 936378368 446.5G Microsoft basic data

SMART before dd:

root@starfive:~# smartctl -a /dev/sda
smartctl 7.3 2022-02-28 r5338 [riscv64-linux-5.15.0-starfive] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Kingston SSDNow UV400/500
Device Model:     KINGSTON SUV500480G
Serial Number:    50026B7682744CE9
LU WWN Device Id: 5 0026b7 682744ce9
Firmware Version: 003056RR
User Capacity:    480,103,981,056 bytes [480 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-4, ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Apr 22 13:38:38 2023 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (    5) seconds.
Offline data collection
capabilities:                    (0x71) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        (   5) minutes.
Conveyance self-test routine
recommended polling time:        (   0) minutes.
SCT capabilities:              (0x003d) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 48
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   000    Pre-fail  Always       -       516747
  5 Reallocated_Sector_Ct   0x0033   089   089   010    Pre-fail  Always       -       148
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       981
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       269
100 Unknown_Kingston_Attr   0x0032   100   100   000    Old_age   Always       -       752000
101 Unknown_Kingston_Attr   0x0032   100   100   000    Old_age   Always       -       175072
170 Reserved_Block_Count    0x0032   100   100   000    Old_age   Always       -       148
171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
174 Unexpect_Power_Loss_Ct  0x0032   100   100   000    Old_age   Always       -       34
175 Program_Fail_Count_Chip 0x0032   100   100   000    Old_age   Always       -       0
176 Erase_Fail_Count_Chip   0x0032   100   100   000    Old_age   Always       -       0
177 Wear_Leveling_Count     0x0032   100   100   000    Old_age   Always       -       283
178 Used_Rsvd_Blk_Cnt_Chip  0x0002   100   100   000    Old_age   Always       -       15
180 Unused_Rsvd_Blk_Cnt_Tot 0x0002   100   100   000    Old_age   Always       -       1181
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       3
187 Reported_Uncorrect      0x0033   100   100   000    Pre-fail  Always       -       1378
194 Temperature_Celsius     0x0022   029   100   000    Old_age   Always       -       29 (Min/Max 19/55)
195 Hardware_ECC_Recovered  0x0032   100   100   000    Old_age   Always       -       516747
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       148
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       75
199 UDMA_CRC_Error_Count    0x0012   100   100   000    Old_age   Always       -       0
201 Unc_Read_Error_Rate     0x0032   100   100   000    Old_age   Always       -       0
204 Soft_ECC_Correction     0x0032   100   100   000    Old_age   Always       -       515369
231 SSD_Life_Left           0x0032   100   100   000    Old_age   Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       2643
234 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       2032
241 Host_Writes_GiB         0x0032   100   100   000    Old_age   Always       -       1833
242 Host_Reads_GiB          0x0032   100   100   000    Old_age   Always       -       2223
250 Read_Retry_Count        0x0032   100   100   000    Old_age   Always       -       516415

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 0
Warning: ATA Specification requires self-test log structure revision number = 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

SMART after dd:

root@starfive:~# smartctl -a /dev/sda
smartctl 7.3 2022-02-28 r5338 [riscv64-linux-5.15.0-starfive] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Kingston SSDNow UV400/500
Device Model:     KINGSTON SUV500480G
Serial Number:    50026B7682744CE9
LU WWN Device Id: 5 0026b7 682744ce9
Firmware Version: 003056RR
User Capacity:    480,103,981,056 bytes [480 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-4, ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sat Apr 22 14:25:04 2023 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (    5) seconds.
Offline data collection
capabilities:                    (0x71) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        (   5) minutes.
Conveyance self-test routine
recommended polling time:        (   0) minutes.
SCT capabilities:              (0x003d) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 48
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   000    Pre-fail  Always       -       521486
  5 Reallocated_Sector_Ct   0x0033   089   089   010    Pre-fail  Always       -       148
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       981
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       269
100 Unknown_Kingston_Attr   0x0032   100   100   000    Old_age   Always       -       753536
101 Unknown_Kingston_Attr   0x0032   100   100   000    Old_age   Always       -       175456
170 Reserved_Block_Count    0x0032   100   100   000    Old_age   Always       -       148
171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
174 Unexpect_Power_Loss_Ct  0x0032   100   100   000    Old_age   Always       -       34
175 Program_Fail_Count_Chip 0x0032   100   100   000    Old_age   Always       -       0
176 Erase_Fail_Count_Chip   0x0032   100   100   000    Old_age   Always       -       0
177 Wear_Leveling_Count     0x0032   100   100   000    Old_age   Always       -       283
178 Used_Rsvd_Blk_Cnt_Chip  0x0002   100   100   000    Old_age   Always       -       15
180 Unused_Rsvd_Blk_Cnt_Tot 0x0002   100   100   000    Old_age   Always       -       1181
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       3
187 Reported_Uncorrect      0x0033   100   100   000    Pre-fail  Always       -       1378
194 Temperature_Celsius     0x0022   030   100   000    Old_age   Always       -       30 (Min/Max 19/55)
195 Hardware_ECC_Recovered  0x0032   100   100   000    Old_age   Always       -       521486
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       148
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       75
199 UDMA_CRC_Error_Count    0x0012   100   100   000    Old_age   Always       -       0
201 Unc_Read_Error_Rate     0x0032   100   100   000    Old_age   Always       -       0
204 Soft_ECC_Correction     0x0032   100   100   000    Old_age   Always       -       520108
231 SSD_Life_Left           0x0032   100   100   000    Old_age   Always       -       0
233 Media_Wearout_Indicator 0x0032   100   100   000    Old_age   Always       -       2648
234 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       2036
241 Host_Writes_GiB         0x0032   100   100   000    Old_age   Always       -       1833
242 Host_Reads_GiB          0x0032   100   100   000    Old_age   Always       -       2670
250 Read_Retry_Count        0x0032   100   100   000    Old_age   Always       -       521259

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 0
Warning: ATA Specification requires self-test log structure revision number = 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
1 Like

I connected a Kingston UV500 to ASM1166.
Reading using dd averages at 180MB/s:

root@starfive:~# dd if=/dev/sda of=/dev/null bs=1M status=progress
480071647232 bytes (480 GB, 447 GiB) copied, 2551 s, 188 MB/s
457862+1 records in
457862+1 records out
480103981056 bytes (480 GB, 447 GiB) copied, 2555.01 s, 188 MB/s

CPU usage is about 45% (similar value was observed also for JMB585):

user@starfive:~$ top
top - 19:31:45 up 2 min,  3 users,  load average: 1.65, 1.53, 0.66
Tasks: 236 total,   1 running, 235 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us, 10.7 sy,  0.0 ni, 74.9 id, 14.2 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem :   3893.8 total,   2030.8 free,    155.4 used,   1707.7 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   3692.7 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    691 root      20   0    2592   2076   1004 D  42.6   0.1   0:04.51 dd
    690 user      20   0    5664   2784   1936 R   1.3   0.1   0:00.47 top

I hope that SiFive improves the driver for the PCIe controller to reach a throughput of 250MB/s (PCIe 2.0 x1 has a theoretical bandwidth of 500MB/s). With 250MB/s we can saturate the two gigabit LANs (2 x 125MB/s).

1 Like