{"id":2229170,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2229170/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260427205024.254677-2-superm1@kernel.org/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.1/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260427205024.254677-2-superm1@kernel.org>","date":"2026-04-27T20:50:19","name":"[v2,1/6] PCI: Stop setting cached power state to \"unknown\" on unbind","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"79d176713f7ed839dc8ca0637c0d0d012b6c6473","submitter":{"id":88834,"url":"http://patchwork.ozlabs.org/api/1.1/people/88834/?format=json","name":"Mario Limonciello (AMD)","email":"superm1@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260427205024.254677-2-superm1@kernel.org/mbox/","series":[{"id":501725,"url":"http://patchwork.ozlabs.org/api/1.1/series/501725/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=501725","date":"2026-04-27T20:50:20","name":"Improvements to PCI hibernate path","version":2,"mbox":"http://patchwork.ozlabs.org/series/501725/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2229170/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2229170/checks/","tags":{},"headers":{"Return-Path":"\n <linux-pci+bounces-53253-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=Sm1n4ziy;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53253-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"Sm1n4ziy\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4G436N01z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 06:53:07 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 5D857308914D\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 20:50:40 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 852673932DA;\n\tMon, 27 Apr 2026 20:50:37 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D595A33ADA9;\n\tMon, 27 Apr 2026 20:50:34 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 51F4DC2BCB5;\n\tMon, 27 Apr 2026 20:50:33 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777323034; cv=none;\n b=FTKJZGhtl5Azb63NWy5caOLsyM8DvLoPWv9yRrpL8GENGhXs7CP1nq4dvE+TRBcbFw+Xlf2UqMAr+7qVOTP3CG89aPwR7VP1/E8NUJe9GfKnz5+Xd9MUv7oQx1160Jsgbk2EmarO7gDAkU9WY9OFOGW4JYCTiYVWCeIi8F8msBQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777323034; c=relaxed/simple;\n\tbh=+Nec97Tui9c9Iet178LuyVfsDVIn5g6EVyth9hJ5hvI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=AOmwq/Hj3gOw6AikCDxeni0IR2YqJbR/xrj4SccDgqktGBhwabePR8xGCB2y4IRAXWppimnXbdZibSyo3U2uQnBnsnF00rzveYHGDZYmiYiZqpHA2yxQ6n1LofaQ6eZ/rRzJT43PaeyU9CQJ/xgmWcYCi49m0spJHh0OgUZtcgs=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=Sm1n4ziy; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777323034;\n\tbh=+Nec97Tui9c9Iet178LuyVfsDVIn5g6EVyth9hJ5hvI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Sm1n4ziyAPzZniBzAm5GdF/KWAc7Z/k6w1bTdPGrTfjosSnamXxEEAEGH0FdMg08E\n\t pkdTa6jwC5iPFqj3SADBTk6P/UAp+tT+sA0psE4U5Hhs5wwHalN63PapHGujmtFa/n\n\t mrnFa5UWx4cuPnh5KEhnr+t6/54LZI7bo6mm97QkdzPMdE7EBC+zyP+3vwx7Tzclry\n\t HUpXGR8hXek4sRPts+fSkphIhDMY+b1RVuofH1LyA51KHqhRTvkygnjUARmq15UR66\n\t DExFGjDQ9iA1vnOTA2RIMvuxGu6lw9Yt9LA4D+FPy4HIysWMCjdzzZI8h2UZsH/ket\n\t DQbAsjG6U77ow==","From":"\"Mario Limonciello (AMD)\" <superm1@kernel.org>","To":"Bjorn Helgaas <bhelgaas@google.com>,\n\tlinux-pci@vger.kernel.org (open list:PCI SUBSYSTEM)","Cc":"linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM),\n\tlinux-kernel@vger.kernel.org (open list),\n\t\"Rafael J . Wysocki\" <rafael@kernel.org>,\n\tLukas Wunner <lukas@wunner.de>,\n\tlinux-pm@vger.kernel.org,\n\t\"Mario Limonciello (AMD)\" <superm1@kernel.org>","Subject":"[PATCH v2 1/6] PCI: Stop setting cached power state to \"unknown\" on\n unbind","Date":"Mon, 27 Apr 2026 15:50:19 -0500","Message-ID":"<20260427205024.254677-2-superm1@kernel.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260427205024.254677-1-superm1@kernel.org>","References":"<20260427205024.254677-1-superm1@kernel.org>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"From: Lukas Wunner <lukas@wunner.de>\n\nWhen a PCI device is unbound from its driver, pci_device_remove() sets the\ncached power state in pci_dev->current_state to PCI_UNKNOWN.  This was\nintroduced by commit 2449e06a5696 (\"PCI: reset pci device state to unknown\nstate for resume\") to invalidate the cached power state in case the system\nis subsequently put to sleep.\n\nFor bound devices, the cached power state is set to PCI_UNKNOWN in\npci_pm_suspend_noirq(), immediately before entering system sleep.\n\nExtend to unbound devices for consistency.\n\nThis obviates the need to change the cached power state on unbind, so stop\ndoing so.\n\nSigned-off-by: Lukas Wunner <lukas@wunner.de>\nReviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>\n---\n drivers/pci/pci-driver.c | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)","diff":"diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c\nindex d10ece0889f0f..2bfefd8db5260 100644\n--- a/drivers/pci/pci-driver.c\n+++ b/drivers/pci/pci-driver.c\n@@ -512,13 +512,6 @@ static void pci_device_remove(struct device *dev)\n \t/* Undo the runtime PM settings in local_pci_probe() */\n \tpm_runtime_put_sync(dev);\n \n-\t/*\n-\t * If the device is still on, set the power state as \"unknown\",\n-\t * since it might change by the next time we load the driver.\n-\t */\n-\tif (pci_dev->current_state == PCI_D0)\n-\t\tpci_dev->current_state = PCI_UNKNOWN;\n-\n \t/*\n \t * We would love to complain here if pci_dev->is_enabled is set, that\n \t * the driver should have called pci_disable_device(), but the\n@@ -893,7 +886,7 @@ static int pci_pm_suspend_noirq(struct device *dev)\n \n \tif (!pm) {\n \t\tpci_save_state(pci_dev);\n-\t\tgoto Fixup;\n+\t\tgoto set_unknown;\n \t}\n \n \tif (pm->suspend_noirq) {\n@@ -945,6 +938,7 @@ static int pci_pm_suspend_noirq(struct device *dev)\n \t\tgoto Fixup;\n \t}\n \n+set_unknown:\n \tpci_pm_set_unknown_state(pci_dev);\n \n \t/*\n","prefixes":["v2","1/6"]}