From mboxrd@z Thu Jan 1 00:00:00 1970 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 2A56C1E0DFD; Wed, 6 Nov 2024 12:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897539; cv=none; b=M5u7X2r7vgBnSe8/o3LiMd0QvuGrGREImS12bL+GHYamK83MFOhtKuoVMZxPErTYo0ZBF73O6u0yLkmi/iOEAeJidYaNvqmGzwMvPb9zyQ0mCgcYAvmEuCw63MHCzFCooQPx8SgcqbtDAwmqyKLVqgjsUtkEaAFojXyAlZHVh1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897539; c=relaxed/simple; bh=ul7/HgkcCKJ5v2WaC0VTyQDtb6bLu6N1PAU/3/O1ObQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kCX0C4qvCOcOIZLoZrtwg2jqzon6PmTSrjQXN95FV8tRRzbeG7fz4BkOYCKQW9/J7oMGtU2Vw8BCQx1AukQHeh4kdlp7vmuNJvl2y/r00MhdZwa9q1k0eEYKff5aNqTX+2Pse5b+VF9lAVhv5WswFemJG6m5OvfwiuX9nRMsG4w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=djkpgY8Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="djkpgY8Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A585CC4CECD; Wed, 6 Nov 2024 12:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730897539; bh=ul7/HgkcCKJ5v2WaC0VTyQDtb6bLu6N1PAU/3/O1ObQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=djkpgY8QJYi68dg/obteS4e0OeNNYkZImuUsOhhQT6fo0zvbxutxYsYS9I1LzdE8r jfbzIOIwceGV1JtMoIgIiYhn6Qp0slj1g4km/0mzgg/iyhvdAPdWxRgaZ0s6aes62L g+UtL6arV0W4eSUKXPapgGiz7QRdJ2rrDOrmikQU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Basavaraj Natikar , Mario Limonciello Subject: [PATCH 6.6 088/151] xhci: Use pm_runtime_get to prevent RPM on unsupported systems Date: Wed, 6 Nov 2024 13:04:36 +0100 Message-ID: <20241106120311.286870861@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120308.841299741@linuxfoundation.org> References: <20241106120308.841299741@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Basavaraj Natikar commit 31004740e42846a6f0bb255e6348281df3eb8032 upstream. Use pm_runtime_put in the remove function and pm_runtime_get to disable RPM on platforms that don't support runtime D3, as re-enabling it through sysfs auto power control may cause the controller to malfunction. This can lead to issues such as hotplug devices not being detected due to failed interrupt generation. Fixes: a5d6264b638e ("xhci: Enable RPM on controllers that support low-power states") Cc: stable Signed-off-by: Basavaraj Natikar Reviewed-by: Mario Limonciello Link: https://lore.kernel.org/r/20241024133718.723846-1-Basavaraj.Natikar@amd.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -713,7 +713,7 @@ static int xhci_pci_probe(struct pci_dev pm_runtime_put_noidle(&dev->dev); if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) - pm_runtime_forbid(&dev->dev); + pm_runtime_get(&dev->dev); else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) pm_runtime_allow(&dev->dev); @@ -740,7 +740,9 @@ static void xhci_pci_remove(struct pci_d xhci->xhc_state |= XHCI_STATE_REMOVING; - if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) + if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) + pm_runtime_put(&dev->dev); + else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) pm_runtime_forbid(&dev->dev); if (xhci->shared_hcd) {