Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp978363pxw; Sat, 9 Apr 2022 07:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUHeLJH6YaBwvu0LhbuGbb00ttGMeMjqVFWnOqF5OpqDTaIHblhWaBEwsXU6q2WQHUIVFc X-Received: by 2002:a05:6402:2945:b0:41d:aad:c824 with SMTP id ed5-20020a056402294500b0041d0aadc824mr12427186edb.364.1649513438247; Sat, 09 Apr 2022 07:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649513438; cv=none; d=google.com; s=arc-20160816; b=nxftTBgUt9Zzb5kwyfbzrc1TIVc1oTYETbqxul/l4PWi30Tglkt6aOR0zlj68Iobdx Na0pvt2DLz6wkpHV5klrQPO8uq6MopSYqjP3YFzYPG/xket5hIDJI/8RlwXy3DBApwRx j5KPDT52pe1wtYkwHO04BeOjOQV/PbJVFLE2HBHgpof8s3f9eA6iNv0+ikn08GTGhnAT GDYiPQUOT4DFLGkYLao375mC4Nd/FdIkkw/K+9CGvJ7y5fzeIygofjA2dA4IMa9ixhZA 9ks1SovTZ75TJPgaJ+WhSAGElG0BABFR6pLpvyFXEgo0jfBz5nLZBgJG2dCptJPHJ3D/ 3kfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GIk9Cwu6toGi6bi7Na7cHCtHTrmyVq4xt90FbAzl9LU=; b=akMEu9uFJP6rwb4xEoedeK3x2IScIcK+jk/tr/QWj3ZoeLoWWffrBaAWlFY4Z9EiSI Ff55Lp6NopjNzuZFe6PhNnfNymp6dJm0vN2+ygsemb2czeVBEvPNxtlD+rlHvRerbJPu P986jwYwG+9CcWqu+KSl5/rgslBF4DN0bUTOzbqBVHpZHmVsQ/kgx2u+h8UfMeEEVHuq fNvzHPu1gn7KQkWa/sAKTRFUmj+wTR/5N7mh891fx/Q/TAvkYlngqDPFuGHscBNUymBU 4F2XnxfzJktQ8/a4LJwNh97/j3gyvGdsJ4oPg1M5joVwMPXBEAEp+q7a5R8UWBDk+vcD aexw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020aa7d497000000b0041d71e2179esi215682edr.532.2022.04.09.07.10.02; Sat, 09 Apr 2022 07:10:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238710AbiDHSbM (ORCPT + 99 others); Fri, 8 Apr 2022 14:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbiDHSbK (ORCPT ); Fri, 8 Apr 2022 14:31:10 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 332AA97BB4; Fri, 8 Apr 2022 11:29:04 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id 90bc16d103d9c465; Fri, 8 Apr 2022 20:29:02 +0200 Received: from kreacher.localnet (unknown [213.134.187.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 2ACED66BDA1; Fri, 8 Apr 2022 20:29:02 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PCI , Bjorn Helgaas Cc: LKML , Linux ACPI , Mika Westerberg , Linux PM Subject: [PATCH v2] PCI: PM: Power up all devices during runtime resume Date: Fri, 08 Apr 2022 20:29:01 +0200 Message-ID: <2652115.mvXUDI8C0e@kreacher> In-Reply-To: <4412361.LvFx2qVVIh@kreacher> References: <4412361.LvFx2qVVIh@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.187.56 X-CLIENT-HOSTNAME: 213.134.187.56 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudektddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepteeggfelteegudehueegieekveduleeuledvueefjeefffegfeejudfgteefhefhnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepvddufedrudefgedrudekjedrheeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekjedrheeipdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghr rdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Subject: [PATCH] PCI: PM: Power up all devices during runtime resume Currently, endpoint devices may not be powered up entirely during runtime resume that follows a D3hot -> D0 transition of the parent bridge. Namely, even if the power state of an endpoint device, as indicated by its PCI_PM_CTRL register, is D0 after powering up its parent bridge, it may be still necessary to bring its ACPI companion into D0 and that should be done before accessing it. However, the current code assumes that reading the PCI_PM_CTRL register is sufficient to establish the endpoint device's power state, which may lead to problems. Address that by forcing a power-up of all PCI devices, including the platform firmware part of it, during runtime resume. Link: https://lore.kernel.org/linux-pm/11967527.O9o76ZdvQC@kreacher Fixes: 5775b843a619 ("PCI: Restore config space on runtime resume despite being unbound") Reported-by: Abhishek Sahu Tested-by: Abhishek Sahu Reviewed-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki --- v1 -> v2: * Move pci_pm_default_resume_early() away from #ifdef CONFIG_PM_SLEEP. * Add R-by from Mika. --- drivers/pci/pci-driver.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) Index: linux-pm/drivers/pci/pci-driver.c =================================================================== --- linux-pm.orig/drivers/pci/pci-driver.c +++ linux-pm/drivers/pci/pci-driver.c @@ -551,10 +551,6 @@ static void pci_pm_default_resume(struct pci_enable_wake(pci_dev, PCI_D0, false); } -#endif - -#ifdef CONFIG_PM_SLEEP - static void pci_pm_default_resume_early(struct pci_dev *pci_dev) { pci_power_up(pci_dev); @@ -563,6 +559,10 @@ static void pci_pm_default_resume_early( pci_pme_restore(pci_dev); } +#endif + +#ifdef CONFIG_PM_SLEEP + /* * Default "suspend" method for devices that have no driver provided suspend, * or not even a driver at all (second part). @@ -1312,7 +1312,7 @@ static int pci_pm_runtime_resume(struct * to a driver because although we left it in D0, it may have gone to * D3cold when the bridge above it runtime suspended. */ - pci_restore_standard_config(pci_dev); + pci_pm_default_resume_early(pci_dev); if (!pci_dev->driver) return 0;