Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2809298rwd; Mon, 22 May 2023 04:51:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5M5Jzs+AlrlAQ57GF1B6MEWA7O6dhuEd8oOJq/USk4AcJk78nB+kiEnT+E4cM4rkfwQcBM X-Received: by 2002:a17:902:d48a:b0:1a6:ebc1:c54c with SMTP id c10-20020a170902d48a00b001a6ebc1c54cmr14547721plg.1.1684756267113; Mon, 22 May 2023 04:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684756267; cv=none; d=google.com; s=arc-20160816; b=Zn9WVC2MUevSPDrMB2/mM5EEAA8ztQQkAEWhb9sl7IhlaEpVkTxcOwRseZ2OSzq5kE NcR/5j5qzmBskX0rRbHUugLAJgEWKr1DzJ3xqi+f3Rz+vt9iYn1c76wJxpwdd74Bc099 VnSKWK3vHcbU1AIeKOhr1QapySetTii/9+PgbDYsMPZTOBdR0UybUQwdzjU6yb9uaInA iTvkGSxcQ1GBHP3KhCyXgaPZhiAuOxwb1qY4qHD5IrBn+HpdlkFnWosyG03+8P0TsDBk PoHrFH60s5pbMVes4eNntMwnT2ML85x4D7Vbi+0mPbcBYFq5nSJyddWgWL6tGvO+pTFB n09Q== 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 :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zUxdy8RjY6Cgmrh6Klu+G2C5pdPq9GQyWsV5p13R1V4=; b=a+8DMg2Gf/0Tj7Cxgm/msyjDdfzOrxy9j6cqbtd4bcA6hH0oxxP1q5pQyQyTGrIKKl kDsT+54eLYcI0dOncCUvp57Kux7+tBElCckue5TKYZFiD6fExifDI51ciUwzVS8MU9TC RNbPVv07FfYp1OncIZLSQ06BKauDa5rRTxWoC/Pzj0sxTWuWCqhBmmqkgyGVN59eDTFk RnEncPfBIsSYvXa29fuUEaIX3CJQt01IlrZUecKKU0LAZVYYWXBc6MD+u+/XloqeSmZE JmZ4rl2bWVNmP7yYdYzsCaqwMIGkQy6X3sR1flr9v//1SDWAesDLh6LokKloFqatvIrM YhAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nI8ZNFwm; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a170902e5cd00b0019955f0dc48si4637335plf.527.2023.05.22.04.50.53; Mon, 22 May 2023 04:51:07 -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=@intel.com header.s=Intel header.b=nI8ZNFwm; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233273AbjEVLkK (ORCPT + 99 others); Mon, 22 May 2023 07:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233234AbjEVLkJ (ORCPT ); Mon, 22 May 2023 07:40:09 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 407EE91; Mon, 22 May 2023 04:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684755608; x=1716291608; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=KYy6wtuHtFxdH0WIH16DIjdET2alDruGePrJjTDQdjk=; b=nI8ZNFwm3Dh5XESTX82g7iCP0w1Ipp0x+5AqogkZdvmQU/wcUlCi6rYD PjWVNdyCocWN7AlZRFTxGSaFOLeFQGRDnLq5X4boQAu/3kvS77aQqOhyC h67rGiMljYgz+LPbCu//bF421XwnoSDFE42NCfEhzbpTL6Dy/fqGLePQw 0WGuNBruguEZraxMcb7x+XQmyI+Grk5aBXCF4ncUGI1L4wNXrHTddHLo7 GXOpjnz37UW+uEik18RGXJKYx+BXLxYoC6FBUp/cfPLq8D32t+KtcqHpB MJqByxfi4P1EVHsj/glI08DTWfykRlvtxpM6DmHx64vgtaiCZM5i6lfac Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10717"; a="418603727" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="418603727" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2023 04:40:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10717"; a="703470490" X-IronPort-AV: E=Sophos;i="6.00,184,1681196400"; d="scan'208";a="703470490" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 22 May 2023 04:40:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 5E0CD1F1; Mon, 22 May 2023 14:40:08 +0300 (EEST) Date: Mon, 22 May 2023 14:40:08 +0300 From: Mika Westerberg To: Mario Limonciello Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, S-k Shyam-sundar , Natikar Basavaraj , Deucher Alexander , Iain Lane , "Rafael J. Wysocki" Subject: Re: [PATCH v2] PCI: Don't assume root ports from > 2015 are power manageable Message-ID: <20230522114008.GK45886@black.fi.intel.com> References: <20230517150827.89819-1-mario.limonciello@amd.com> <20230522055555.GI45886@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Mon, May 22, 2023 at 06:28:25AM -0500, Mario Limonciello wrote: > On 5/22/23 00:55, Mika Westerberg wrote: > > Hi Mario, > > > > 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. > > > > > > 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. > > > > > > 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. > > > > > > 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. > > > > > > 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; > > > + > > > > We already call platform_pci_bridge_d3() few lines up. That function > > should know whether "platform" supports D3 for the bridges, and I think > > it actually calls acpi_device_power_manageable() that platform_pci_power_manageable() > > ends up checking too. > > It does, but it doesn't end up returning false if it doesn't support it. It > only returns true if it does. Good point! > I've tested this patch on two different failing platforms and it works now > on both. Okay LGTM then, Reviewed-by: Mika Westerberg