Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4867210rwd; Tue, 23 May 2023 13:56:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OJDXcxLQ++jkMOeFUxGU114uZ7VXCkrzvx4fG7AmtsMhp22ENYYVp1ZdSjSC8sylBm/Yv X-Received: by 2002:a05:6a00:2d8c:b0:64d:1215:a0f5 with SMTP id fb12-20020a056a002d8c00b0064d1215a0f5mr296458pfb.34.1684875413421; Tue, 23 May 2023 13:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684875413; cv=none; d=google.com; s=arc-20160816; b=NC6DOaQoKR2Z+qHR+s2vlbRrN5VrpoUTy+/nUz8/GrHWp4lqc529kFlOJRsqElgvvB pxlnGjRD/6GmGoA+Kz8lxEQ1EHM5ZKCAWZMx5YpR23ri6CtMgkxNFjKUge2GGzL970ZU yy7BwqlrpQEF1WMv3MkBIS72Mlduu6c12EnwjKLh4juIRfv6sV7ILkaLh5OQ1E4EPxlZ zD0FZoMtsak3eLSrFFj2GLNl+rclGT4vVztH1YcvfkMTI1mgLEi9Yp0Tgj3DzZSb5m3B Ioz+SxMt5jWGeJLNSB0es4Bestt6hrm8rVBgpIGPDanzyZuzpe84V1g/ZhKAtW+gMdWZ y+kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=PozRXLzEHI2Y8dMRghYq6azQo+uElBXFsRgLk2fz1yw=; b=uVYcdW+aSuhb0UH5OeoChh2MQKqXmH73i8QNTB3WDuFDY38v4Z+zgicaew5/+euMhF uhIMJvVfjEPrffgiUUmoj6XqcUrb5zwKkVSrb4TXnQ3ZfPJJixImn1EdwEQ1ZOuyzUYY JW4ZvgQKHCxxfpkR7pIqa4GAOC9toY92abSjDkVp61aEnzNCSAB6lMYgPwKspcnxf8qn wpUhrJ7qMvgpJ0FUVamG52LEzvX412h/bEti54sFDB8LElbGkbMCGV2xjcYJADs1MPTi twMvvGHr/MxPPs1LTgKcWMlzByV63QM73AEUOOcl8WMAvdL7In60oqauVN71QrASn1QN dzOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sbs3xYla; 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 h63-20020a638342000000b005346be4ead7si2582168pge.766.2023.05.23.13.56.38; Tue, 23 May 2023 13:56:53 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sbs3xYla; 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 S238065AbjEWUfX (ORCPT + 99 others); Tue, 23 May 2023 16:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231758AbjEWUfW (ORCPT ); Tue, 23 May 2023 16:35:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53366BF; Tue, 23 May 2023 13:35:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E47956191D; Tue, 23 May 2023 20:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C48C4339B; Tue, 23 May 2023 20:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684874120; bh=WD3DNIqNipkAXxMXZFy+ceH8xcUnwhSbZvx+tfZCIqs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Sbs3xYlaJO1k9XwN45xPjRdavvzjZ0TMYdX/kS/wSacQ78T8GZanQ3K+ha9WqP6Zb c5thxqiYHQVCra5Bam6DfJOs2VwDpTlvw8d7QbnHXRGi5z03lEPKjQHZd6VyZvhA+4 IWiVRoZrCk8xwqg1Itt3pynO7gCNyjkiqfBp6LdInBgoDBsJuA7Qlenzx8ouX5n+/M Y4o2V1A5r3biyvgckZHIsSnzi1KD44am8wqkr1opVFqvCTFg4yc8qhBrCJHgRV9isD w3qTDxyKWWEuYD13BXOoHuagzp+GjDJWOKSkR4WSen0f8GcZyT1NWgfH+2LrPrcA5s AJ+otgQ3sHwdw== Date: Tue, 23 May 2023 15:35:18 -0500 From: Bjorn Helgaas To: Mario Limonciello Cc: Bjorn Helgaas , Mika Westerberg , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, S-k Shyam-sundar , Natikar Basavaraj , Deucher Alexander , Iain Lane , Lukas Wunner , "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: Re: [PATCH v2] PCI: Don't assume root ports from > 2015 are power manageable Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230517150827.89819-1-mario.limonciello@amd.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 [+cc Rafael, Lukas, linux-pm] On Wed, May 17, 2023 at 10:08:27AM -0500, Mario Limonciello wrote: > Using an XHCI device to wakeup the system from s2idle fails when > that XHCI device is connected to a USB-C port for an AMD USB4 > router. Are XHCI, USB-C, and the AMD USB4 router just examples? I assume the same issue could happen with non-XHCI and non-AMD devices, too? I assume the problem has something to do with PME_Support and some device being put in a power state where it cannot generate or forward PME messages? I think the PCIe protocol details would be helpful here. > Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during > suspend") all root port go into D3 during s2idle. > When the root ports are in D3 over s2idle it's not possible for the > platform firmware to properly identify the wakeup source. I'm not sure what the critical device is here. 9d26d3a8f1b0 and the current pci_bridge_d3_possible() are not specific to Root Ports. The PCIe protocol details would probably clear this up. > Comparing registers between Linux and Windows 11 this behavior to put root > ports into D3 at suspend is unique to Linux. On an affected system > Windows does not put the root ports into D3 over Modern Standby. > > Windows doesn't put the root ports into D3 because root ports are not > power manageable; they're missing _PRW and _S0W. platform_pci_power_manageable() tests adev->flags.power_manageable, which is set by acpi_bus_get_power_flags() when a device has _PS0 or _PR0. So I don't know what's relevant out of _PRW, _S0W, _PS0, _PR0, but this sentence doesn't seem to match the code. > Linux shouldn't be assuming they support D3 just because they're newer > than 2015, the ports should also be deemed power manageable. > Add an extra check for this to ensure D3 isn't selected for such machines. Is this talking about D3hot or D3cold or both? If we can make this explicit, it will help me out. It's probably obvious to power experts, but I'm not one. > Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > Reported-by: Iain Lane > Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 > Signed-off-by: Mario Limonciello > --- > drivers/pci/pci.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 5ede93222bc1..3fe27aef09e6 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -3010,6 +3010,9 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) > if (dmi_check_system(bridge_d3_blacklist)) > return false; > > + if (!platform_pci_power_manageable(bridge)) > + return false; > + > /* > * It should be safe to put PCIe ports from 2015 or newer > * to D3. > -- > 2.34.1 >