Bug 289748 - ahci driver not attached on New supermicro board H13SSW in at least 14.3 and CURRENT
Summary: ahci driver not attached on New supermicro board H13SSW in at least 14.3 and ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: amd64 Any
: --- Affects Some People
Assignee: John Baldwin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-22 07:29 UTC by Vitalij Satanivskij
Modified: 2025-10-30 14:19 UTC (History)
3 users (show)

See Also:


Attachments
pciconf (24.52 KB, text/plain)
2025-09-22 11:41 UTC, Vitalij Satanivskij
no flags Details
devinfo (41.89 KB, text/plain)
2025-09-22 11:41 UTC, Vitalij Satanivskij
no flags Details
pciconf -lvbBccV pci0:226:0:0 (1.14 KB, text/plain)
2025-09-22 11:41 UTC, Vitalij Satanivskij
no flags Details
msix_nonfatal.patch (2.23 KB, patch)
2025-10-03 16:08 UTC, John Baldwin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vitalij Satanivskij 2025-09-22 07:29:17 UTC
We received several Supermicro servers — AS-1115CS-TNR (https://www.supermicro.com/en/products/system/clouddc/1u/as%20-1115cs-tnr) 
They are based on the H13SSW motherboard with the latest BIOS, Turin 9355 CPU, and so on.

Since local storage is only needed for system startup, and we have a stock of SATA SSDs, the chosen storage type is SATA.

However, when trying to boot FreeBSD CURRENT 15-ALPHA2/ALPHA3 and 14.4-STABLE from an install source,
we receive a kernel error when attempting to attach ahci0.


ahci0: <AMD KERNCZ AHCI SATA controller> mem 0xc5201000-0xc52017ff irq 37 at device 0.0 numa-domain 0 on pci2
device_attach: ahci0 attach returned 6
ahci0: <AMD KERNCZ AHCI SATA controller> mem 0xc5200000-0xc52007ff irq 38 at device 0.1 numa-domain 0 on pci2
device_attach: ahci0 attach returned 6

output of pciconf -lv 

none3@pci0:226:0:0:     class=0x010601 rev=0x93 hdr=0x00 vendor=0x1022 device=0x7901 subvendor=0x15d9 subdevice=0x1c85
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
none4@pci0:226:0:1:     class=0x010601 rev=0x93 hdr=0x00 vendor=0x1022 device=0x7901 subvendor=0x15d9 subdevice=0x1c85
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA

And of course, we don't see any devices — except the virtual CD-ROM via IPMI.

We tried booting with verbose mode, but found no additional messages related to the issue.

The situation is further complicated by the fact that we don’t have direct physical access to the machines, so preparing an installation medium on another system and deploying it to the target server is a time-consuming process.

Could you please advise on what additional diagnostics we can perform, and generally help us resolve this issue?

Thank you in advance.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2025-09-22 10:56:22 UTC
(In reply to Vitalij Satanivskij from comment #0)
Could you please provide output of pciconf -lvbBccV pci0:226:0:0 ?

Please also attach full outputs of pciconf -lv and devinfo -vr.
Comment 2 Vitalij Satanivskij 2025-09-22 11:41:05 UTC
Created attachment 263982 [details]
pciconf
Comment 3 Vitalij Satanivskij 2025-09-22 11:41:20 UTC
Created attachment 263983 [details]
devinfo
Comment 4 Vitalij Satanivskij 2025-09-22 11:41:53 UTC
Created attachment 263984 [details]
pciconf -lvbBccV pci0:226:0:0
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2025-09-22 15:16:27 UTC
(In reply to Vitalij Satanivskij from comment #4)
Not an expert in this area, but this looks fishy to me:
    cap 11[c0] = MSI-X supports 1 message
                 Table in map 0x10[0x0], PBA in map 0x10[0x0]
Because BAR 0x10 is not configured.
Looks like the corresponding capability is all zeroes.

Try to disable MSI-X as an experiment (hw.pci.enable_msix=0).
Comment 6 Vitalij Satanivskij 2025-09-22 17:17:24 UTC
(In reply to Andriy Gapon from comment #5)
Yes, I disable msix on boot and driver attached, sata devices visible. Of cause another hardware such as mellanox network and so on become unvisible (no drivers attached)
Comment 7 Andriy Gapon freebsd_committer freebsd_triage 2025-09-23 07:15:44 UTC
(In reply to Vitalij Satanivskij from comment #6)
I think that it is a firmware issue that MSI-X is configured like that for AHCI controllers.  Perhaps, there is a way to fix it up using some PCI magic configuration.
I would ask jhb@ about that.

Meanwhile, if you can build an image from source you can AHCI_Q_NOMSIX to the line that matches the controller in sys/dev/ahci/ahci_pci.c.
Comment 8 Andriy Gapon freebsd_committer freebsd_triage 2025-09-23 08:08:13 UTC
Regarding potential code improvements.

It seems that ahci_pci code uses some low level accesses for MSI-X information.
Those probably originate from early days of MSI-X support in FreeBSD.
I think that, e.g., a function like ahci_pci_read_msix_bars() could be replaced with or re-implemented in terms of standard pci bus methods like pci_msix_table_bar.
But that's a minor point.

I think that a failure to allocate one of those BARs should not translate to a failure to attach.
It should simply disable MSI-X for the device and proceed with other interrupt modes.

BTW, I wonder if pci_msix_table_bar_method and pci_msix_pba_bar_method, or even pci_read_cap before them, could do some verification of the MSI-X BARs.
Comment 9 Andriy Gapon freebsd_committer freebsd_triage 2025-09-23 08:15:06 UTC
(In reply to Vitalij Satanivskij from comment #4)
Could you please also add output of pciconf -r pci0:226:0:0 0x10 command?
Comment 10 Andriy Gapon freebsd_committer freebsd_triage 2025-09-23 08:16:28 UTC
(In reply to Vitalij Satanivskij from comment #4)
Just for easier reading, copying this from the attachment:
none0@pci0:226:0:0:	class=0x010601 rev=0x93 hdr=0x00 vendor=0x1022 device=0x7901 subvendor=0x15d9 subdevice=0x1c85
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'FCH SATA Controller [AHCI mode]'
    class      = mass storage
    subclass   = SATA
    bar   [24] = type Memory, range 32, base rxc5201000, size 2048, enabled
    cap 09[48] = vendor (length 8)
    cap 01[50] = powerspec 3  supports D0 D3  current D0
    cap 10[64] = PCI-Express 2 endpoint max data 128(256) RO NS
                 max read 512
                 link x16(x16) speed 32.0(32.0) ASPM disabled(L0s/L1)
    cap 05[a0] = MSI supports 16 messages, 64 bit 
    cap 11[c0] = MSI-X supports 1 message
                 Table in map 0x10[0x0], PBA in map 0x10[0x0]
    cap 12[d0] = SATA Index-Data Pair
    ecap 000b[100] = Vendor [1] ID 0001 Rev 1 Length 16
                 0b 00 01 15 01 00 01 01 00 00 00 00 00 00 00 00
    ecap 0001[150] = AER 2 0 fatal 0 non-fatal 1 corrected
    ecap 0019[270] = PCIe Sec 1 lane errors 0
    ecap 0026[410] = Physical Layer 16.0 GT/s 1
    ecap 0027[450] = Lane Margining at Receiver 1
    ecap 002a[500] = Physical Layer 32.0 GT/s 1
Comment 11 Vitalij Satanivskij 2025-09-23 08:36:36 UTC
(In reply to Andriy Gapon from comment #9)
Command return just 00000000 and nothing more...
Comment 12 Andriy Gapon freebsd_committer freebsd_triage 2025-09-23 08:37:43 UTC
(In reply to Vitalij Satanivskij from comment #11)
Thanks. That's what I expected but wanted to double-check.
Comment 13 Vitalij Satanivskij 2025-09-23 09:43:09 UTC
(In reply to Andriy Gapon from comment #7)
Yes. I boot installation with hw.pci.enable_msix=0 than install system.
Reboot with same variable and rebuild kernel with changed 
diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c
index 7451cc387011..b4e61a9f77fd 100644
--- a/sys/dev/ahci/ahci_pci.c
+++ b/sys/dev/ahci/ahci_pci.c
@@ -82,7 +82,7 @@ static const struct {
        {0x78031022, 0x00, "AMD Hudson-2",      0},
        {0x78041022, 0x00, "AMD Hudson-2",      0},
        {0x79001022, 0x00, "AMD KERNCZ",        0},
-       {0x79011022, 0x00, "AMD KERNCZ",        0},
+       {0x79011022, 0x00, "AMD KERNCZ",        AHCI_Q_NOMSIX},

This workaround work for me. At least we can continue to setup new servers for our services.
Comment 14 John Baldwin freebsd_committer freebsd_triage 2025-10-03 16:07:38 UTC
Probably the ahci driver needs to not treat the failure to bus_alloc_resource the BAR for the MSI-X table as fatal, and instead just fallback to using MSI or INTx in that case instead of reporting attach failure.  I'm attaching an alternate patch to try.  It also uses stock methods to query the BAR IDs.
Comment 15 John Baldwin freebsd_committer freebsd_triage 2025-10-03 16:08:51 UTC
Created attachment 264268 [details]
msix_nonfatal.patch
Comment 16 Andriy Gapon freebsd_committer freebsd_triage 2025-10-03 16:15:32 UTC
(In reply to John Baldwin from comment #15)
Just in case, the patch looks good to me.
Hopefully, Vitalij would be able to test it.
Comment 17 John Baldwin freebsd_committer freebsd_triage 2025-10-03 16:41:39 UTC
The patch doesn't actually compile (need to remove some unused variables).  I've split it into two commits for review:

https://reviews.freebsd.org/D52888
https://reviews.freebsd.org/D52889

Testing would certainly be appreciated.  Thanks for the report!
Comment 18 Vitalij Satanivskij 2025-10-03 17:32:17 UTC
(In reply to Andriy Gapon from comment #16)
Thank you for the proposed patch, I will have the opportunity to test it next week when we will be setting up the next batch of the same servers.
Comment 19 Vitalij Satanivskij 2025-10-06 14:43:59 UTC
(In reply to John Baldwin from comment #17)
I have already tested this patch on 14.3-STABLE on a server that had this issue — everything works perfectly.

Thank you for you help!
Comment 20 commit-hook freebsd_committer freebsd_triage 2025-10-06 17:57:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b658158e9396848d3963e9555d356d0f4ca6900a

commit b658158e9396848d3963e9555d356d0f4ca6900a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-10-06 17:56:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-10-06 17:56:47 +0000

    ahci: Don't fail attach if the MSI-X BARs cannot be allocated

    If the MSI-X table and/or PBA live in separate BAR(s) and those BAR(s)
    cannot be allocated, fall back to using MSI or INTx instead of failing
    attach.

    PR:             289748
    Reported by:    Vitalij Satanivskij <satan@Ukr.net>
    Reviewed by:    avg, imp
    Differential Revision:  https://reviews.freebsd.org/D52889

 sys/dev/ahci/ahci_pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Comment 21 commit-hook freebsd_committer freebsd_triage 2025-10-10 21:05:32 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fb939e88ba192fc75ebcbc863bcf1523e65a756b

commit fb939e88ba192fc75ebcbc863bcf1523e65a756b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-10-06 17:56:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-10-10 21:04:31 +0000

    ahci: Don't fail attach if the MSI-X BARs cannot be allocated

    If the MSI-X table and/or PBA live in separate BAR(s) and those BAR(s)
    cannot be allocated, fall back to using MSI or INTx instead of failing
    attach.

    PR:             289748
    Reported by:    Vitalij Satanivskij <satan@Ukr.net>
    Reviewed by:    avg, imp
    Differential Revision:  https://reviews.freebsd.org/D52889

    (cherry picked from commit b658158e9396848d3963e9555d356d0f4ca6900a)

 sys/dev/ahci/ahci_pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Comment 22 commit-hook freebsd_committer freebsd_triage 2025-10-10 21:05:33 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=07f4fa7a0db931c47cc78c711e05d5d51a4e2448

commit 07f4fa7a0db931c47cc78c711e05d5d51a4e2448
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-10-06 17:56:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-10-10 21:04:35 +0000

    ahci: Don't fail attach if the MSI-X BARs cannot be allocated

    If the MSI-X table and/or PBA live in separate BAR(s) and those BAR(s)
    cannot be allocated, fall back to using MSI or INTx instead of failing
    attach.

    PR:             289748
    Reported by:    Vitalij Satanivskij <satan@Ukr.net>
    Reviewed by:    avg, imp
    Differential Revision:  https://reviews.freebsd.org/D52889

    (cherry picked from commit b658158e9396848d3963e9555d356d0f4ca6900a)

 sys/dev/ahci/ahci_pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Comment 23 alt2600 2025-10-29 21:52:36 UTC
is there any chance of or an eta when this might hit errata for releng 14.3? ran into this with my new system around a Gigabyte MH53-G40 motherboard. Was able to disable MISX to transfer from spinning rust to new nvme based pool, but would like to re-use the old drives for backups and additional storage. as I need MISX for bnxt drivers, and some other hardware running with it disabled is something I want to avoid on my new workstation.

not sure if 
https://reviews.freebsd.org/D52888

is needed too. Would like to avoid running on hacked source by manually applying the patch as I'm not in an immediate rush, just don't want to hit it again when going to 14.4 or 15.0 when those release.
Comment 24 John Baldwin freebsd_committer freebsd_triage 2025-10-30 14:19:35 UTC
I had not planned on pushing for an EN for 14.3, in part because we do not build new install images for ENs, only binary updates, so an EN wouldn't let you install onto disks behind an affected AHCI controller.  Both 14.4 and 15.0 will include this fix.