From a35e809e9cf16d9810c7b5ca8e02d625521e2b68 Mon Sep 17 00:00:00 2001 From: Han Gao Date: Wed, 1 Apr 2026 01:56:57 +0800 Subject: [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services Add PCI_DEV_FLAGS_NO_PORT_SERVICES to allow quirks to prevent the PCIe port service driver from probing specific devices. This provides a per-device equivalent of the global pcie_ports=compat kernel parameter. Some platforms have PCIe root ports that break MSI delivery to downstream devices when native port services (AER, PME, bwctrl, etc.) are active. The existing pci_host_bridge native_* flags do not cover all services (notably bwctrl), so a mechanism to skip port driver probing entirely on a per-device basis is needed. Cc: stable@vger.kernel.org Signed-off-by: Han Gao Signed-off-by: Linux RISC-V bot --- drivers/pci/pcie/portdrv.c | 3 +++ include/linux/pci.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index 88af0dacf35131..3c31524af9e4b5 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -685,6 +685,9 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { static int pcie_portdrv_probe(struct pci_dev *dev, const struct pci_device_id *id) { + if (dev->dev_flags & PCI_DEV_FLAGS_NO_PORT_SERVICES) + return -ENODEV; + int type = pci_pcie_type(dev); int status; diff --git a/include/linux/pci.h b/include/linux/pci.h index 1c270f1d512301..e038fe14ef7830 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -253,6 +253,8 @@ enum pci_dev_flags { * integrated with the downstream devices and doesn't use real PCI. */ PCI_DEV_FLAGS_PCI_BRIDGE_NO_ALIAS = (__force pci_dev_flags_t) (1 << 14), + /* Do not use native PCIe port services (equivalent to pcie_ports=compat) */ + PCI_DEV_FLAGS_NO_PORT_SERVICES = (__force pci_dev_flags_t) (1 << 15), }; enum pci_irq_reroute_variant { From a7db2bd66de3af0f72a48658eae2b0a89a041a1b Mon Sep 17 00:00:00 2001 From: Han Gao Date: Wed, 1 Apr 2026 01:56:58 +0800 Subject: [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042 SG2042's PCIe root ports [1f1c:2042] fail to deliver MSI interrupts to downstream devices when native port services are enabled. Devices under an affected root port receive zero interrupts despite successful vector allocation, causing driver timeouts (e.g. amdgpu fence fallback timer expired on all rings). Set PCI_DEV_FLAGS_NO_PORT_SERVICES on SG2042 root ports to prevent the port service driver from probing, restoring correct MSI delivery. Fixes: 1c72774df028 ("PCI: sg2042: Add Sophgo SG2042 PCIe driver") Cc: stable@vger.kernel.org Signed-off-by: Han Gao Signed-off-by: Linux RISC-V bot --- drivers/pci/quirks.c | 12 ++++++++++++ include/linux/pci_ids.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 48946cca4be72c..bbde482ff7cb7c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -6380,3 +6380,15 @@ static void pci_mask_replay_timer_timeout(struct pci_dev *pdev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9750, pci_mask_replay_timer_timeout); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9755, pci_mask_replay_timer_timeout); #endif + +/* + * SG2042's PCIe root ports do not correctly deliver MSI interrupts to + * downstream devices when native PCIe port services are enabled. All + * services including bwctrl must be disabled, equivalent to pcie_ports=compat. + */ +static void quirk_sg2042_no_port_services(struct pci_dev *dev) +{ + pci_info(dev, "SG2042: disabling native PCIe port services\n"); + dev->dev_flags |= PCI_DEV_FLAGS_NO_PORT_SERVICES; +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOPHGO, 0x2042, quirk_sg2042_no_port_services); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 406abf629be2e4..9663be526dd0f6 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2630,6 +2630,8 @@ #define PCI_VENDOR_ID_CXL 0x1e98 +#define PCI_VENDOR_ID_SOPHGO 0x1f1c + #define PCI_VENDOR_ID_TEHUTI 0x1fc9 #define PCI_DEVICE_ID_TEHUTI_3009 0x3009 #define PCI_DEVICE_ID_TEHUTI_3010 0x3010