Bug 211873
Summary: | ASM1166: too many SATA ports detected | ||
---|---|---|---|
Product: | IO/Storage | Reporter: | Christian Boxdörfer (christian.boxdoerfer) |
Component: | Serial ATA | Assignee: | Tejun Heo (tj) |
Status: | NEW --- | ||
Severity: | normal | CC: | andrebrait, ck+kernelbugzilla, lnicola |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 5.10.13 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | dmesg output (shortened) |
I'm running into the same issue. Could you help me reproduce your own fix? I have two of these cards. It seems to be something that could be included in a patche as a quirk. See my patch: https://bugzilla.kernel.org/show_bug.cgi?id=218346 Can be closed here, patch got applied by upstream: https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/commit/?h=for-6.8-fixes&id=0077a504e1a4468669fd2e011108db49133db56e Merged in 6.8rc2 This still seems to happen in 6.10.11 (and previous versions I've tested): I have an ASM1166 (6 ports) and an ASM1164 (4 ports): Oct 02 18:47:06 kernel: ahci 0000:02:00.0: version 3.0 Oct 02 18:47:06 kernel: ahci 0000:02:00.0: enabling device (0000 -> 0002) Oct 02 18:47:06 kernel: ahci 0000:02:00.0: SSS flag set, parallel bus scan disabled Oct 02 18:47:06 kernel: ahci 0000:02:00.0: AHCI vers 0001.0301, 32 command slots, 6 Gbps, SATA mode Oct 02 18:47:06 kernel: ahci 0000:02:00.0: 30/32 ports implemented (port mask 0xffffff3f) Oct 02 18:47:06 kernel: ahci 0000:02:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst Oct 02 18:47:06 kernel: ahci 0000:03:00.0: enabling device (0000 -> 0002) Oct 02 18:47:06 kernel: ahci 0000:03:00.0: SSS flag set, parallel bus scan disabled Oct 02 18:47:06 kernel: ahci 0000:03:00.0: AHCI vers 0001.0301, 32 command slots, 6 Gbps, SATA mode Oct 02 18:47:06 kernel: ahci 0000:03:00.0: 20/24 ports implemented (port mask 0xffff0f) Oct 02 18:47:06 kernel: ahci 0000:03:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst 02:00.0 SATA controller: ASMedia Technology Inc. ASM1166 Serial ATA Controller (rev 02) (prog-if 01 [AHCI 1.0]) DeviceName: Realtek Subsystem: ASMedia Technology Inc. Device 2116 Flags: bus master, fast devsel, latency 0, IRQ 103, IOMMU group 18 Memory at dd482000 (32-bit, non-prefetchable) [size=8K] Memory at dd480000 (32-bit, non-prefetchable) [size=8K] Expansion ROM at dd400000 [disabled] [size=512K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [80] Express Endpoint, IntMsgNum 0 Capabilities: [100] Advanced Error Reporting Capabilities: [130] Secondary PCI Express Kernel driver in use: ahci Kernel modules: ahci 03:00.0 SATA controller: ASMedia Technology Inc. ASM1164 Serial ATA AHCI Controller (rev 02) (prog-if 01 [AHCI 1.0]) Subsystem: ASMedia Technology Inc. Device 2116 Flags: bus master, fast devsel, latency 0, IRQ 109, IOMMU group 19 Memory at dd382000 (32-bit, non-prefetchable) [size=8K] Memory at dd380000 (32-bit, non-prefetchable) [size=8K] Expansion ROM at dd300000 [disabled] [size=512K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [80] Express Endpoint, IntMsgNum 0 Capabilities: [100] Advanced Error Reporting Capabilities: [130] Secondary PCI Express Kernel driver in use: ahci Kernel modules: ahci /sys/bus/pci/devices/0000:02:00.0/uevent:PCI_ID=1B21:1166 /sys/bus/pci/devices/0000:03:00.0/uevent:PCI_ID=1B21:1164 Because the logic changed. Since ASMedia violates the AHCI specs, you have to set now a special parameter. Example (for my ASM1166) -> ahci.mask_port_map=0000:09:00.0=0x3f 0000:09:00.0 is the device id if your ASMedia controler. 0x3f is the mask, how many ports you want to limit. (In reply to Conrad Kostecki from comment #6) > Because the logic changed. Since ASMedia violates the AHCI specs, you have > to set now a special parameter. > > Example (for my ASM1166) > -> ahci.mask_port_map=0000:09:00.0=0x3f > > 0000:09:00.0 is the device id if your ASMedia controler. > 0x3f is the mask, how many ports you want to limit. Pardon my ignorance, but where would one be able to set it, in most distros? modprobe.d directory? Bootloader (e.g. grub2) command line? It would be nice to get rid of the extra wait on my unRAID box. Depends on your distribution. Since I have 'ahci' backed into my kernel, its a command line parameter for the kernel and could be, for example, set in grub. But if you have this loaded as a module, modprobe.d would be the right place. > Since ASMedia violates the AHCI specs, you have to set now a special > parameter. Sigh, aren't all quirks for hardware that violates the spec? > ahci.mask_port_map=0000:09:00.0=0x3f That did the trick, thanks. For reference, ASM1164 takes 0x0f: ahci.mask_port_map=0000:02:00.0=0x3f,0000:03:00.0=0x0f I'm not exactly sure where to get the PCI id from (lspci shows 02:00.0 without the 0000: prefix), but it seems to work otherwise: Startup finished in 7.533s (firmware) + 786ms (loader) + 17.530s (kernel) + 11.553s (userspace) = 37.403s vs. Startup finished in 6.299s (firmware) + 801ms (loader) + 4.589s (kernel) + 11.662s (userspace) = 23.352s (In reply to Conrad Kostecki from comment #8) > Depends on your distribution. Since I have 'ahci' backed into my kernel, its > a command line parameter for the kernel and could be, for example, set in > grub. But if you have this loaded as a module, modprobe.d would be the right > place. Thanks. That was enough for me to find it. For those running unRAID who might stumble upon this bug report, this means adding the parameter on /boot/syslinux/syslinux.cfg, on the "append" section for each entry. Unfortunately unRAID is still on kernel 6.6, so it'll be a while until this gets there. |
Created attachment 295377 [details] dmesg output (shortened) I've got a 6 port SATA PCI card with an ASMedia ASM1166 controller, however the kernel detects 32 SATA ports instead. This significantly delays the boot process when the kernel tries to scan all those ports for devices. lspci: 06:00.0 SATA controller: ASMedia Technology Inc. Device 1166 (rev 02) dmesg: [ 1.331934] debian-workstation kernel: ahci 0000:06:00.0: SSS flag set, parallel bus scan disabled [ 1.334903] debian-workstation kernel: r8169 0000:03:00.0 enp3s0: renamed from eth0 [ 1.342297] debian-workstation kernel: ahci 0000:06:00.0: AHCI 0001.0301 32 slots 32 ports 6 Gbps 0xffffff3f impl SATA mode [ 1.342299] debian-workstation kernel: ahci 0000:06:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst I was able to fix the slow boot time with a small patch that sets force_port_map to 0x3f for this controller, but I have no idea if that's the proper way to handle this issue. If there's any debug information missing just let me know. Thank you!