Message ID | 20230530163947.230418-2-mario.limonciello@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2323140vqr; Tue, 30 May 2023 09:56:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ICak+VA9ABY9QJ+NsdVDH/n2WQ2qyJ3jtVH3LpCM/eW+wubLmF//glJbjGs5Ty9u93bpn X-Received: by 2002:a17:903:2450:b0:1ad:bc86:851 with SMTP id l16-20020a170903245000b001adbc860851mr3122488pls.45.1685465814763; Tue, 30 May 2023 09:56:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685465814; cv=pass; d=google.com; s=arc-20160816; b=QHXwyP8iVucpJvSwBFcd9GH7mgR40MxcBTJMvpJr3Bi7yucuQLQxF1cpbbjedj6a/U hXDqkb9USz/0iDC+xug6RdXELDdNpQjW2UlFGzdYq7s9BBRr9ypijtdlecxYWGmGBdzU AHDyUJNKn+63BJfYGntxcOCWuCuODsfFmjuHKtNxnYm6lLlJ8et+dVgovGbL2Vwv2SzW ik5EpqYQgy7JvXJZ0sTBx7u6mENj11m7wrSTvOUMe8XqicmDDDN5eHdSSa1+L/0TPEMB zxoO6JIWZutvrNx6YhIZso+sYzAQVd8LK5aFBq5Gl8uqV4vIpOfnkMCxyxkudPPc7si0 k0Xg== ARC-Message-Signature: i=2; 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 :dkim-signature; bh=nnwLJraND0w6rMhO6KaGzzAXYxKHN1gH83cQi2bGtX0=; b=02YMkZ27U57bRkBRqUHO2xpG1KwSDChB7EHQl605dqxn6SGpuQsPwTa24BlTlaiw3i 1Yd6Cur4ziYyDw7GhA+6ih0l9tLUohBWHgpx5+AjySfOJmeNpG9p8nx1t7HfFaoxAcEe 26Zz/TKkk8B94hsQlHssA2/1qKCVt5dn/aILUTnmnXCKkiwUc9QpOKOJO6QSl+/TXmsv e9irQ0u/WwbjmFQd30DICMt663uRGLF+Gdxd8I9O8RFApajMHdKYD3KLxzvPtikkw4sh u98xdspxk5EKbgk4PM6fZlQzANK67qOBmcL6CHGnfI47slzj1buXP8YyFs3ajji4n6+N 66NA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=3TU0zT0+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170902da8f00b001ab10a72d7asi8302291plx.584.2023.05.30.09.56.42; Tue, 30 May 2023 09:56:54 -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=@amd.com header.s=selector1 header.b=3TU0zT0+; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232754AbjE3Qkr (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Tue, 30 May 2023 12:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbjE3Qkm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 30 May 2023 12:40:42 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EFEB8F; Tue, 30 May 2023 09:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mxbIy+C65SAII1uhNHIv/SmxhrviTH15F2+B/ibqDWs2ZPfoADuDr+1o+reSEJK79s0b5O3m8YKifbdUuaXOaNzA9XiVburcJlIDGLPQ1jMV5pyZqFj6nhjw19DnRiBqHTEcrLu87jkVv4zF22nmBwoSKHgUc9VQMuuTDCTA55va1d5WdFqH8c72XpSQT71w8rPx4bt6dqDsT09xh+uiPWk1YUrEWx+DM52PdIJCbdBRrGc7eMhkzt9q6ws5LZOF7RGFkd31BfMGIRJa/z5T5ECKcnY2BmjPB2S7s3aaRkffU68m3B2rsgzFsezn41xleuRHjKw+uZYOfNgDuTHfYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nnwLJraND0w6rMhO6KaGzzAXYxKHN1gH83cQi2bGtX0=; b=JhQTDxQZ9JlzOG1LUCaBdhXdBgmEn1MvSNyaSyne1EovjBMZzHria8lflmyX2RR1BB8GxD8gC4ppjY2pFzacx1vEToOVddNk83vPk1n13OE01deuKGli5QHqLd/49CxcJ9oSFSe6LRI421UCn0RwnjTtv00/hL8GGWwm2rEpX/ajNlbATJ9kOUsR6WggFf6zHhxta0Nr8cD4kZ9HcE26VDu7vWMt9gl0G5+HaDFU5yZcnUQeSO9IDeDxZssSXK2/TKOKsDw7CnTSJwTWUuns2mnxAazhXEhJRdQWk8BY+o3TSeS+H9u20GD9qmAAlFpnXDPaRtwMSzqCI8qhvTGh+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nnwLJraND0w6rMhO6KaGzzAXYxKHN1gH83cQi2bGtX0=; b=3TU0zT0+LfSWJ48w8wSoO6dz5EtFn4QSQCRPBjNS7uIXXxyPS6naxO8XCrlh9iUD90rX4IUkSR9d3IHjrpNjhTYnvzf9otglDjeGuN3IrHzZV9wRth2dpjG8a9SoLbypCAhCrEFIQKT1lG7T4nXPmV/qnj2J+SVvFX8bby2+8Ds= Received: from BN9PR03CA0525.namprd03.prod.outlook.com (2603:10b6:408:131::20) by DM4PR12MB5181.namprd12.prod.outlook.com (2603:10b6:5:394::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Tue, 30 May 2023 16:40:39 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::c7) by BN9PR03CA0525.outlook.office365.com (2603:10b6:408:131::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23 via Frontend Transport; Tue, 30 May 2023 16:40:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.22 via Frontend Transport; Tue, 30 May 2023 16:40:38 +0000 Received: from SITE-L-T34-2.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 30 May 2023 11:40:37 -0500 From: Mario Limonciello <mario.limonciello@amd.com> To: Bjorn Helgaas <bhelgaas@google.com> CC: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "Mika Westerberg" <mika.westerberg@linux.intel.com>, S-k Shyam-sundar <Shyam-sundar.S-k@amd.com>, Natikar Basavaraj <Basavaraj.Natikar@amd.com>, Deucher Alexander <Alexander.Deucher@amd.com>, "Rafael J . Wysocki" <rafael@kernel.org>, <linux-pm@vger.kernel.org>, Lukas Wunner <lukas@wunner.de>, Mario Limonciello <mario.limonciello@amd.com>, Iain Lane <iain@orangesquash.org.uk>, Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Subject: [PATCH v5 2/2] PCI: Don't assume root ports are power manageable Date: Tue, 30 May 2023 11:39:47 -0500 Message-ID: <20230530163947.230418-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530163947.230418-1-mario.limonciello@amd.com> References: <20230530163947.230418-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT051:EE_|DM4PR12MB5181:EE_ X-MS-Office365-Filtering-Correlation-Id: 5204f739-286f-483c-0089-08db612c99c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Upj25H1hKnxMB2jAXXO9F2wpxJ2soyta2n68xxaN5TZkIMxLiHeAZRCQOc/mkYcSR0WEFZSsozBUxCUCrZCNlpkKu9l5rybDWcCS11jnrP5l9ZuDoKo2JfAGv5zoD57Qh8LxfNiz4jv8dmI2Lmhiuta6ffw5N1KeVON6NukWNRqncklgq9Facz0HHnK87E+aV2hg+hg9e3zlEq4ZZbfkge3Ey4c8ODjBebC2CFkffK2hhcaU4cSmH/DeQ0XLO4YDsjlhS+MXepqKNcKr813MWW39ZPTi5OYIIe6III3scARZagXQAKzT0vzWocqmMSoiF/LZJG7prUZ098yxh1NB4ZFp1VwX81gOZkRhzRWAhhPdk1lIBlf0DiXHFvRU0dxLfnCoZCpqg/LFtDHshle/uglLwfvkaLM/q4BDW+tTvI9GSk96MlRbKR2sSJuQ95Zr2TaTlhUtk8RXPL8dabiNOt3TJMoZ6x5ppbRrFA+ex5pm0ECY0EPhRp41ZftGqoHk3OreBdsPSu4UhPgTa8kU7wKP2Lsqv0AZIQmWWFQgP3FqCag1XhIQEVP/GODyOaODMB+6dE5wslL6SAN1xvI9sVew/MdPccOWLhfFyC6zRgP2VbRHLASwK5HbQBcG0RJIhLkpydf7PxfW4AT6gzXmOGjHaelE7rYiMSfgMmuDJwb9OCNGw6YB5qUWkWC6xN6F1T3x7iQ4be0T4extC43EBzSPGsSgPweePccnbz8me5F7jMTvnA8j2KNggqXF9O1NZws4pOVy+zYfrOAi9bT4gQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(376002)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(966005)(186003)(16526019)(2616005)(41300700001)(426003)(336012)(83380400001)(26005)(1076003)(66574015)(7696005)(6666004)(36860700001)(47076005)(478600001)(40460700003)(54906003)(4326008)(81166007)(356005)(6916009)(82740400003)(70206006)(70586007)(40480700001)(316002)(5660300002)(8676002)(8936002)(44832011)(2906002)(86362001)(82310400005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2023 16:40:38.8934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5204f739-286f-483c-0089-08db612c99c6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5181 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767339002258222554?= X-GMAIL-MSGID: =?utf-8?q?1767339002258222554?= |
Series |
[v5,1/2] PCI: Refactor pci_bridge_d3_possible()
|
|
Commit Message
Mario Limonciello
May 30, 2023, 4:39 p.m. UTC
Using a USB keyboard or mouse 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 PCIe ports go into D3 during s2idle. When specific root ports are put into D3 over s2idle on some AMD platforms it is not possible for the platform to properly identify wakeup sources. This happens whether the root port goes into D3hot or D3cold. Comparing registers between Linux and Windows 11 this behavior to put these specific root ports into D3 at suspend is unique to Linux. On an affected system Windows does not put those specific root ports into D3 over Modern Standby. Windows avoids putting Root Ports that are not power manageable (e.g do not have platform firmware support) into low power states. Linux shouldn't assume root ports support D3 just because they're on a machine newer than 2015, the ports should also be deemed power manageable. Add an extra check explicitly for root ports to ensure D3 isn't selected for them if they are not power-manageable through platform firmware. Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") Reported-by: Iain Lane <iain@orangesquash.org.uk> Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 Acked-by: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- v4->v5: * Add tags * Fix title * Adjust commit message v3->v4: * Move after refactor --- drivers/pci/pci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
Hi Mario, The patch itself looks fine, but since I don't have all the power management details in my head, it would help me a lot to make the description more concrete. On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: > Using a USB keyboard or mouse to wakeup the system from s2idle fails when > that xHCI device is connected to a USB-C port for an AMD USB4 router. It sounds like the real issue is that "Root Ports in D3hot/D3cold may not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits are probably not really relevant. And hopefully even the "AMD platforms" mentioned below is not relevant. > Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > all PCIe ports go into D3 during s2idle. > > When specific root ports are put into D3 over s2idle on some AMD platforms > it is not possible for the platform to properly identify wakeup sources. > This happens whether the root port goes into D3hot or D3cold. Can we connect this to a spec so it's not just the empirical "some AMD platforms work like X" observation? "s2idle" is meaningful on the power management side of the house, but it doesn't appear in PCI or ACPI specs, so I don't know what it means here. I assume the D3hot/D3cold state of the Root Port is the critical factor, regardless of how it got there. > Comparing registers between Linux and Windows 11 this behavior to put > these specific root ports into D3 at suspend is unique to Linux. On an > affected system Windows does not put those specific root ports into D3 > over Modern Standby. > > Windows avoids putting Root Ports that are not power manageable (e.g do > not have platform firmware support) into low power states. The Windows behavior was probably useful to you in debugging, but I don't really care about these Windows details because I don't think they help us maintain this in the future. > Linux shouldn't assume root ports support D3 just because they're on a > machine newer than 2015, the ports should also be deemed power manageable. > Add an extra check explicitly for root ports to ensure D3 isn't selected > for them if they are not power-manageable through platform firmware. But I *would* like to know specifically what "power manageable" means here. I might naively assume that a device with the PCI Power Management Capability is "power manageable", and that if PME_Support includes D3hot and D3cold, we're good to go. But obviously it's more complicated than that, and I'd like to cite the spec that mentions the actual things we need here. > Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > Reported-by: Iain Lane <iain@orangesquash.org.uk> > Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 > Acked-by: Rafael J. Wysocki <rafael@kernel.org> > Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > v4->v5: > * Add tags > * Fix title > * Adjust commit message > v3->v4: > * Move after refactor > --- > drivers/pci/pci.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index d1fa040bcea7..d293db963327 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -3015,6 +3015,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) > if (dmi_check_system(bridge_d3_blacklist)) > return false; > > + /* > + * It's not safe to put root ports that don't support power > + * management into D3. I assume "it's not safe" really means "Root Ports in D3hot/D3cold may not be able to signal PME interrupts unless ... <mumble> platform firmware <mumble> e.g., ACPI method <mumble> ..." Can we include some of those hints here? > + */ > + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && > + !platform_pci_power_manageable(bridge)) > + return false; > + > /* > * It should be safe to put PCIe ports from 2015 or newer > * to D3. > -- > 2.34.1 >
On 6/2/2023 5:20 PM, Bjorn Helgaas wrote: > Hi Mario, > > The patch itself looks fine, but since I don't have all the power > management details in my head, it would help me a lot to make the > description more concrete. OK, please let me know if after reviewing my responses you would prefer me to take an attempt at rewriting the commit message or if you can handle changing it. > > On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: >> Using a USB keyboard or mouse to wakeup the system from s2idle fails when >> that xHCI device is connected to a USB-C port for an AMD USB4 router. > It sounds like the real issue is that "Root Ports in D3hot/D3cold may > not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits > are probably not really relevant. And hopefully even the "AMD > platforms" mentioned below is not relevant. Yeah. It comes down to how much you want in the commit about how we got to this conclusion versus a generic fix. I generally like to be verbose about a specific case something fixes so that when distros decide what to pull in to their older maintenance kernels they can understand what's important. >> Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") >> all PCIe ports go into D3 during s2idle. >> >> When specific root ports are put into D3 over s2idle on some AMD platforms >> it is not possible for the platform to properly identify wakeup sources. >> This happens whether the root port goes into D3hot or D3cold. > Can we connect this to a spec so it's not just the empirical "some AMD > platforms work like X" observation? > > "s2idle" is meaningful on the power management side of the house, but > it doesn't appear in PCI or ACPI specs, so I don't know what it means > here. I assume the D3hot/D3cold state of the Root Port is the > critical factor, regardless of how it got there. Unfortunately (?) for this particular issue it's only a critical factor when the system is in s2idle. PME works fine to wake up the device if the root port is in either D3hot or D3cold when the system isn't in s2idle. > >> Comparing registers between Linux and Windows 11 this behavior to put >> these specific root ports into D3 at suspend is unique to Linux. On an >> affected system Windows does not put those specific root ports into D3 >> over Modern Standby. >> >> Windows avoids putting Root Ports that are not power manageable (e.g do >> not have platform firmware support) into low power states. > The Windows behavior was probably useful to you in debugging, but I > don't really care about these Windows details because I don't think > they help us maintain this in the future. OK. >> Linux shouldn't assume root ports support D3 just because they're on a >> machine newer than 2015, the ports should also be deemed power manageable. >> Add an extra check explicitly for root ports to ensure D3 isn't selected >> for them if they are not power-manageable through platform firmware. > But I *would* like to know specifically what "power manageable" means > here. I might naively assume that a device with the PCI Power > Management Capability is "power manageable", and that if PME_Support > includes D3hot and D3cold, we're good to go. But obviously it's more > complicated than that, and I'd like to cite the spec that mentions the > actual things we need here. Power manageable through platform firmware means the device has ACPI methods like like _PR0, _PS0. >> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") >> Reported-by: Iain Lane <iain@orangesquash.org.uk> >> Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 >> Acked-by: Rafael J. Wysocki <rafael@kernel.org> >> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> >> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> >> --- >> v4->v5: >> * Add tags >> * Fix title >> * Adjust commit message >> v3->v4: >> * Move after refactor >> --- >> drivers/pci/pci.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >> index d1fa040bcea7..d293db963327 100644 >> --- a/drivers/pci/pci.c >> +++ b/drivers/pci/pci.c >> @@ -3015,6 +3015,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) >> if (dmi_check_system(bridge_d3_blacklist)) >> return false; >> >> + /* >> + * It's not safe to put root ports that don't support power >> + * management into D3. > I assume "it's not safe" really means "Root Ports in D3hot/D3cold may > not be able to signal PME interrupts unless ... <mumble> platform > firmware <mumble> e.g., ACPI method <mumble> ..." > > Can we include some of those hints here? I'm cautious about hardcoding logic used by acpi_bus_get_power_flags() in a comment in case it changes. How about: "Root ports in D3 may not be able to reliably signal wakeup events unless platform firmware signals power management capabilities". > >> + */ >> + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && >> + !platform_pci_power_manageable(bridge)) >> + return false; >> + >> /* >> * It should be safe to put PCIe ports from 2015 or newer >> * to D3. >> -- >> 2.34.1 >>
On Fri, Jun 02, 2023 at 05:38:37PM -0500, Limonciello, Mario wrote: > On 6/2/2023 5:20 PM, Bjorn Helgaas wrote: > > On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: > > > Using a USB keyboard or mouse to wakeup the system from s2idle fails when > > > that xHCI device is connected to a USB-C port for an AMD USB4 router. > > > > It sounds like the real issue is that "Root Ports in D3hot/D3cold may > > not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits > > are probably not really relevant. And hopefully even the "AMD > > platforms" mentioned below is not relevant. > > Yeah. It comes down to how much you want in the commit > about how we got to this conclusion versus a generic > fix. I generally like to be verbose about a specific case > something fixes so that when distros decide what to pull > in to their older maintenance kernels they can understand > what's important. That's actually my point. I think this problem probably affects non-USB devices, non-xHCI devices, non-USB4 routers, etc. If we can say "Any device below a Root Port in D3hot/D3cold may not support wakeup if X, Y, Z. Root Ports may be put in D3hot/D3cold for sleep/hibernate/s2idle/...", that's much more actionable. > > > Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > > > all PCIe ports go into D3 during s2idle. > > > > > > When specific root ports are put into D3 over s2idle on some AMD platforms > > > it is not possible for the platform to properly identify wakeup sources. > > > This happens whether the root port goes into D3hot or D3cold. > > > > Can we connect this to a spec so it's not just the empirical "some AMD > > platforms work like X" observation? > > > > "s2idle" is meaningful on the power management side of the house, but > > it doesn't appear in PCI or ACPI specs, so I don't know what it means > > here. I assume the D3hot/D3cold state of the Root Port is the > > critical factor, regardless of how it got there. > > Unfortunately (?) for this particular issue it's only a > critical factor when the system is in s2idle. > > PME works fine to wake up the device if the root port is > in either D3hot or D3cold when the system isn't in s2idle. So that must mean something other than the Root Port has to be in some specific state. "System in s2idle" is not actionable in terms of PCI maintenance. It sounds like we just haven't really gotten to the root cause yet. > > > Linux shouldn't assume root ports support D3 just because they're on a > > > machine newer than 2015, the ports should also be deemed power manageable. > > > Add an extra check explicitly for root ports to ensure D3 isn't selected > > > for them if they are not power-manageable through platform firmware. > > > > But I *would* like to know specifically what "power manageable" means > > here. I might naively assume that a device with the PCI Power > > Management Capability is "power manageable", and that if PME_Support > > includes D3hot and D3cold, we're good to go. But obviously it's more > > complicated than that, and I'd like to cite the spec that mentions the > > actual things we need here. > > Power manageable through platform firmware means the device > has ACPI methods like like _PR0, _PS0. What's the connection to wakeup? > > > + * It's not safe to put root ports that don't support power > > > + * management into D3. > > > > I assume "it's not safe" really means "Root Ports in D3hot/D3cold may > > not be able to signal PME interrupts unless ... <mumble> platform > > firmware <mumble> e.g., ACPI method <mumble> ..." > > > > Can we include some of those hints here? > > I'm cautious about hardcoding logic used by > acpi_bus_get_power_flags() in a comment in case it changes. > > How about: > > "Root ports in D3 may not be able to reliably signal wakeup > events unless platform firmware signals power management > capabilities". I'm really looking hard for that spec citation :) Without that, this just devolves into "this seems to work on these systems." > > > + */ > > > + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && > > > + !platform_pci_power_manageable(bridge)) > > > + return false; > > > + > > > /* > > > * It should be safe to put PCIe ports from 2015 or newer > > > * to D3. > > > -- > > > 2.34.1 > > >
On 6/2/2023 6:19 PM, Bjorn Helgaas wrote: > On Fri, Jun 02, 2023 at 05:38:37PM -0500, Limonciello, Mario wrote: >> On 6/2/2023 5:20 PM, Bjorn Helgaas wrote: >>> On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: >>>> Using a USB keyboard or mouse to wakeup the system from s2idle fails when >>>> that xHCI device is connected to a USB-C port for an AMD USB4 router. >>> It sounds like the real issue is that "Root Ports in D3hot/D3cold may >>> not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits >>> are probably not really relevant. And hopefully even the "AMD >>> platforms" mentioned below is not relevant. >> Yeah. It comes down to how much you want in the commit >> about how we got to this conclusion versus a generic >> fix. I generally like to be verbose about a specific case >> something fixes so that when distros decide what to pull >> in to their older maintenance kernels they can understand >> what's important. > That's actually my point. I think this problem probably affects > non-USB devices, non-xHCI devices, non-USB4 routers, etc. > > If we can say "Any device below a Root Port in D3hot/D3cold may not > support wakeup if X, Y, Z. Root Ports may be put in D3hot/D3cold for > sleep/hibernate/s2idle/...", that's much more actionable. Completely agree. > >>>> Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") >>>> all PCIe ports go into D3 during s2idle. >>>> >>>> When specific root ports are put into D3 over s2idle on some AMD platforms >>>> it is not possible for the platform to properly identify wakeup sources. >>>> This happens whether the root port goes into D3hot or D3cold. >>> Can we connect this to a spec so it's not just the empirical "some AMD >>> platforms work like X" observation? >>> >>> "s2idle" is meaningful on the power management side of the house, but >>> it doesn't appear in PCI or ACPI specs, so I don't know what it means >>> here. I assume the D3hot/D3cold state of the Root Port is the >>> critical factor, regardless of how it got there. >> Unfortunately (?) for this particular issue it's only a >> critical factor when the system is in s2idle. >> >> PME works fine to wake up the device if the root port is >> in either D3hot or D3cold when the system isn't in s2idle. > So that must mean something other than the Root Port has to be in some > specific state. "System in s2idle" is not actionable in terms of PCI > maintenance. It sounds like we just haven't really gotten to the root > cause yet. The root cause of this behavior is deep in the platform firmware. This is why the platform firmware doesn't advertise power management support for the root port. > >>>> Linux shouldn't assume root ports support D3 just because they're on a >>>> machine newer than 2015, the ports should also be deemed power manageable. >>>> Add an extra check explicitly for root ports to ensure D3 isn't selected >>>> for them if they are not power-manageable through platform firmware. >>> But I *would* like to know specifically what "power manageable" means >>> here. I might naively assume that a device with the PCI Power >>> Management Capability is "power manageable", and that if PME_Support >>> includes D3hot and D3cold, we're good to go. But obviously it's more >>> complicated than that, and I'd like to cite the spec that mentions the >>> actual things we need here. >> Power manageable through platform firmware means the device >> has ACPI methods like like _PR0, _PS0. > What's the connection to wakeup? There is also no _PRW (power resources for wake) for this root port. > >>>> + * It's not safe to put root ports that don't support power >>>> + * management into D3. >>> I assume "it's not safe" really means "Root Ports in D3hot/D3cold may >>> not be able to signal PME interrupts unless ... <mumble> platform >>> firmware <mumble> e.g., ACPI method <mumble> ..." >>> >>> Can we include some of those hints here? >> I'm cautious about hardcoding logic used by >> acpi_bus_get_power_flags() in a comment in case it changes. >> >> How about: >> >> "Root ports in D3 may not be able to reliably signal wakeup >> events unless platform firmware signals power management >> capabilities". > I'm really looking hard for that spec citation :) Without that, this > just devolves into "this seems to work on these systems." I mean that's exactly what the broken logic below this fix is.... But I think I can get you what you're looking for. From this failing system the problematic root port is GP19. The DSDT has: Device (GP19) { Method (_DSM,..) Method (_PRT,..) Device (NHI0) Device (NHI1) } The SSDT has: Scope (\_SB.PCI0.GP19) { Method (YS0W,..) Method (YPRW,..) Method (RPRM,..) Method (WPRM,..) Method (SPDP,..) Method (SPCH,..) Method (_STA,..) Method (_INI,..) Method (_REG,..) } Section 7.3 from the ACPI spec [1] says "For a device that is power-managed using ACPI, a Definition Block contains one or more of the objects found in the table below. Power management of a device is done using Power Resource control" The GP19 device has NONE of the objects mentioned in the table. Outside of this change, I do think this means acpi_bus_get_power_flags() may want to also look for some of the other objects besides _PS0 and _PR0 to resolve that a device is power manageable though. [1] https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/07_Power_and_Performance_Mgmt/device-power-management-objects.html?highlight=pr0#device-power-management-objects >>>> + */ >>>> + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && >>>> + !platform_pci_power_manageable(bridge)) >>>> + return false; >>>> + >>>> /* >>>> * It should be safe to put PCIe ports from 2015 or newer >>>> * to D3. >>>> -- >>>> 2.34.1 >>>>
On Sat, Jun 3, 2023 at 12:38 AM Limonciello, Mario <mario.limonciello@amd.com> wrote: > > > On 6/2/2023 5:20 PM, Bjorn Helgaas wrote: > > Hi Mario, > > > > The patch itself looks fine, but since I don't have all the power > > management details in my head, it would help me a lot to make the > > description more concrete. > OK, please let me know if after reviewing my responses you > would prefer me to take an attempt at rewriting the commit > message or if you can handle changing it. > > > > On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: > >> Using a USB keyboard or mouse to wakeup the system from s2idle fails when > >> that xHCI device is connected to a USB-C port for an AMD USB4 router. > > It sounds like the real issue is that "Root Ports in D3hot/D3cold may > > not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits > > are probably not really relevant. And hopefully even the "AMD > > platforms" mentioned below is not relevant. > Yeah. It comes down to how much you want in the commit > about how we got to this conclusion versus a generic > fix. I generally like to be verbose about a specific case > something fixes so that when distros decide what to pull > in to their older maintenance kernels they can understand > what's important. > >> Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > >> all PCIe ports go into D3 during s2idle. > >> > >> When specific root ports are put into D3 over s2idle on some AMD platforms > >> it is not possible for the platform to properly identify wakeup sources. > >> This happens whether the root port goes into D3hot or D3cold. > > Can we connect this to a spec so it's not just the empirical "some AMD > > platforms work like X" observation? > > > > "s2idle" is meaningful on the power management side of the house, but > > it doesn't appear in PCI or ACPI specs, so I don't know what it means > > here. I assume the D3hot/D3cold state of the Root Port is the > > critical factor, regardless of how it got there. > > Unfortunately (?) for this particular issue it's only a > critical factor when the system is in s2idle. > > PME works fine to wake up the device if the root port is > in either D3hot or D3cold when the system isn't in s2idle. Why doesn't it work fine when the system is in s2idle then? Getting to the root of this would be really helpful here IMO. > > > >> Comparing registers between Linux and Windows 11 this behavior to put > >> these specific root ports into D3 at suspend is unique to Linux. On an > >> affected system Windows does not put those specific root ports into D3 > >> over Modern Standby. > >> > >> Windows avoids putting Root Ports that are not power manageable (e.g do > >> not have platform firmware support) into low power states. > > The Windows behavior was probably useful to you in debugging, but I > > don't really care about these Windows details because I don't think > > they help us maintain this in the future. > OK. > >> Linux shouldn't assume root ports support D3 just because they're on a > >> machine newer than 2015, the ports should also be deemed power manageable. > >> Add an extra check explicitly for root ports to ensure D3 isn't selected > >> for them if they are not power-manageable through platform firmware. > > But I *would* like to know specifically what "power manageable" means > > here. I might naively assume that a device with the PCI Power > > Management Capability is "power manageable", and that if PME_Support > > includes D3hot and D3cold, we're good to go. But obviously it's more > > complicated than that, and I'd like to cite the spec that mentions the > > actual things we need here. > Power manageable through platform firmware means the device > has ACPI methods like like _PR0, _PS0. > >> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") > >> Reported-by: Iain Lane <iain@orangesquash.org.uk> > >> Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 > >> Acked-by: Rafael J. Wysocki <rafael@kernel.org> > >> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > >> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> > >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > >> --- > >> v4->v5: > >> * Add tags > >> * Fix title > >> * Adjust commit message > >> v3->v4: > >> * Move after refactor > >> --- > >> drivers/pci/pci.c | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > >> index d1fa040bcea7..d293db963327 100644 > >> --- a/drivers/pci/pci.c > >> +++ b/drivers/pci/pci.c > >> @@ -3015,6 +3015,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) > >> if (dmi_check_system(bridge_d3_blacklist)) > >> return false; > >> > >> + /* > >> + * It's not safe to put root ports that don't support power > >> + * management into D3. > > I assume "it's not safe" really means "Root Ports in D3hot/D3cold may > > not be able to signal PME interrupts unless ... <mumble> platform > > firmware <mumble> e.g., ACPI method <mumble> ..." > > > > Can we include some of those hints here? > > I'm cautious about hardcoding logic used by > acpi_bus_get_power_flags() in a comment in case it changes. > > How about: > > "Root ports in D3 may not be able to reliably signal wakeup > events unless platform firmware signals power management > capabilities". I would rather write "unless then can be power-managed with the help of the platform firmware". The meaning of "signaling" is unclear in this context and even if it was clear, the platform firmware support actually needs to be used here, its mere existence is not sufficient AFAICS.
On 6/4/2023 6:40 AM, Rafael J. Wysocki wrote: > On Sat, Jun 3, 2023 at 12:38 AM Limonciello, Mario > <mario.limonciello@amd.com> wrote: >> >> On 6/2/2023 5:20 PM, Bjorn Helgaas wrote: >>> Hi Mario, >>> >>> The patch itself looks fine, but since I don't have all the power >>> management details in my head, it would help me a lot to make the >>> description more concrete. >> OK, please let me know if after reviewing my responses you >> would prefer me to take an attempt at rewriting the commit >> message or if you can handle changing it. >>> On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: >>>> Using a USB keyboard or mouse to wakeup the system from s2idle fails when >>>> that xHCI device is connected to a USB-C port for an AMD USB4 router. >>> It sounds like the real issue is that "Root Ports in D3hot/D3cold may >>> not support wakeup", and the USB, xHCI, USB-C, AMD USB4 router bits >>> are probably not really relevant. And hopefully even the "AMD >>> platforms" mentioned below is not relevant. >> Yeah. It comes down to how much you want in the commit >> about how we got to this conclusion versus a generic >> fix. I generally like to be verbose about a specific case >> something fixes so that when distros decide what to pull >> in to their older maintenance kernels they can understand >> what's important. >>>> Due to commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") >>>> all PCIe ports go into D3 during s2idle. >>>> >>>> When specific root ports are put into D3 over s2idle on some AMD platforms >>>> it is not possible for the platform to properly identify wakeup sources. >>>> This happens whether the root port goes into D3hot or D3cold. >>> Can we connect this to a spec so it's not just the empirical "some AMD >>> platforms work like X" observation? >>> >>> "s2idle" is meaningful on the power management side of the house, but >>> it doesn't appear in PCI or ACPI specs, so I don't know what it means >>> here. I assume the D3hot/D3cold state of the Root Port is the >>> critical factor, regardless of how it got there. >> Unfortunately (?) for this particular issue it's only a >> critical factor when the system is in s2idle. >> >> PME works fine to wake up the device if the root port is >> in either D3hot or D3cold when the system isn't in s2idle. > Why doesn't it work fine when the system is in s2idle then? > > Getting to the root of this would be really helpful here IMO. The process of the hardware going into s2idle has a certain sequence of events by the platform. This sequence is what causes the PME to not be able to work during resume. This issue has been root caused and is understood by AMD platform designers. It's why the AML doesn't provide any of those ACPI power management routines outlined in the ACPI spec. If the AML is patched to advertise these routines the exact same issue is reproduced under Windows 11. >>>> Comparing registers between Linux and Windows 11 this behavior to put >>>> these specific root ports into D3 at suspend is unique to Linux. On an >>>> affected system Windows does not put those specific root ports into D3 >>>> over Modern Standby. >>>> >>>> Windows avoids putting Root Ports that are not power manageable (e.g do >>>> not have platform firmware support) into low power states. >>> The Windows behavior was probably useful to you in debugging, but I >>> don't really care about these Windows details because I don't think >>> they help us maintain this in the future. >> OK. >>>> Linux shouldn't assume root ports support D3 just because they're on a >>>> machine newer than 2015, the ports should also be deemed power manageable. >>>> Add an extra check explicitly for root ports to ensure D3 isn't selected >>>> for them if they are not power-manageable through platform firmware. >>> But I *would* like to know specifically what "power manageable" means >>> here. I might naively assume that a device with the PCI Power >>> Management Capability is "power manageable", and that if PME_Support >>> includes D3hot and D3cold, we're good to go. But obviously it's more >>> complicated than that, and I'd like to cite the spec that mentions the >>> actual things we need here. >> Power manageable through platform firmware means the device >> has ACPI methods like like _PR0, _PS0. >>>> Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") >>>> Reported-by: Iain Lane <iain@orangesquash.org.uk> >>>> Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 >>>> Acked-by: Rafael J. Wysocki <rafael@kernel.org> >>>> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> >>>> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> >>>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> >>>> --- >>>> v4->v5: >>>> * Add tags >>>> * Fix title >>>> * Adjust commit message >>>> v3->v4: >>>> * Move after refactor >>>> --- >>>> drivers/pci/pci.c | 8 ++++++++ >>>> 1 file changed, 8 insertions(+) >>>> >>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >>>> index d1fa040bcea7..d293db963327 100644 >>>> --- a/drivers/pci/pci.c >>>> +++ b/drivers/pci/pci.c >>>> @@ -3015,6 +3015,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) >>>> if (dmi_check_system(bridge_d3_blacklist)) >>>> return false; >>>> >>>> + /* >>>> + * It's not safe to put root ports that don't support power >>>> + * management into D3. >>> I assume "it's not safe" really means "Root Ports in D3hot/D3cold may >>> not be able to signal PME interrupts unless ... <mumble> platform >>> firmware <mumble> e.g., ACPI method <mumble> ..." >>> >>> Can we include some of those hints here? >> I'm cautious about hardcoding logic used by >> acpi_bus_get_power_flags() in a comment in case it changes. >> >> How about: >> >> "Root ports in D3 may not be able to reliably signal wakeup >> events unless platform firmware signals power management >> capabilities". > I would rather write "unless then can be power-managed with the help > of the platform firmware". > > The meaning of "signaling" is unclear in this context and even if it > was clear, the platform firmware support actually needs to be used > here, its mere existence is not sufficient AFAICS. OK thanks!
On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: > + /* > + * It's not safe to put root ports that don't support power > + * management into D3. > + */ > + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && > + !platform_pci_power_manageable(bridge)) > + return false; > + > /* > * It should be safe to put PCIe ports from 2015 or newer > * to D3. My recollection is that we began suspending Root Ports to D3hot because otherwise low power states of the whole CPU package could not be reached on certain Intel CPUs from the 2015+ era. Do we know if the DSDT of all those systems contains the required ACPI objects to continue runtime suspending their Root Ports after this change? Otherwise these systems would experience a power regression. Thanks, Lukas
On 6/7/2023 3:01 AM, Lukas Wunner wrote: > On Tue, May 30, 2023 at 11:39:47AM -0500, Mario Limonciello wrote: >> + /* >> + * It's not safe to put root ports that don't support power >> + * management into D3. >> + */ >> + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && >> + !platform_pci_power_manageable(bridge)) >> + return false; >> + >> /* >> * It should be safe to put PCIe ports from 2015 or newer >> * to D3. > My recollection is that we began suspending Root Ports to D3hot because > otherwise low power states of the whole CPU package could not be reached > on certain Intel CPUs from the 2015+ era. > > Do we know if the DSDT of all those systems contains the required ACPI > objects to continue runtime suspending their Root Ports after this change? > Otherwise these systems would experience a power regression. > > Thanks, > > Lukas You might not have been CC'ed on my earlier patches, but I was worried about a similar problem and at least in one of the earlier versions was adjusting the existing heuristic of ">= 2015" to "Intel & >= 2015". That being said, this most recent version got R-b and A-b tags from 3 Intel guys, I would think they cross referenced reference systems to make that assertion before adding tags.
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d1fa040bcea7..d293db963327 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3015,6 +3015,14 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) if (dmi_check_system(bridge_d3_blacklist)) return false; + /* + * It's not safe to put root ports that don't support power + * management into D3. + */ + if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT && + !platform_pci_power_manageable(bridge)) + return false; + /* * It should be safe to put PCIe ports from 2015 or newer * to D3.