Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9220668rwl; Wed, 11 Jan 2023 03:06:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXutrRCSABKMnqgH3bm6upLZQvD3yarUy9mo3GDRjowL2tFBxk6opnVHEyc6gRAZxzK04vKV X-Received: by 2002:a17:902:c643:b0:192:4c84:4508 with SMTP id s3-20020a170902c64300b001924c844508mr66438834pls.20.1673435217733; Wed, 11 Jan 2023 03:06:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673435217; cv=none; d=google.com; s=arc-20160816; b=Xs8QaWp2O6zQiFsx8LxtIqhOet16I+nuSe5Ggl7NOJIwfTLWxxDS9CN0h7mQgd6Q+g 9xLzEhVLVgHU7xAhiRSK22ucfiAPj61cV0HDJka5qtfp5fOHe5jOoeefwt3AwXhm1zKk nCTxSjBtMwTsjX9UKi+ULCSiGKen/41RRDy7d+jCpeEhVGdLNJmK1stWrvd3w41BQida it0W8ZMgDWiA+sop1o4S5zwxek/0Su0HakzuhwBJdUqL7aVEen4ohUyDUfJuSgRp9BCW 8cC9Tv6FpZ3R7wFLYwKPhziareL/QcIxxwf/KbvN9spzaOc5p5jYqXdTDvvLmuUAIUsD 8dFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=vdvvzyZdZq8xmpLVIyIUoDQf3llEu3/kVz88+13kWoQ=; b=EdaKXz6KYFmuIjFMPPlBwKzSc37/avEsJCPVWYTSUDkMEDA83derWeigw5cfRPOG+x fWBniD9g+YJXuCJAA9Ebr53pu4zdJRBRbLKH++fVqSxag5uZ6wpMdn3ya2oguDDnY8J8 o5NEr6FkfPqWXD/AHPDEbG0R4DX1WgwKPb43Q1JZDeykl7qS4E7D9Ju/rHDGiS6p8jIc rTUpzssuhiHcJgRh06P9dBNlhE8YxJMUBQtbxQNl9A+AUX8dEhVwo6m+EcXQme24s1kU lYVw3pj+LPxjRh1Nj9WxiO9b3eWguhzuhOGrKFICVKepJpIjz9zFGxgUXpssZARsZf/9 6HvQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a1709027b8900b00192721d4f1fsi12758619pll.494.2023.01.11.03.06.51; Wed, 11 Jan 2023 03:06:57 -0800 (PST) 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231806AbjAKK5F (ORCPT + 53 others); Wed, 11 Jan 2023 05:57:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238209AbjAKK4p (ORCPT ); Wed, 11 Jan 2023 05:56:45 -0500 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382729584; Wed, 11 Jan 2023 02:56:18 -0800 (PST) Received: by mail-ej1-f42.google.com with SMTP id ss4so28555703ejb.11; Wed, 11 Jan 2023 02:56:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vdvvzyZdZq8xmpLVIyIUoDQf3llEu3/kVz88+13kWoQ=; b=Ne1nQdDtMwDsHjv86+g+Hn9SiSX1QUpf1BZrf/v4VjTsC1GAOC3jFRewSFU8P+wJFX nLF6MbKY3aHzev1TkSTI4c0oQMJ7KEX9is5Pd0mNW+Ff86NBX8tkxlc8pLK+BFzmx6nz wUNqFBCDu9rDO0YyRlzh3EkF9AFCgFl5kU7We3m76DDB+xGP/30F86SqdDlLmgnAolBw 3ChMjAXnIUFyIqgbRvWrZRBodjziQVdbiF4SSrwWlUrLtotkPKBINo7OPYIpQmFnDYgy I7h/OslDj6AML1ZWhHBCaw8CQDxnp5weNkl3hLmFdLZiIf/eU53PZeBZ4katx12zYWLW Oj+Q== X-Gm-Message-State: AFqh2krBYYsBjDxle3C4vA3qU3WsOM/+sHkxA2RaQGAAMK3MxwtOn3By GlgXpj9DtViXOcrCMtGlVW3REflLh5o7rVLyyok= X-Received: by 2002:a17:907:29c3:b0:84d:4b8e:efc with SMTP id ev3-20020a17090729c300b0084d4b8e0efcmr729548ejc.390.1673434577482; Wed, 11 Jan 2023 02:56:17 -0800 (PST) MIME-Version: 1.0 References: <1945994.PYKUYFuaPT@kreacher> <20230110205513.GA1608269@bhelgaas> In-Reply-To: <20230110205513.GA1608269@bhelgaas> From: "Rafael J. Wysocki" Date: Wed, 11 Jan 2023 11:56:05 +0100 Message-ID: Subject: Re: [PATCH v5] PCI/ACPI: PCI/ACPI: Validate devices with power resources support D3 To: Bjorn Helgaas Cc: "Rafael J. Wysocki" , "Limonciello, Mario" , "Rafael J. Wysocki" , Len Brown , Bjorn Helgaas , Mika Westerberg , Mehta Sanju , Lukas Wunner , "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 On Tue, Jan 10, 2023 at 9:55 PM Bjorn Helgaas wrote: > > On Mon, Jan 02, 2023 at 05:59:36PM +0100, Rafael J. Wysocki wrote: > > On Monday, January 2, 2023 5:34:19 PM CET Rafael J. Wysocki wrote: > > ... > > > > I don't really think that Root Port support is required for a bridge below > > > a Root Port if that bridge itself is power-manageable via ACPI. Moreover, > > > I don't think that the _S0W of a Root Port has any bearing on devices below > > > it that have their own _S0W. > > > > > > So what we really want appears to be to evaluate _S0W for the target bridge, > > > regardless of whether or not it is a Root Port, and return 'false' if that > > > produces D2 or a shallower power state. Otherwise, we can do what we've > > > done so far. > > > +bool acpi_dev_no_wakeup_from_d3(struct acpi_device *adev) > > +{ > > + unsigned long long state; > > + acpi_status status; > > + > > + status = acpi_evaluate_integer(adev->handle, "_S0W", NULL, &state); > > + return ACPI_SUCCESS(status) && state < ACPI_STATE_D3_HOT; > > This returns "false" (i.e., "yes, device can signal wakeup from D3") > if _S0W doesn't exist. Is that right? Yes, it is. The reason why I did it that way was because the bridge cannot signal wakeup from D3 if both the following conditions take place: 1. There is _S0W and it can be evaluated successfully. 2. _S0W produces D2 or a shallower power state. In particular, if 1 is not the case, it is still not clear whether or not the bridge can signal wakeup from D3 and additional checks are needed. > I think this might be less confusing as: > > bool acpi_dev_can_wake_from_d3(struct acpi_device *adev) > { > status = acpi_evaluate_integer(adev->handle, "_S0W", NULL, &state); > return ACPI_SUCCESS(status) && state >= ACPI_STATE_D3_HOT; > } So I don't think the above will work, because !acpi_dev_can_wake_from_d3(adev) is also true if _S0W is not present, for example, in which case acpi_pci_bridge_d3() should not return 'false' right away. However, the additional function can simply return the value produced by _S0W or ACPI_STATE_UNKNOWN on all errors and its caller can do the checks as needed which is done here: https://patchwork.kernel.org/project/linux-acpi/patch/5659681.DvuYhMxLoT@kreacher/ (posted as a proper patch, because I wanted patchwork to pick it up). I've also picked up the idea of using rpadev for representing the ACPI companion of the Root Port in acpi_pci_bridge_d3(). Cheers!