* [PATCH 0/2] PCI: Allow disabling port services on broken root ports
@ 2026-03-31 17:56 Han Gao
2026-03-31 17:56 ` [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services Han Gao
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Han Gao @ 2026-03-31 17:56 UTC (permalink / raw)
To: Bjorn Helgaas, Uwe Kleine-König, Jonathan Cameron,
Lukas Wunner, Ilpo Järvinen, Kees Cook, Han Gao, Chen Wang,
Manivannan Sadhasivam
Cc: linux-pci, sophgo, linux-kernel, linux-riscv, Han Gao,
Icenowy Zheng, Inochi Amaoto, Vivian Wang, Yao Zi
Some PCIe root ports break MSI delivery to downstream devices when
native port services (AER, PME, bwctrl, etc.) are active. The existing
pcie_ports=compat kernel parameter works around this globally, but
affects all ports on the system.
This series adds a per-device mechanism to skip port service probing:
1. Introduce PCI_DEV_FLAGS_NO_PORT_SERVICES flag and wire it into
the PCIe port driver
2. Apply it via quirk to Sophgo SG2042 root ports [1f1c:2042], which
fail to deliver MSI interrupts when port services are enabled
SG2042's PCIe root ports only support MSI, not MSI-X. The MSI
controller provides only 32 vectors shared across all devices behind
each root port. When native port services claim vectors from this
limited pool, downstream devices are starved of interrupts, resulting
in zero interrupts delivered and driver timeouts (e.g. amdgpu fence
fallback timer expired on all rings).
Han Gao (2):
PCI: Add per-device flag to disable native PCIe port services
PCI: Add quirk to disable PCIe port services on Sophgo SG2042
drivers/pci/pcie/portdrv.c | 3 +++
drivers/pci/quirks.c | 12 ++++++++++++
include/linux/pci.h | 2 ++
include/linux/pci_ids.h | 2 ++
4 files changed, 19 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services
2026-03-31 17:56 [PATCH 0/2] PCI: Allow disabling port services on broken root ports Han Gao
@ 2026-03-31 17:56 ` Han Gao
2026-03-31 17:56 ` [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042 Han Gao
2026-03-31 18:58 ` [PATCH 0/2] PCI: Allow disabling port services on broken root ports Lukas Wunner
2 siblings, 0 replies; 5+ messages in thread
From: Han Gao @ 2026-03-31 17:56 UTC (permalink / raw)
To: Bjorn Helgaas, Uwe Kleine-König, Jonathan Cameron,
Lukas Wunner, Ilpo Järvinen, Kees Cook, Han Gao, Chen Wang,
Manivannan Sadhasivam
Cc: linux-pci, sophgo, linux-kernel, linux-riscv, Han Gao,
Icenowy Zheng, Inochi Amaoto, Vivian Wang, Yao Zi, stable
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 <gaohan@iscas.ac.cn>
---
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 2d6aa488fe7b..3386818d200d 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 1c270f1d5123..e038fe14ef78 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 {
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042
2026-03-31 17:56 [PATCH 0/2] PCI: Allow disabling port services on broken root ports Han Gao
2026-03-31 17:56 ` [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services Han Gao
@ 2026-03-31 17:56 ` Han Gao
2026-03-31 18:58 ` [PATCH 0/2] PCI: Allow disabling port services on broken root ports Lukas Wunner
2 siblings, 0 replies; 5+ messages in thread
From: Han Gao @ 2026-03-31 17:56 UTC (permalink / raw)
To: Bjorn Helgaas, Uwe Kleine-König, Jonathan Cameron,
Lukas Wunner, Ilpo Järvinen, Kees Cook, Han Gao, Chen Wang,
Manivannan Sadhasivam
Cc: linux-pci, sophgo, linux-kernel, linux-riscv, Han Gao,
Icenowy Zheng, Inochi Amaoto, Vivian Wang, Yao Zi, stable
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 <gaohan@iscas.ac.cn>
---
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 48946cca4be7..bbde482ff7cb 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 406abf629be2..9663be526dd0 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
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] PCI: Allow disabling port services on broken root ports
2026-03-31 17:56 [PATCH 0/2] PCI: Allow disabling port services on broken root ports Han Gao
2026-03-31 17:56 ` [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services Han Gao
2026-03-31 17:56 ` [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042 Han Gao
@ 2026-03-31 18:58 ` Lukas Wunner
2026-03-31 19:07 ` Han Gao
2 siblings, 1 reply; 5+ messages in thread
From: Lukas Wunner @ 2026-03-31 18:58 UTC (permalink / raw)
To: Han Gao
Cc: Bjorn Helgaas, Uwe Kleine-König, Jonathan Cameron,
Ilpo Järvinen, Kees Cook, Chen Wang, Manivannan Sadhasivam,
linux-pci, sophgo, linux-kernel, linux-riscv, Han Gao,
Icenowy Zheng, Inochi Amaoto, Vivian Wang, Yao Zi
On Wed, Apr 01, 2026 at 01:56:56AM +0800, Han Gao wrote:
> SG2042's PCIe root ports only support MSI, not MSI-X. The MSI
> controller provides only 32 vectors shared across all devices behind
> each root port. When native port services claim vectors from this
> limited pool, downstream devices are starved of interrupts, resulting
> in zero interrupts delivered and driver timeouts (e.g. amdgpu fence
> fallback timer expired on all rings).
Have you considered setting the pci_dev::no_msi flag on the Root Ports
to force them to use INTx interrupts instead of MSI? That would seem
like a cleaner solution. There are already several devices for which
the flag is set in drivers/pci/quirks.c, see quirk_no_msi().
> Some PCIe root ports break MSI delivery to downstream devices when
> native port services (AER, PME, bwctrl, etc.) are active. The existing
> pcie_ports=compat kernel parameter works around this globally, but
> affects all ports on the system.
>
> This series adds a per-device mechanism to skip port service probing:
> 1. Introduce PCI_DEV_FLAGS_NO_PORT_SERVICES flag and wire it into
> the PCIe port driver
> 2. Apply it via quirk to Sophgo SG2042 root ports [1f1c:2042], which
> fail to deliver MSI interrupts when port services are enabled
I think we should try to minimize such workarounds or at least make them
as non-intrusive as possible, so please try the no_msi approach instead.
I also don't see why the stable designation is needed TBH.
Thanks,
Lukas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] PCI: Allow disabling port services on broken root ports
2026-03-31 18:58 ` [PATCH 0/2] PCI: Allow disabling port services on broken root ports Lukas Wunner
@ 2026-03-31 19:07 ` Han Gao
0 siblings, 0 replies; 5+ messages in thread
From: Han Gao @ 2026-03-31 19:07 UTC (permalink / raw)
To: Lukas Wunner
Cc: Han Gao, Bjorn Helgaas, Uwe Kleine-König, Jonathan Cameron,
Ilpo Järvinen, Kees Cook, Chen Wang, Manivannan Sadhasivam,
linux-pci, sophgo, linux-kernel, linux-riscv, Icenowy Zheng,
Inochi Amaoto, Vivian Wang, Yao Zi
On Wed, Apr 1, 2026 at 2:58 AM Lukas Wunner <lukas@wunner.de> wrote:
>
> On Wed, Apr 01, 2026 at 01:56:56AM +0800, Han Gao wrote:
> > SG2042's PCIe root ports only support MSI, not MSI-X. The MSI
> > controller provides only 32 vectors shared across all devices behind
> > each root port. When native port services claim vectors from this
> > limited pool, downstream devices are starved of interrupts, resulting
> > in zero interrupts delivered and driver timeouts (e.g. amdgpu fence
> > fallback timer expired on all rings).
>
> Have you considered setting the pci_dev::no_msi flag on the Root Ports
> to force them to use INTx interrupts instead of MSI? That would seem
> like a cleaner solution. There are already several devices for which
> the flag is set in drivers/pci/quirks.c, see quirk_no_msi().
Unfortunately, the SG2042 has no INTx interrupts.
>
> > Some PCIe root ports break MSI delivery to downstream devices when
> > native port services (AER, PME, bwctrl, etc.) are active. The existing
> > pcie_ports=compat kernel parameter works around this globally, but
> > affects all ports on the system.
> >
> > This series adds a per-device mechanism to skip port service probing:
> > 1. Introduce PCI_DEV_FLAGS_NO_PORT_SERVICES flag and wire it into
> > the PCIe port driver
> > 2. Apply it via quirk to Sophgo SG2042 root ports [1f1c:2042], which
> > fail to deliver MSI interrupts when port services are enabled
>
> I think we should try to minimize such workarounds or at least make them
> as non-intrusive as possible, so please try the no_msi approach instead.
>
> I also don't see why the stable designation is needed TBH.
6.18 has merged PCIe drivers, so a stable tag is required.
>
> Thanks,
>
> Lukas
Han
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-31 19:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 17:56 [PATCH 0/2] PCI: Allow disabling port services on broken root ports Han Gao
2026-03-31 17:56 ` [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services Han Gao
2026-03-31 17:56 ` [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042 Han Gao
2026-03-31 18:58 ` [PATCH 0/2] PCI: Allow disabling port services on broken root ports Lukas Wunner
2026-03-31 19:07 ` Han Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox