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=1793829624; b=Qtr8TOlcKV1e0IaePLYKvJbUJJ9xxCncXvT5J4euAlGUd0VZRnmmZrHojvSBxC+uNWCS /mUkHtbTG4w1bqz8FK+aMugI/DHXe7xcG4n18WCexmMhbjHzT2Ir0Z907NF3i2Z35lRXR RBY/kagW0iCM2c0ixos2K66qYx3PcY8bRMsWMHa3htMlFbr+9sq0N5zj8uJ3wJg2U91Eg Gdcjm5TORQFvmYRtda6F9PVezuN/uSKJW6Yrv7veVT08Xx39pNY9mLMT85fRKC4Dtzhj8 QHxgtfgqwQ9B6atlFzQrUJegCGU3zsEBzrdugIcs93BjKowrY2t4GxVdTgbvVh981fQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793829624; 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=wgUycRcJhSQtmKv7SPjHWf2ARfQcLLerW3KdUxQifE8=; b=y+gCM/KLEoy2C4PY5jsZ0yN09VH2CyaxqnP6g0NjTQFgUzPAViguifdgW9+jOLmus89s Dlyyk+W667vJZZRgRacKZQ9Q/9Os/o9ZfKhhBxui254L4zgvSjpS0twJRy6WIcFJtmTeN 7W+jwZb8ITulCKQhPF8OdqHHVegq1JZWcDLHw9V2fKzhGBgid4tGiBLm1CuvrcZCh8yKT D8050hzRvM8dOjTPFWnwz5LYUR6Li/pBoFN8+WGO2QvKNDwP0x7wMFgxhQ1cwGeo5S2Es K4jUedTEUo1zdgxy1xrW2lsSUCT23AJFVCcc7a5yXVgU13FswKionKoOPHpAA//pF9g== 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="r/BOBP92"; 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 8336D606A84C; Wed, 4 Nov 2026 22:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=r/BOBP92 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B12E1F00A02; Wed, 4 Nov 2026 22:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793829624; bh=wgUycRcJhSQtmKv7SPjHWf2ARfQcLLerW3KdUxQifE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r/BOBP92oCJcn/Fak0xJPeJdec4RePsmRt0HHSs5tLIh3WBlXYrC/nhQz7PnVlE5I 4SNPHCFVf0n8sOg8NIoz3ESu9DAm64In1J4FGWXcx0df0a6a7WyoMNurqw/hQ5rHUo ehLAHf+GEdmj5xOL+ec9441ALrA0yawW7VP3Oy5M= 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.18 0241/1005] PCI/portdrv: Allow probing even without child services Date: Wed, 4 Nov 2026 15:59:34 -0500 Message-ID: <20261104211050.608345814@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261104211043.516122098@linuxfoundation.org> References: <20261104211043.516122098@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index a0991da482136..91d1482221a8c 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -330,8 +330,8 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq) */ static 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); @@ -355,29 +355,29 @@ static 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