git: 0ecbb75c33d3 - main - LinuxKPI: set pci_dev msi_cap and msix_cap

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Wed, 04 Nov 2026 22:49:58 UTC
The branch main has been updated by adrian:

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

commit 0ecbb75c33d38645ea72dca7219c082eedbc8677
Author:     Quentin Thébault <quentin.thebault@defenso.fr>
AuthorDate: 2026-11-04 22:49:18 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-11-04 22:49:40 +0000

    LinuxKPI: set pci_dev msi_cap and msix_cap
    
    Linux drivers find their MSI and MSI-X registers through pdev->msi_cap and
    pdev->msix_cap, which hold where those capabilities start in PCI config
    space.  LinuxKPI never set them, so they stayed 0, and every access meant
    for the MSI registers went to the start of config space instead.
    
    Drivers using these fields, e.g. ath11k and amdgpu, are affected.
    
    Fill in both fields from the capability offsets that the native PCI code
    already records.
    
    Reviewed by:    dumbbell
    Differential Revision:  https://reviews.freebsd.org/D61125
    Event: NetApp/Vendor Summit Hackathon 202611
---
 sys/compat/linuxkpi/common/src/linux_pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 9509cc81fa72..8270f3bed54a 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -521,6 +521,8 @@ lkpi_pci_dev_init_common(device_t dev, struct pci_dev *pdev)
 		 */
 		pdev->bus->self = pdev;
 	}
+	pdev->msi_cap = dinfo->cfg.msi.msi_location;
+	pdev->msix_cap = dinfo->cfg.msix.msix_location;
 	pdev->dev.bsddev = dev;
 	pdev->dev.parent = &linux_root_device;