Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3456461pxb; Mon, 4 Apr 2022 17:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlWSkafJmHG5AHtemqgfzd58lNACC0BGLv/Lz3oGpousubvc+zG/0gTW+C4XHVJUnyfpUy X-Received: by 2002:a05:6a00:27a2:b0:4fa:e893:bb68 with SMTP id bd34-20020a056a0027a200b004fae893bb68mr725853pfb.82.1649118839395; Mon, 04 Apr 2022 17:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118839; cv=none; d=google.com; s=arc-20160816; b=0zZJb0+dmvPh8YsEw3J7ctF0JutBiyZmijnUGlQPOOB67Ib+/J3xpcLTZ+i93k/DGf o82n0hWfIk1SzVnOjQ1xus6PEFFuqbOrAAZPoXrambPsMg35CdhXw917xN68wiahxKH/ cXoLbIgDcA/oeNoXOyDPDh2GJupkFZfpvKZGgwe/rJycIFrKeUY/O45sSJRcRjNqMiaR pYNQVzvzYjbaIhBl6eg/XciWjRGRLTDoN2fgdbOp8FnuT/w+A2ry7kOPLdJeSyvNFCJb SSzllTjOfK4dQdBiQzAtyNDDfnuU+xjfnXHETxh25OkWE0+oH5+S/Ie18Qe6lk4YkP24 5ykw== 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=N86oIEINirE5ktY0g6/ENuB0WkQiCvv/vuxl6MyNwgo=; b=USidIrgcITFCn37Lsj3CmKrSqT9j/vqsZUb3FwFQNMQGZWEchCLDD8WMOt76Pu6MuP RH4jPaT558qDKw8R5xis0cWjEuf8WlKfVOmRsIKQWGDRidfOOxC3zhbDpanltL3TGA8V aTMK8YEtL5U2XbPt7eTIX/W/pJNaDJZtzjm/jhEwkylkJKkpDU5ajyDuG/C6rjT6D4Gn u4WN2k3cs/NiP5qoSsh6ZW9VEuUyT++hLk7NrfrrnwGbwZK2LoOYX8d1WuazFRKKYT/+ gpH0ILNNfZ0TQSaCYvdZCY2xDlfU7WppdnduduK2QuehAtcvVBCx0E1RG85H8wrchWBJ XFwA== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y17-20020a63e251000000b00382050266easi10796475pgj.420.2022.04.04.17.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:33:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2333F89083; Mon, 4 Apr 2022 16:52:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378536AbiDDP1N (ORCPT + 99 others); Mon, 4 Apr 2022 11:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241874AbiDDP1M (ORCPT ); Mon, 4 Apr 2022 11:27:12 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8602E193EA; Mon, 4 Apr 2022 08:25:15 -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 3daf4d00b9762f0a; Mon, 4 Apr 2022 17:25:13 +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 241B166BCD2; Mon, 4 Apr 2022 17:25:13 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Linux PCI , Bjorn Helgaas , Mika Westerberg Subject: [PATCH v1 3/3] PCI: ACPI: PM: Power up devices in D3cold before scanning them Date: Mon, 04 Apr 2022 17:25:04 +0200 Message-ID: <5729439.MhkbZ0Pkbq@kreacher> In-Reply-To: <21439956.EfDdHjke4D@kreacher> References: <21439956.EfDdHjke4D@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.181.62 X-CLIENT-HOSTNAME: 213.134.181.62 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudejvddgkedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepvddufedrudefgedrudekuddriedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekuddriedvpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgt phhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhm 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, 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 The initial configuration of ACPI power resources on some systems implies that some PCI devices on them are initially in D3cold. In some cases, especially for PCIe Root Ports, this is a "logical" D3cold, meaning that the configuration space of the device is accessible, but some of its functionality may be missing, but it very well may be real D3cold, in which case the device will not be accessible at all. However, the PCI bus type driver will need to access its configuration space in order to enumerate it. To prevent possible device enumeration failures that may ensue as a result of ACPI power resources being initially in the "off" state, power up all children of the host bridge ACPI device object that hold valid _ADR objects (which indicates that they will be enumerated by the PCI bus type driver) and do that to all children of the ACPI device objects corresponding to PCI bridges (including PCIe ports). Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_root.c | 2 ++ drivers/pci/pci-acpi.c | 3 +++ 2 files changed, 5 insertions(+) Index: linux-pm/drivers/acpi/pci_root.c =================================================================== --- linux-pm.orig/drivers/acpi/pci_root.c +++ linux-pm/drivers/acpi/pci_root.c @@ -927,6 +927,8 @@ struct pci_bus *acpi_pci_root_create(str host_bridge->preserve_config = 1; ACPI_FREE(obj); + acpi_dev_power_up_children_with_adr(device); + pci_scan_child_bus(bus); pci_set_host_bridge_release(host_bridge, acpi_pci_root_release_info, info); Index: linux-pm/drivers/pci/pci-acpi.c =================================================================== --- linux-pm.orig/drivers/pci/pci-acpi.c +++ linux-pm/drivers/pci/pci-acpi.c @@ -1374,6 +1374,9 @@ void pci_acpi_setup(struct device *dev, acpi_pci_wakeup(pci_dev, false); acpi_device_power_add_dependent(adev, dev); + + if (pci_is_bridge(pci_dev)) + acpi_dev_power_up_children_with_adr(adev); } void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev)