Skip to content

Enable CONFIG_USB_UAS=y for Amlogic-ng (verified: queue_depth 1→30, write latency 10→6ms on Samsung T5) #48

@xbmc4lyfe

Description

@xbmc4lyfe

Summary

The Amlogic-ng kernel config currently disables UASP (USB Attached SCSI),
forcing all USB-attached storage onto the legacy Bulk-Only Transport (BOT)
path with queue_depth=1. I'd like to propose enabling CONFIG_USB_UAS=y
for the Amlogic-ng device family.

This isn't a speculative ask — I've been running an out-of-tree uas.ko
on T3b with a boot-time rebind service for some time, on an Ugoos AM6b+
(S922X) with a Samsung T5 connected directly to the USB OTG port. UAS
works on this kernel, on this hardware, with this drive. The only reason
I'm using a fragile vermagic-pinned shadow module is that the in-tree
config builds the driver out.

Current state

projects/Amlogic-ce/devices/Amlogic-ng/linux/linux.aarch64.conf:4637

# CONFIG_USB_UAS is not set

For comparison, upstream CoreELEC's analogous config has it enabled:

  • CoreELEC/CoreELEC projects/Amlogic-ce/devices/Amlogic-no/linux/linux.aarch64.conf:4913CONFIG_USB_UAS=y

The setting appears inherited from the U3k/CPM lineage rather than a
deliberate p3i decision — git log -p on this file in pannal/CoreELEC
contains no commit mentioning UAS. Surrounding USB stack is otherwise
identical between p3i and upstream (USB_XHCI_HCD=y, USB_EHCI_HCD=y,
USB_STORAGE=y).

Empirical verification on T3b

I'm running the build:
Flash_CoreELEC-Amlogic-ng.arm-21.3-Omega_p3i_T3b_20260322020632-Generic.img.gz

Hardware:

  • SoC: Amlogic S922X (Ugoos AM6b+ class, 6-core big.LITTLE, 4 GB)
  • Drive: Samsung T5 Portable SSD (USB 0x04e8:0x61f5)
  • Connection: USB OTG port, no hub

To get UAS working I had to:

  1. Cross-compile uas.ko from pannal/linux-amlogic against the T3b
    kernel headers (vermagic must match exactly).
  2. Drop a uas-rebind.sh into /storage/.config/ that loads the module,
    unbinds the device from usb-storage, and rebinds to uas at
    sysinit.target.
  3. Maintain that whole apparatus across kernel bumps.

After rebind, UAS is active and stable:

$ cat /sys/block/sda/device/queue_depth
30
$ basename $(readlink /sys/bus/usb/drivers/uas/2-1:1.0/driver)
uas
$ lsmod | grep uas
uas  ...  refcount 1

Measured impact

On my workload (Kodi 4K Dolby Vision playback concurrent with TMDBHelper
warmup services hammering SQLite on the T5):

  • queue_depth: 1 → 30. BOT serializes one SCSI command at a time;
    UAS pipelines up to 30 in flight.
  • Write latency: 10 ms → 6 ms for SQLite checkpoint fsync — visible
    improvement because checkpoint writes can now stripe across SSD NAND
    channels instead of serializing through the bridge.
  • Kodi I/O and warmup writes interleave properly under contention; no
    more head-of-line blocking from the warmup services on the BOT queue.

These numbers are documented in my system tuning notes; happy to share
the full benchmarks (sequential dd, hdparm -t, fio random) if useful.

Compatibility — Samsung T5 specifically

The T5 (vendor 0x04e8, product 0x61f5) is not present in either of the
kernel's UAS-related quirks tables in pannal/linux-amlogic:

  • drivers/usb/storage/unusual_devs.h — no T5 entry (no BOT-only
    override)
  • drivers/usb/storage/unusual_uas.h — no T5 entry (no UAS-disable
    override)

So once CONFIG_USB_UAS=y is set, T5 owners will get UAS automatically
with no additional kernel patches or quirks. The historical Amlogic-XHCI

  • UAS pain points (JMicron JMS567, ASMedia ASM1051E/1153) are handled
    by unusual_uas.h and don't apply here.

Risk mitigation — =m as a fallback option

If =y feels too aggressive for a daily-driver build, building UAS as
a module (CONFIG_USB_UAS=m) is a fine alternative. It ships the driver,
and if any user ever hits a regression with their specific enclosure
they can modprobe -r uas to fall back to BOT. I'd take either.

Proposed change

--- a/projects/Amlogic-ce/devices/Amlogic-ng/linux/linux.aarch64.conf
+++ b/projects/Amlogic-ce/devices/Amlogic-ng/linux/linux.aarch64.conf
@@ -4637 +4637 @@
-# CONFIG_USB_UAS is not set
+CONFIG_USB_UAS=y

(Same one-line flip applies to Amlogic-ne for boxes built on S905X4 /
S928, but I can only personally validate on Amlogic-ng / S922X.)

Offer to test

I can drop my out-of-tree uas.ko rebind apparatus and rebase to a
nightly with this change baked in, then report dmesg + lsusb -t

  • dd/hdparm -t/fio numbers. If you have a pre-release branch
    you'd like exercised against an S922X + T5 setup, happy to volunteer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions