From patchwork Mon Apr 4 15:20:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 558894 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81AC9C43219 for ; Mon, 4 Apr 2022 15:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378563AbiDDP1U (ORCPT ); Mon, 4 Apr 2022 11:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378547AbiDDP1R (ORCPT ); Mon, 4 Apr 2022 11:27:17 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 002FF1E3F2; Mon, 4 Apr 2022 08:25:20 -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 3153a6bc5aa3f00f; Mon, 4 Apr 2022 17:25:19 +0200 Received: from kreacher.localnet (unknown [213.134.181.62]) (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 3FFD466BCD2; Mon, 4 Apr 2022 17:25:18 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Linux PCI , Bjorn Helgaas , Mika Westerberg Subject: [PATCH v1 0/3] ACPI: PCI: PM: Power up PCI devices with ACPI companions upfront Date: Mon, 04 Apr 2022 17:20:30 +0200 Message-ID: <21439956.EfDdHjke4D@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.181.62 X-CLIENT-HOSTNAME: 213.134.181.62 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudejvddgkeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefhgedtffejheekgeeljeevvedtuefgffeiieejuddutdekgfejvdehueejjeetvdenucfkphepvddufedrudefgedrudekuddriedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekuddriedvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi All, There are cases in which the power state of a PCI device depends on an ACPI power resource (or more of them) in such a way that when the given power resource is in the "off" state, the PCI device depending on it is in D3cold. On some systems, the initial state of these power resources is "off", so the kernel should not access the config space of PCI devices depending on them, until the power resources in question are turned "on", but currently that is not respected during PCI device enumeration. Namely, the PCI device enumeration code walks the entire bus and enumerates all of the devices it can find, including the ones whose initial power state in principle depends on the ACPI power resources in the "off" state. Apparently, most of the time, the config space of such devices is accessible regardless of the state of the ACPI power resource associated with the PCI device, so the device enumeration is successful, but there are two potential issues related to this behavior. First off, even if the given PCI device is accessible when the ACPI power resource depended on by it is "off", changing its configuration may confuse the platform firmware and lead to problems when the ACPI power resource in question is turned "on". Second, the PCI device may not be actually accessible at all when the ACPI power resource depended on by it is "off", in which case it won't be found during the PCI enumeration of devices. This patch series addresses that problem by turning "on" all ACPI power resources depended on by PCI devices before attempting to access the config space of those devices for the first time. The first two patches introduce the requisite machinery and the actual change of behavior is done in the last patch. Thanks!