From nobody Sun Jun 14 01:40:06 2026 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 916E240DFDA; Tue, 5 May 2026 00:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777939422; cv=none; b=K3EjMNdpNFgarGXbHOHftDX7CF2SbADKW1oGWeorFMp+EV8YTQN/cSQVg3HhNHYHOprLwIWS+wtpw3+sXyfqDgNAOaWzxcsuZp3nOzhAnl6+5st3mIsKk0Ke048zjSbKm/NlAqnaeuyPTri3z76CEEJem5xwVQt1W8GMs5unIek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777939422; c=relaxed/simple; bh=DHRz70Uo8B2FnHnKsVX8mUEtmQ7/qOybRXfNRinc8G4=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=oudW7yGcLrBnzHviPKATkGJxuS3+d4iJVQE9fYdCbugUL7ptzzAghRFGNuU5IyaAhN9DhII/NXWCC2UOUg0FWMLl6qMiSbx6FGQ7Aqrv25c0QPDPcyQu2o/Sov6j6YukUuLW2Mr7IEAqeGEI0S5cc8ZAhErck8gBfHvaEzlz3rQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk; spf=none smtp.mailfrom=orcam.me.uk; arc=none smtp.client-ip=78.133.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id 916C492009D; Tue, 5 May 2026 02:03:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 8B34C92009B; Tue, 5 May 2026 01:03:39 +0100 (BST) Date: Tue, 5 May 2026 01:03:39 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky cc: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] PCI: Export pci_parent_bus_reset() for drivers to use In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Export pci_parent_bus_reset() so that drivers do not duplicate it. =20 Document the interface. Signed-off-by: Maciej W. Rozycki --- Changes from v1,=20 : - Reword function description so as to list the return values separately. --- drivers/pci/pci.c | 17 ++++++++++++++++- include/linux/pci.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) linux-pci-parent-bus-reset-export.diff Index: linux-macro/drivers/pci/pci.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/pci/pci.c +++ linux-macro/drivers/pci/pci.c @@ -4833,7 +4833,21 @@ int pci_bridge_secondary_bus_reset(struc } EXPORT_SYMBOL_GPL(pci_bridge_secondary_bus_reset); =20 -static int pci_parent_bus_reset(struct pci_dev *dev, bool probe) +/** + * pci_parent_bus_reset - Reset a device via its upstream PCI bridge + * @dev: Device to reset. + * @probe: Only check if reset is possible if TRUE, actually reset if FALS= E. + * + * Perform a device reset by requesting a secondary bus reset via the + * device's immediate upstream PCI bridge. Return failure if the reset + * failed or it could not have been issued in the first place because + * the device is not on a secondary bus of any PCI bridge or it wouldn't + * be the only device reset. If probing, then only verify whether it + * would be possible to issue a reset. + * + * Returns: 0 if successful or -ENOTTY otherwise. + */ +int pci_parent_bus_reset(struct pci_dev *dev, bool probe) { struct pci_dev *pdev; =20 @@ -4850,6 +4864,7 @@ static int pci_parent_bus_reset(struct p =20 return pci_bridge_secondary_bus_reset(dev->bus->self); } +EXPORT_SYMBOL_GPL(pci_parent_bus_reset); =20 static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, bool probe) { Index: linux-macro/include/linux/pci.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/include/linux/pci.h +++ linux-macro/include/linux/pci.h @@ -1595,6 +1595,7 @@ int devm_request_pci_bus_resources(struc =20 /* Temporary until new and working PCI SBR API in place */ int pci_bridge_secondary_bus_reset(struct pci_dev *dev); +int pci_parent_bus_reset(struct pci_dev *dev, bool probe); =20 #define __pci_bus_for_each_res0(bus, res, ...) \ for (unsigned int __b =3D 0; \ From nobody Sun Jun 14 01:40:06 2026 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D9F240DFDA; Tue, 5 May 2026 00:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.133.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777939428; cv=none; b=cLYFXx+onbDMxR8gMXodrm+Fdw73iOs13wpNNfmYssESfTwU3lq1dNgr/3FbGrFAewOXAtqueTVXSyu7r3blU0FGgVjpjWTU2u+rElhO8zz+mfrEyn+REq1/PM6qjfy6HjHIP7cC+6NLaOX5n9xTm4P0FhedOUfsqMw8RVKg1Us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777939428; c=relaxed/simple; bh=px/8GFAzdk8jkuSUualcaZDsIBX2i3S5hcIxDgVDBtY=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=rAACQNAS2WsbLJ65XsAgoD805/Xd9nicv3VMvJF7duwOqB7SXbYtnqOcJiuUW5ty4XW1mPORWQUrzgpL70tJMAjxDMR0uPP7FMhMFqom4k06YrMhBrp39dkFx6T9C1T1EZR1bF5vU/1+zeYoVw3YuYiHymZG/chfq9HlQiddP+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk; spf=none smtp.mailfrom=orcam.me.uk; arc=none smtp.client-ip=78.133.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id 4376F92009D; Tue, 5 May 2026 02:03:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 3D6C192009C; Tue, 5 May 2026 01:03:46 +0100 (BST) Date: Tue, 5 May 2026 01:03:46 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky cc: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] IB/hfi1: Remove pci_parent_bus_reset() duplication In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Call pci_parent_bus_reset() rather than duplicating it in trigger_sbr(). There are extra preparatory checks made by the former function, but they=20 are supposed to be neutral to the HFI1 device. Signed-off-by: Maciej W. Rozycki Reviewed-by: Ilpo J=C3=A4rvinen --- No change from v1,=20 . --- drivers/infiniband/hw/hfi1/pcie.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) linux-ib-hfi1-pcie-sbr-parent-bus-reset.diff Index: linux-macro/drivers/infiniband/hw/hfi1/pcie.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/infiniband/hw/hfi1/pcie.c +++ linux-macro/drivers/infiniband/hw/hfi1/pcie.c @@ -791,35 +791,13 @@ static void pcie_post_steps(struct hfi1_ /* * Trigger a secondary bus reset (SBR) on ourselves using our parent. * - * Based on pci_parent_bus_reset() which is not exported by the - * kernel core. + * This is an end around to do an SBR during probe time. A new API + * needs to be implemented to have cleaner interface but this fixes + * the current brokenness. */ static int trigger_sbr(struct hfi1_devdata *dd) { - struct pci_dev *dev =3D dd->pcidev; - struct pci_dev *pdev; - - /* need a parent */ - if (!dev->bus->self) { - dd_dev_err(dd, "%s: no parent device\n", __func__); - return -ENOTTY; - } - - /* should not be anyone else on the bus */ - list_for_each_entry(pdev, &dev->bus->devices, bus_list) - if (pdev !=3D dev) { - dd_dev_err(dd, - "%s: another device is on the same bus\n", - __func__); - return -ENOTTY; - } - - /* - * This is an end around to do an SBR during probe time. A new API needs - * to be implemented to have cleaner interface but this fixes the - * current brokenness - */ - return pci_bridge_secondary_bus_reset(dev->bus->self); + return pci_parent_bus_reset(dd->pcidev, PCI_RESET_DO_RESET); } =20 /*