Bug 196805

Summary: ASMedia [1b21:0625] SATA: "failed to stop engine (-5)"
Product: IO/Storage Reporter: Mourad De Clerck (bugs-kernel)
Component: Serial ATAAssignee: Tejun Heo (tj)
Status: REOPENED ---    
Severity: normal CC: bugs-kernel, debfx-kernel, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.16 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
lspci
dmesg with pci=noacpi
dsdt
hardware info booting normally
hardware info booting with pci=noacpi

Description Mourad De Clerck 2017-09-01 11:12:58 UTC
Created attachment 258159 [details]
dmesg

I'm running stock Debian on a QNAP-453B mini device, an Apollo Lake-based NAS.

Two of the SATA ports are using the Intel SATA controller, and the other two are using an unidentified ASMedia SATA controller.

01:00.0 SATA controller [0106]: ASMedia Technology Inc. Device [1b21:0625] (rev ff)

Sadly, the ASMedia fails to initialize on bootup, giving errors like:

[    4.553800] ahci 0000:01:00.0: failed to stop engine (-5)
<snip>
[   19.553318] ahci 0000:01:00.0: failed to stop engine (-5)
[   19.554075] ahci 0000:01:00.0: AHCI ffff.ffff 32 slots 32 ports ? Gbps 0xffffffff impl unknown mode
[   19.555573] ahci 0000:01:00.0: flags: 64bit ncq sntf ilck stag pm led clo only pmp fbs pio slum part ccc ems sxs deso sadm sds apst nvmp boh 
[   37.484852] scsi host3: ahci
[   37.486241] scsi host4: ahci
<snip>
[   37.514824] scsi host33: ahci
[   37.515948] scsi host34: ahci
[   37.516664] ata3: SATA max UDMA/133 abar m8192@0x91380000 port 0x91380100 irq 22
[   37.517281] ata4: SATA max UDMA/133 abar m8192@0x91380000 port 0x91380180 irq 22
<snip>
[   37.529820] ata33: SATA max UDMA/133 abar m8192@0x91380000 port 0x91381000 irq 22
[   37.530080] ata34: SATA max UDMA/133 abar m8192@0x91380000 port 0x91381080 irq 22
[   39.069084] ata3: failed to resume link (SControl FFFFFFFF)
[   39.069622] ata3: SATA link down (SStatus FFFFFFFF SControl FFFFFFFF)
<snip>
[  102.389121] ata34: failed to resume link (SControl FFFFFFFF)
[  102.391890] ata34: SATA link down (SStatus FFFFFFFF SControl FFFFFFFF)

Anyone have an idea on how to proceed?

Thanks,

Mourad
Comment 1 Mourad De Clerck 2017-09-01 11:13:44 UTC
Created attachment 258161 [details]
lspci
Comment 2 Mourad De Clerck 2017-09-19 18:09:01 UTC
Created attachment 258493 [details]
dmesg with pci=noacpi
Comment 3 Mourad De Clerck 2017-09-19 18:09:36 UTC
Created attachment 258495 [details]
dsdt
Comment 4 Mourad De Clerck 2017-09-19 18:10:39 UTC
Seems booting with pci=noacpi solves the issue. Not sure whether this workaround is a healthy fix, though.

see latest dmesg and dsdt
Comment 5 Zhang Rui 2017-10-10 08:23:42 UTC
demsg without pci=noacpi
[    2.528132] ata2: SATA max UDMA/133 abar m2048@0x9141b000 port 0x9141b180 irq 371
[    2.553579] ahci 0000:01:00.0: Refused to change power state, currently in D3
[    2.554801] ahci 0000:01:00.0: SSS flag set, parallel bus scan disabled

the PCI device is still in D3 state, thus following operations fail.

dmesg with pci=noacpi
[    4.301613] ata2: SATA max UDMA/133 abar m2048@0xd1302000 port 0xd1302180 irq 371
[    4.301672] ahci 0000:01:00.0: PCI->APIC IRQ transform: INT A -> IRQ 22
[    4.301974] ahci 0000:01:00.0: SSS flag set, parallel bus scan disabled

please attach the output of "sudo lspci -vv" after boot, both w/ and w/o pci=noacpi
Comment 6 Zhang Rui 2017-12-18 02:53:23 UTC
Bug closed as there is no response from the bug reporter.
Please feel free to reopen it if the problem still exists in upstream kernel and you can provide the information requested in comment #5.
Comment 7 Mourad De Clerck 2018-06-15 23:07:35 UTC
Apologies for the lack of response. I've re-tested with 4.16, with and without pci=noacpi.

In attachment the dmesg, dsdt.dat, lspci etc for each situation.
Comment 8 Mourad De Clerck 2018-06-15 23:09:11 UTC
Created attachment 276579 [details]
hardware info booting normally
Comment 9 Mourad De Clerck 2018-06-15 23:09:54 UTC
Created attachment 276581 [details]
hardware info booting with pci=noacpi
Comment 10 Zhang Rui 2018-06-20 03:12:43 UTC
01:00.0 SATA controller [0106]: ASMedia Technology Inc. Device [1b21:0625] (rev ff) (prog-if ff)
	!!! Unknown header type 7f
	Kernel modules: ahci

this is from the lspci output.
It seems that there is something wrong with this sata controller.
Re-assign to the ata experts for this issue.
Comment 11 Felix Geyer 2019-08-12 16:40:57 UTC
FWIW you can work around the problem by passing pcie_port_pm=off to the kernel command-line.