public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Han Gao <gaohan@iscas.ac.cn>
To: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Jonathan Cameron" <jonathan.cameron@huawei.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Kees Cook" <kees@kernel.org>, "Han Gao" <gaohan@iscas.ac.cn>,
	"Chen Wang" <unicorn_wang@outlook.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>
Cc: linux-pci@vger.kernel.org, sophgo@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	Han Gao <rabenda.cn@gmail.com>,
	Icenowy Zheng <zhengxingda@iscas.ac.cn>,
	Inochi Amaoto <inochiama@gmail.com>,
	Vivian Wang <wangruikang@iscas.ac.cn>, Yao Zi <me@ziyao.cc>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] PCI: Add per-device flag to disable native PCIe port services
Date: Wed,  1 Apr 2026 01:56:57 +0800	[thread overview]
Message-ID: <20260331175658.1015829-2-gaohan@iscas.ac.cn> (raw)
In-Reply-To: <20260331175658.1015829-1-gaohan@iscas.ac.cn>

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


       reply	other threads:[~2026-03-31 17:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260331175658.1015829-1-gaohan@iscas.ac.cn>
2026-03-31 17:56 ` Han Gao [this message]
2026-03-31 17:56 ` [PATCH 2/2] PCI: Add quirk to disable PCIe port services on Sophgo SG2042 Han Gao
2026-05-01 16:53   ` Manivannan Sadhasivam
2026-05-02 13:58     ` Icenowy Zheng
2026-05-02 19:47       ` Lukas Wunner
2026-05-03  7:10         ` Icenowy Zheng
2026-05-03  8:52           ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260331175658.1015829-2-gaohan@iscas.ac.cn \
    --to=gaohan@iscas.ac.cn \
    --cc=bhelgaas@google.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=inochiama@gmail.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lukas@wunner.de \
    --cc=mani@kernel.org \
    --cc=me@ziyao.cc \
    --cc=rabenda.cn@gmail.com \
    --cc=sophgo@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=unicorn_wang@outlook.com \
    --cc=wangruikang@iscas.ac.cn \
    --cc=zhengxingda@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox