Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp801026pxb; Tue, 12 Apr 2022 13:50:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS+b4gdKSgm7JPGKjXbodPdQ1b1fnP8injNS5WXrEnwCzWnBrKiD7VnH0umkUISqYbkFbP X-Received: by 2002:a65:64c6:0:b0:39c:cb67:626b with SMTP id t6-20020a6564c6000000b0039ccb67626bmr46407pgv.548.1649796653540; Tue, 12 Apr 2022 13:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649796653; cv=none; d=google.com; s=arc-20160816; b=lxg5le9aZ4KjHsL6oX5SddrytA7taQo6qxWwH4AD2FYD8ubUoTG3xTwX9jdk8HUSab 4xfhq2MzddJBQDG2vKJ07skzhOLyDCihqCEQafPeIrTzEQVGasn528lZk4Rt3APKv2kR 4XPNEUEEY8rcNf+4l456zraoZNebMYcWqhQcMJW96rfa0yKVE19Wu8S9OJAP6JkOLyIv hxXZ0k0UFntQ/yG7b3yFFOz8akSKZx+dodMRofhNeQeQqbKjYBBLnekO2WkkngTgefu9 aVMJPj1SrOHrMr1EhGX/Lsgp86bspv8DttQCLyonp/N8qS9+L0r47xLUq9X5NP0qKuWz 0MOA== 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=VMeBtMeEojet7ChxUMc4lZ6bMM9SoMUWzVG4QRWTQK4=; b=z+dIJUKXWlQcsu2JTvUzT7MfP6Jhye8pjQRCntCPZCBuM3Dq5B3pNOta2iEtOHbaz3 FLCva1VKZyLIt4kiG2N+LRd1kDUHL+3EWKmotjoNjn4rEVaUHoDe08jW+Bxn2ZaI0X/0 +WvVbScZewj4vC/HcJMMqrg6rkQXKIx8GE9eJoz6KEMMk7bdMVwF3wVEoZpzCGeiqK85 gJsj4M7+p9NVyJqSNGO8i2m3ZqpLhdB3hUp5Kmpj9A3OxlI5Tp6P6UD2NobBx5o67GT6 tsRMaci7o2QjdSjynr5g7lYg44cDbARn5D/gkQco1vJO96HEKaBQn/M+m1sMoad1PTMy d+fw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j6-20020a170902da8600b00153b2d164efsi13065025plx.247.2022.04.12.13.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:50:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9F149C6835; Tue, 12 Apr 2022 13:18:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347158AbiDKOhS (ORCPT + 99 others); Mon, 11 Apr 2022 10:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347384AbiDKOgs (ORCPT ); Mon, 11 Apr 2022 10:36:48 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F2FAE5A; Mon, 11 Apr 2022 07:34:14 -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 954161c5054c236a; Mon, 11 Apr 2022 16:34:12 +0200 Received: from kreacher.localnet (unknown [213.134.175.113]) (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 E28D866BDD4; Mon, 11 Apr 2022 16:34:11 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PCI Cc: Linux PM , LKML , Bjorn Helgaas , Mika Westerberg Subject: [PATCH v2 1/9] PCI/PM: Resume subordinate bus in bus type callbacks Date: Mon, 11 Apr 2022 16:19:00 +0200 Message-ID: <5830409.lOV4Wx5bFT@kreacher> In-Reply-To: <11975904.O9o76ZdvQC@kreacher> References: <4419002.LvFx2qVVIh@kreacher> <11975904.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.175.113 X-CLIENT-HOSTNAME: 213.134.175.113 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudekiedgjeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepvddufedrudefgedrudejhedruddufeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddujeehrdduudefpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehm ihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Calling pci_resume_bus() on the secondary bus from pci_power_up() as it is done now is questionable, because it depends on the mandatory bridge power-up delays that are only covered by the PCI bus type PM callbacks. For this reason, move the subordinate bus resume to those callbacks too and use the observation that if a bridge is being powered-up during resume from system-wide suspend, it may be still desirable to runtime-resume its subordinate bus after completing the system- wide transition (in case the resume of the devices on that bus is skipped during it). Signed-off-by: Rafael J. Wysocki --- v1 -> v2: No changes. --- drivers/pci/pci-driver.c | 15 +++++++++++++-- drivers/pci/pci.c | 15 --------------- 2 files changed, 13 insertions(+), 17 deletions(-) Index: linux-pm/drivers/pci/pci-driver.c =================================================================== --- linux-pm.orig/drivers/pci/pci-driver.c +++ linux-pm/drivers/pci/pci-driver.c @@ -559,6 +559,17 @@ static void pci_pm_default_resume_early( pci_pme_restore(pci_dev); } +static void pci_pm_bridge_power_up_actions(struct pci_dev *pci_dev) +{ + pci_bridge_wait_for_secondary_bus(pci_dev); + /* + * When powering on a bridge from D3cold, the whole hierarchy may be + * powered on into D0uninitialized state, resume them to give them a + * chance to suspend again + */ + pci_resume_bus(pci_dev->subordinate); +} + #endif #ifdef CONFIG_PM_SLEEP @@ -934,7 +945,7 @@ static int pci_pm_resume_noirq(struct de pcie_pme_root_status_cleanup(pci_dev); if (!skip_bus_pm && prev_state == PCI_D3cold) - pci_bridge_wait_for_secondary_bus(pci_dev); + pci_pm_bridge_power_up_actions(pci_dev); if (pci_has_legacy_pm_support(pci_dev)) return 0; @@ -1321,7 +1332,7 @@ static int pci_pm_runtime_resume(struct pci_pm_default_resume(pci_dev); if (prev_state == PCI_D3cold) - pci_bridge_wait_for_secondary_bus(pci_dev); + pci_pm_bridge_power_up_actions(pci_dev); if (pm && pm->runtime_resume) error = pm->runtime_resume(dev); Index: linux-pm/drivers/pci/pci.c =================================================================== --- linux-pm.orig/drivers/pci/pci.c +++ linux-pm/drivers/pci/pci.c @@ -1310,21 +1310,6 @@ static int pci_dev_wait(struct pci_dev * int pci_power_up(struct pci_dev *dev) { pci_platform_power_transition(dev, PCI_D0); - - /* - * Mandatory power management transition delays are handled in - * pci_pm_resume_noirq() and pci_pm_runtime_resume() of the - * corresponding bridge. - */ - if (dev->runtime_d3cold) { - /* - * When powering on a bridge from D3cold, the whole hierarchy - * may be powered on into D0uninitialized state, resume them to - * give them a chance to suspend again - */ - pci_resume_bus(dev->subordinate); - } - return pci_raw_set_power_state(dev, PCI_D0); }