Subject: Memory problem with Delock SATA3/USB3 controller board

From: Roland <[email-masked]>
Date: Mon, 18 Jul 2022 13:30:50 +0300 (EEST)

Hello!

I tested in my AmigaOne X5000 (QuorIQ 5020/5040) a combined Sata3/USB3 pcie controller board from Delock (https://www.delock.de/produkt/89389/merkmale.html?setLanguage=en). The ASM 1042, ASM 1061 and ASM 1182 chipsets are used on this board.

The Sata controller seems to work without issues, except that with the speedtest of 'Disks' tool the read speed reach only 200MB/s (with a 6G SSD disk), whereas it is normally around 400Mb/s with other Sata3 controllers.

Instead, there are serious problems with the USB controller if the whole RAM of my machine (4 or 8 GB) is in use:

- If a USB drive is connected to the controller before booting, the size of that drive is interpreted totally wrong (e.g. 250 GB -> 1GB) and the disk is not usable. As a consequence, loading of a root filesystem from the USB disk is not possible

- If a USB drive is conneted only after booting has finished , the size is correct and reading of the disk is possible. But writing to the disk fails if larger filesizes (several hundreds of MBs) are used (message: "Error splicing file: Input/output error"). The drive is then also unmounted and cannot be remounted before rebooting. Also copying smaller files can sometimes lock the drive, so that it isn't possible to write on it more files.

If I limit the RAM size to 3.5 GB (using a "MEM=3500M" bootarg) the symptoms described above dissappear and USB disks work normally. One problem is still present, though: if the machine is set to boot from an internal Sata disk and if a second SATA disk is connected to the USB port (using an USB3-Sata3 adapter) before booting, booting halts to a "start job" trying to load the kernel modules (present in lib/modules), adding continuously the time. The second disk does not have any Linux os components, only a couple of NTFS partitions with trivial data files! Also, connecting a simple USB memory stick does _not_ cause this issue.

So, is there some sort of memory allocation problem with the USB driver of this card? Is it possible to fix it? I had long time ago similar type of problems with some legacy pci boards, but they were fixed in kernel updates
I'm using currently Kernel 5.10.124, but the problem is seen also with later kernels, like 5.15 and 5.19 betas.

Here is some info how the controllers are seen:

1000:08:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller (prog-if 30 [XHCI])
    Subsystem: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
    Flags: bus master, fast devsel, latency 0, IRQ 19
    Memory at c20100000 (64-bit, non-prefetchable) [size=32K]
    Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
    Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
    Capabilities: [78] Power Management version 3
    Capabilities: [80] Express Legacy Endpoint, MSI 00
    Capabilities: [100] Virtual Channel
    Kernel driver in use: xhci_hcd

1000:09:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01) (prog-if 01 [AHCI 1.0])
    Subsystem: ASMedia Technology Inc. ASM1062 Serial ATA Controller
    Flags: bus master, fast devsel, latency 0, IRQ 47
    I/O ports at 3000 [size=8]
    I/O ports at 3008 [size=4]
    I/O ports at 3010 [size=8]
    I/O ports at 3018 [size=4]
    I/O ports at 3020 [size=32]
    Memory at c20200000 (32-bit, non-prefetchable) [size=512]
    Expansion ROM at c20210000 [virtual] [disabled] [size=64K]
    Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit-
    Capabilities: [78] Power Management version 3
    Capabilities: [80] Express Legacy Endpoint, MSI 00
    Capabilities: [100] Virtual Channel
    Kernel driver in use: ahci

Regards,

Roland