AmpereComputing / ampere-lts-kernel---DEPRECATED

Linux 5.4 and 5.10 Longterm kernel (LTS) with Ampere patches
21 stars 18 forks source link

PCI/MSI: fix ASM1062R sata controller initialization error #124

Open adamliyi opened 3 years ago

adamliyi commented 3 years ago

Backported from: https://github.com/torvalds/linux/commit/cbc40d5c33af289548d2481e68a38512102cdd3e https://github.com/torvalds/linux/commit/2053230af11dc651ee3024682df12668496adad2

be00ac208083 PCI/MSI: Set device flag indicating only 32-bit MSI support dc7031c08cfc PCI/MSI: Move MSI/MSI-X init to msi.c

See bug ID 93091.

"0002:02:00.0 SATA controller: ASMedia Technology Inc. Device 0625 (rev 01)"

Sometimes the device cannot be intialized:

[2021-10-15 10:25:18]  [   11.787337] ata1: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280100 irq 169
[2021-10-15 10:25:18]  [   11.843294] ata10: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280580 irq 169
[2021-10-15 10:25:18]  [   11.850679] ata11: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280600 irq 169
[2021-10-15 10:25:18]  [   11.858062] ata12: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280680 irq 169
[2021-10-15 10:25:18]  [   12.191208] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[2021-10-15 10:25:20]  [   17.220039] ata1.00: qc timeout (cmd 0xec)
[2021-10-15 10:25:24]  [   17.224134] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[2021-10-15 10:25:24]  [   17.561219] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[2021-10-15 10:25:24]  [   28.020024] ata1.00: qc timeout (cmd 0xec)
[2021-10-15 10:25:34]  [   28.024118] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[2021-10-15 10:25:34]  [   28.030203] ata1: limiting SATA link speed to 3.0 Gbps
[2021-10-15 10:25:34]  [   28.361214] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 320)
[2021-10-15 10:25:34]  [   58.740020] ata1.00: qc timeout (cmd 0xec)
[2021-10-15 10:26:05]  [   58.744114] ata1.00: failed to IDENTIFY (I/O error, err_mask=0x4)
[2021-10-15 10:26:05]  [   59.081222] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 320)
[2021-10-15 10:27:14]  [  128.721235] ata10: SATA link down (SStatus 0 SControl 300)
[2021-10-15 10:27:15]  [  129.051220] ata11: SATA link down (SStatus 0 SControl 300)
[2021-10-15 10:27:15]  [  129.381231] ata12: SATA link down (SStatus 0 SControl 300)

Expected:

[2021-10-15 10:16:40]  [   11.760663] ata1: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280100 irq 169
[2021-10-15 10:16:40]  [   11.816614] ata10: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280580 irq 169
[2021-10-15 10:16:40]  [   11.823999] ata11: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280600 irq 169
[2021-10-15 10:16:40]  [   11.831383] ata12: SATA max UDMA/133 abar m8192@0x4280000 port 0x4280680 irq 169
[2021-10-15 10:16:40]  [   12.162227] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[2021-10-15 10:16:40]  [   12.174388] ata1.00: ATA-10: Kingchuxing 256GB, T0910A0, max UDMA/133
[2021-10-15 10:16:40]  [   12.180816] ata1.00: 500118192 sectors, multi 1: LBA48 NCQ (depth 32), AA
[2021-10-15 10:16:40]  [   12.195808] ata1.00: configured for UDMA/133
[2021-10-15 10:16:42]  [   14.592277] ata10: SATA link down (SStatus 0 SControl 300)
[2021-10-15 10:16:43]  [   14.922239] ata11: SATA link down (SStatus 0 SControl 300)
[2021-10-15 10:16:43]  [   15.252275] ata12: SATA link down (SStatus 0 SControl 300)
adamliyi commented 3 years ago

According to testing, if adding this patch https://github.com/torvalds/linux/commit/2053230af11dc651ee3024682df12668496adad2, there is not qc timeout error observed.

Dependent patch: https://github.com/torvalds/linux/commit/cbc40d5c33af289548d2481e68a38512102cdd3e

We will backport these two patches to 5.4 and 5.10 kernel.

adamliyi commented 3 years ago

To reproduce the issue:

  1. set 'iommu.passthrough=1'
  2. In ASM1062R sata card BIOS, set "MSI/Legency" mode (please note the SATA card BIOS version)
  3. Without the patch, there is error message in kernel log: "arch assigned 64-bit MSI address 0x1001000d0040 but device only supports 32 bits", and SATA device cannot work
  4. After the patch, SATA device successfully initialized