Kernel 6.1 breaks PCIe / regression

For some time I’m strugling to get my SATA controler to work with Manjaro’s kernel 6.x.
Everything worked with old linux-khadas kernel from 5.x branch, but after switch to linux-aml 6.x the PCIe devices is visible, but not initialized properly and no connected drives are detected.
This has been debuged in manjaro’s forum here: [VIM3] ASMedia SATA controller issues after replacing linux-khadas with linux-aml - #15 by zet - Technical Assistance - Manjaro Linux Forum

Without any results, I’ve gone with compiling the khadas 6.1 kernel (source from GitHub - khadas/linux at khadas-linux-6.1.y) and got same results: PCIe card controller is detected, but not initialized).

At first I thought that issues are with the SATA controller or ahci module used, but seems that it’s originating somewhere in meson-pcie.

So searching through this forum I’ve found that similar issue already have been reported before: Problem with meson-pcie patch

Latest dmesg output:

[    0.510276] dw-pcie fc000000.pcie: error -ENXIO: IRQ index 1 not found
[    0.512614] meson-pcie fc000000.pcie: host bridge /soc/pcie@fc000000 ranges:
[    0.512667] meson-pcie fc000000.pcie:       IO 0x00fc600000..0x00fc6fffff -> 0x0000000000
[    0.512688] meson-pcie fc000000.pcie:      MEM 0x00fc700000..0x00fdffffff -> 0x00fc700000
[    0.512892] meson-pcie fc000000.pcie: iATU unroll: enabled
[    0.512900] meson-pcie fc000000.pcie: iATU regions: 4 ob, 4 ib, align 64K, limit 4G
[    0.554596] meson-pcie fc000000.pcie: error: wait linkup timeout
[    0.586491] meson-pcie fc000000.pcie: PCIe Gen.2 x1 link up
[    0.586640] meson-pcie fc000000.pcie: PCI host bridge to bus 0000:00
[    0.586649] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.586656] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff]
[    0.586662] pci_bus 0000:00: root bus resource [mem 0xfc700000-0xfdffffff]
[    0.586688] pci 0000:00:00.0: [16c3:abcd] type 01 class 0x060400
[    0.586705] pci 0000:00:00.0: reg 0x38: [mem 0x00000000-0x0000ffff pref]
[    0.586748] pci 0000:00:00.0: supports D1
[    0.586754] pci 0000:00:00.0: PME# supported from D0 D1 D3hot D3cold
[    0.590401] pci 0000:01:00.0: [1b21:1064] type 00 class 0x010601
[    1.327721] pci 0000:01:00.0: Max Payload Size set to 256 (was 128, max 512)
[    1.327736] pci 0000:01:00.0: enabling Extended Tags
[    1.371262] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    1.544804] pci 0000:01:00.0: 4.000 Gb/s available PCIe bandwidth, limited by 5.0 GT/s PCIe x1 link at 0000:00:00.0 (capable of 7.876 Gb/s with 8.0 GT/s PCIe x1 link)
[    1.611717] pci 0000:00:00.0: BAR 6: assigned [mem 0xfc700000-0xfc70ffff pref]
[    1.611730] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    1.611965] pcieport 0000:00:00.0: PME: Signaling with IRQ 19
[    1.612192] pcieport 0000:00:00.0: AER: enabled with IRQ 19

If more testing/logs are required just let me know. Hope we can fix that, as the 6.x kernel is already upstream in Manjaro.

Hello @zette

We will check this issue on our side.

@zette

khadas@Khadas:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           379M  6.0M  373M   2% /run
/dev/mmcblk0p2   15G  1.9G   13G  14% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.9G     0  1.9G   0% /tmp
/dev/mmcblk0p1  240M   79M  161M  33% /boot
tmpfs           379M     0  379M   0% /run/user/1000
/dev/nvme0n1p1  229G   28K  217G   1% /mnt

I can recognize and load my SSD normally, I don’t have a SATA device with PCIe interface to test.

Please make sure your VIM3 is configured with PCIe instead of USB3.0.

I’m on PCIe mode, switching back to kernel 5.x, makes the controller working as usual.
In 6.x the controller is detected (visible in dmesg and lspci), but not fully initialized as ahci fails with -22 error.
linux-5.x:

[    0.571773] ahci 0000:01:00.0: version 3.0
[    0.571790] ahci 0000:01:00.0: enabling device (0000 -> 0002)
[    0.572048] ahci 0000:01:00.0: SSS flag set, parallel bus scan disabled
[    0.582279] ahci 0000:01:00.0: AHCI 0001.0301 32 slots 24 ports 6 Gbps 0xffff0f impl SATA mode
[    0.582291] ahci 0000:01:00.0: flags: 64bit ncq sntf stag pm led only pio sxs deso sadm sds apst 
[    0.589451] scsi host0: ahci
[    0.589842] scsi host1: ahci
[    0.590159] scsi host2: ahci
[    0.590453] scsi host3: ahci
[    0.590768] scsi host4: ahci
[    0.591059] scsi host5: ahci
[    0.591347] scsi host6: ahci
[    0.591727] scsi host7: ahci
[    0.592038] scsi host8: ahci
[    0.592378] scsi host9: ahci
[    0.592669] scsi host10: ahci
[    0.592970] scsi host11: ahci
[    0.593281] scsi host12: ahci
[    0.593584] scsi host13: ahci
[    0.593873] scsi host14: ahci
[    0.594186] scsi host15: ahci
[    0.594480] scsi host16: ahci
[    0.594778] scsi host17: ahci
[    0.595090] scsi host18: ahci
[    0.595380] scsi host19: ahci
[    0.595691] scsi host20: ahci
[    0.595981] scsi host21: ahci
[    0.596291] scsi host22: ahci
[    0.596602] scsi host23: ahci
[    0.596720] ata1: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702100 irq 20
[    0.596728] ata2: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702180 irq 20
[    0.596735] ata3: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702200 irq 20
[    0.596741] ata4: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702280 irq 20
[    0.596745] ata5: DUMMY
[    0.596749] ata6: DUMMY
[    0.596752] ata7: DUMMY
[    0.596756] ata8: DUMMY
[    0.596760] ata9: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702500 irq 20
[    0.596766] ata10: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702580 irq 20
[    0.596771] ata11: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702600 irq 20
[    0.596777] ata12: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702680 irq 20
[    0.596782] ata13: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702700 irq 20
[    0.596788] ata14: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702780 irq 20
[    0.596793] ata15: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702800 irq 20
[    0.596798] ata16: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702880 irq 20
[    0.596804] ata17: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702900 irq 20
[    0.596809] ata18: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702980 irq 20
[    0.596814] ata19: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702a00 irq 20
[    0.596820] ata20: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702a80 irq 20
[    0.596825] ata21: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702b00 irq 20
[    0.596830] ata22: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702b80 irq 20
[    0.596835] ata23: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702c00 irq 20
[    0.596840] ata24: SATA max UDMA/133 abar m8192@0xfc702000 port 0xfc702c80 irq 20

linux-6.x:

[    1.584240] ahci 0000:01:00.0: version 3.0
[    1.584267] ahci: probe of 0000:01:00.0 failed with error -22