From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795043282; b=ppOhzvH1Fa5UyQMnBShEoduMkPkARxJm66tmfuAg1nuCMAdvMLWVhmy8YI/YjflnvOM4 6VRCwTcoJAj4LGhYpAG5bH1XYVYw0StKLPpAMgvZYHq7gQUnYdFPo73bUX5DVlvkEQz1N yPtIwDzlBN7RUdItUOTgY3gbS1KvKDl54THV2HxpIbKnmxlIBlAGtqQhM3lcAAEtQ9+PP uEz4zKNYHeDJ8U4A5E/qXkLZaBgvK+XSfopAqg+uOroSlvHxi0+1EnXI4owrglVaZdhJn Qz09khjA44FlgtVyb9wDoVudcwVBDMARfeaaos/y4p9M1+P2A8lEffEjOhUpb0gvXOg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795043282; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=BiSiaDlBUQiN5+xYlD1Qk4DZDmZDVhlEu2yllqXJAy0=; b=glSYojnjc8Kt8jD9Jk9oOFxnWo0WomQKtsWPezRgH+DmHK/ak0CFnLRhFDV06i8Okyyi A+FYRsn6N4PPvr/+pfbcroy+7CeSTGkJmvfk0Xf1joxD0SPl/gv9DxCJ5UEJoMQLmC9VG Amxg0EkMqKJUiygf9pRLnte3lqMsgfsBGfLSwq5YxpIbsx4QAb7QjfoMi8hX/1Vh8211m ASwljn0YmkHMgh81t5K8GLcuxDfVOxDtd5aipwTTxPa+L5SVNmyxCZUoR5TVsGQpC3xvc SmZKHCXnOizMKL12etxQxXtvgcK3K+XUThBMyK6c0v1vOq/GgYN9c5eRrqurSsii/OQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=VpsmxSXk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0599606A320; Wed, 18 Nov 2026 23:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=VpsmxSXk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457F71F000C4; Wed, 18 Nov 2026 23:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795043281; bh=BiSiaDlBUQiN5+xYlD1Qk4DZDmZDVhlEu2yllqXJAy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VpsmxSXk7Xca9wUnPZQrtAS/kyuaV7OMJ37zOG7YNsiCNKmA91ikNVBiRztfg2dbd RhxatMviy6Ot4Faq8RinlM57NGw10Q5gxarp3xvmAu07xR7qgeQbRqFHpYE11HePb2 ALnvlu57dsiTP19mSRRBx2lQmJLpEAGkIV30CHP8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Brian Norris , Bjorn Helgaas , Lukas Wunner , Sasha Levin Subject: [PATCH 6.1 0148/2857] PCI/portdrv: Allow probing even without child services Date: Wed, 18 Nov 2026 15:19:42 +0100 Message-ID: <20261118150206.676638346@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brian Norris [ Upstream commit 834171efeefffb1a0f2136f32e76669bbc11db86 ] The PCIe port driver fails to probe if it finds no child services, presumably under the assumption that the driver is not useful in that case. However, the driver *can* still be useful for power management support -- namely, it still configures the port for runtime PM / D3, which may be important for allowing a bridge to enter low power modes. Thus, allow probe to succeed even if no IRQs and no child services are available. This also mirrors existing behavior for ports that don't support any portdrv services (PCIe hotplug, AER, DPC, PME, bwctrl), where we'd also probe successfully. This change is a bit more important after commit f5cd8a929c82 ("PCI: dwc: Remove MSI/MSIX capability for Root Port if iMSI-RX is used as MSI controller"), because it's common for some DWC-based systems to: 1. have only the "aer" and "pcie_pme" port services available and 2. not define legacy INTx interrupts properly in their device tree. After commit f5cd8a929c82, such systems may fail pcie_init_service_irqs() and so exit with -ENODEV. Link: https://lore.kernel.org/all/nyada24tqwlkzdceyoxbzitzygvp4elvj5oajnqdwb33xkcdwk@76vnrx45fsfd/ Signed-off-by: Brian Norris [bhelgaas: reorder pcie_port_device_register() decls per Lukas] Signed-off-by: Bjorn Helgaas Reviewed-by: Lukas Wunner Link: https://patch.msgid.link/20260722160942.v4.1.I5fd5d83f518681b3949d8ab2f16ba8244fd3e774@changeid Signed-off-by: Sasha Levin --- drivers/pci/pcie/portdrv_core.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 8b7aadc716ae8..aaf8605cc9411 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -312,8 +312,8 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq) */ int pcie_port_device_register(struct pci_dev *dev) { - int status, capabilities, i, nr_service; int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; + int status, capabilities, i; /* Enable PCI Express port device */ status = pci_enable_device(dev); @@ -337,29 +337,29 @@ int pcie_port_device_register(struct pci_dev *dev) if (status) { capabilities &= PCIE_PORT_SERVICE_HP; if (!capabilities) - goto error_disable; + goto out; } /* Allocate child services if any */ - status = -ENODEV; - nr_service = 0; for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { int service = 1 << i; if (!(capabilities & service)) continue; - if (!pcie_device_init(dev, service, irqs[i])) - nr_service++; + if (pcie_device_init(dev, service, irqs[i])) + capabilities &= ~service; } - if (!nr_service) - goto error_cleanup_irqs; - return 0; +out: + /* + * With no child services, we shouldn't need bus mastering or any IRQ + * vectors we allocated. + */ + if (!capabilities) { + pci_free_irq_vectors(dev); + pci_clear_master(dev); + } -error_cleanup_irqs: - pci_free_irq_vectors(dev); -error_disable: - pci_disable_device(dev); - return status; + return 0; } typedef int (*pcie_callback_t)(struct pcie_device *); -- 2.53.0