From patchwork Tue Nov 28 08:15:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13470606 X-Patchwork-Delegate: bhelgaas@google.com Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6E2B168CA; Tue, 28 Nov 2023 08:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RHUCTUN8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B476C433C7; Tue, 28 Nov 2023 08:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701159324; bh=hZl0Zl2shFZ9nd3i3exKHPLcrEYuE5Q2dGx/0v/2UmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RHUCTUN8GpfK2qw9YG3t3WUpZ9OZZSAgsODxI7qZCH9vzISzi1F8eC0qa1rW5f6Sz alWD3mRUTC9KjJpB7dC6VmfJiQVnEDyR+FM3y+r44EVKNAe4imgDRToE4wMRMg9+2y UjsOlhGo0e9M6QqzwuTYr+aWI0ikhFWMYPlNdNiICzSd+ClUWMPv4Pv0Ex7kxwCsgT UqrXJKK1RcWvnrMaYvxA/7lBqafpUrydIE8HvK8lnG6+8dn9LVJPrAIySV4NdkwgC5 iEbVty5i6hi2WP3/RgfLY1r6g4NDNHN6eXkJS4NN1W1i5nZkIrZmQpCQ/TEpa94/Da zA2Vsjp4h0AeQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r7tG4-00053r-1s; Tue, 28 Nov 2023 09:15:52 +0100 From: Johan Hovold To: "Lorenzo Pieralisi" , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , "Bjorn Helgaas" Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , Rob Herring , Nirmal Patel , Jonathan Derrick , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Michael Bottini , "David E . Box" , Manivannan Sadhasivam Subject: [PATCH v2 2/6] PCI: vmd: Fix deadlock when enabling ASPM Date: Tue, 28 Nov 2023 09:15:08 +0100 Message-ID: <20231128081512.19387-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231128081512.19387-1-johan+linaro@kernel.org> References: <20231128081512.19387-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The vmd_pm_enable_quirk() helper is called from pci_walk_bus() during probe to enable ASPM for controllers with VMD_FEAT_BIOS_PM_QUIRK set. Since pci_walk_bus() already holds a pci_bus_sem read lock, use the new locked helper to enable link states in order to avoid a potential deadlock (e.g. in case someone takes a write lock before reacquiring the read lock). Fixes: f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR") Cc: stable@vger.kernel.org # 6.3 Cc: Michael Bottini Cc: David E. Box Reviewed-by: Manivannan Sadhasivam Signed-off-by: Johan Hovold --- drivers/pci/controller/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 94ba61fe1c44..0452cbc362ee 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -751,7 +751,7 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) if (!(features & VMD_FEAT_BIOS_PM_QUIRK)) return 0; - pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR); if (!pos)