From patchwork Fri Aug 4 21:01:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342333 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA162C001DE for ; Fri, 4 Aug 2023 21:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjHDVBv (ORCPT ); Fri, 4 Aug 2023 17:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjHDVBs (ORCPT ); Fri, 4 Aug 2023 17:01:48 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2068.outbound.protection.outlook.com [40.107.244.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7637E42; Fri, 4 Aug 2023 14:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OerpOx9LOsVd44fB4AZNoraRmO4MxGfKyQeJIDZO0oKBpSnzlOwSnpwlKCCYxhRuTjZvYDmZoCYmlQuLzpG2IrN4X+oOQMEW63IaQj45r9j3sfwNRSdMndxre7mnferRUUE3T3utZUKN4jeIARvzvA8NUstVClKN0ByZSdgk9gSCR5SfmDn7rt85yYzstWgjEYbpZejKuOGSvR6PRNwn2yx4TRUzsc2wP7AhQ4Wvy17RJcYVRJ1cANZfjbfg0a16GpPWX2E7fgrahJHi4UAeMYAAhvvdybHptMUUZg60jjk77h6PpOGYix/LNKyZ/qFHcchd/YyMWgbTXc1Hc4grsw== 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=2lkYiFMckExmcs/g1xdUVlvrDSHqW2J0qOhUZBWyD4k=; b=ZtarmMnVdeYoi+Ck+OrwWE3kO5pbEMBF7896bVsiNNcf8L1EOnUNRDaoxWiCZ8XEBw7KOhgiJ5QkV+RihvOmkUa/Eb2el3DtFHLHY/jFMpylo21p3uF+lpbftFU43mG2wzTD/yVOijSBcnBevqPulOUYV5eqo5vWdzv7BSnmFres3/5oxfDFIKlArKRvcX61ep8TYZKM0Y3zjsjdw7UEfVJj9dgIHw48/nj+pmjeetycE4Gt1KZULEDtqm79J5gtJSzbFshZG1LH719HDTLZtt9T2Wtby3B3ZbdpRxTmVfvpzSfCXOBTo2Gn2lAZATP1LUoTa3ZDbU5G+jiJ5wsQZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=2lkYiFMckExmcs/g1xdUVlvrDSHqW2J0qOhUZBWyD4k=; b=0sZaw2dN4hlLARP022De2CzPdTxmupCjYSYGaK/3yvqavTCwJCarsYkNjVJSF0KpMuIWvPZTiOSVldruXB5FmI3gV3tCmWTTezpNERpMOkOa+8jyZI74RJLQJS0SiLDThTGn4sRDvNpd+pgwA7hEj6U/kd0zh7IrQfD4nJNFZcY= Received: from DS7PR03CA0268.namprd03.prod.outlook.com (2603:10b6:5:3b3::33) by DM4PR12MB5085.namprd12.prod.outlook.com (2603:10b6:5:388::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 21:01:44 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::7c) by DS7PR03CA0268.outlook.office365.com (2603:10b6:5:3b3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:44 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:44 +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.2507.27; Fri, 4 Aug 2023 16:01:42 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 1/7] ACPI: Add comments to clarify some #ifdef statements Date: Fri, 4 Aug 2023 16:01:23 -0500 Message-ID: <20230804210129.5356-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE32:EE_|DM4PR12MB5085:EE_ X-MS-Office365-Filtering-Correlation-Id: ecc7da14-2752-4883-d656-08db952e0294 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JjJgV5Cp2F+lKZ0bh6NB8cFXWxjY6hDpxROd8EQVjrczwVU1YqzkYsZCed34rI/vEeqT8QsVdTOS2Bh+3dNjloX7EjHUQW3phABxKfJbVt+UvIZjs1rw0l1OVLIWDKUt7Hdcep5TLXb0HU7mU9N3ir5gp65vwMGXaTyTRMnbU7JJ7gxm5pVbLc+dUsLp+y4eih0hyhRm8sRZ86apU7YUWVPhGUpEA+K2PBngUX7TvkAqDxkaa5DjpesTCG42KAL1irThQdqyj0Us1a+u7riDDrUmHWGMMxjOs1aY/NMSOb0qD+wtoeOO4E5CGomN26qw4eiF7EenX+EqQAB8+NUfKV+7igwsA0qXQeQpKywTMCCJYCBXWtHb8/wRxpIYZJKJ5voE2CzOEu5eLjYjv2Nx8VyeZ4IGyr9WhD066M54pVg0ex2DvXO0F2B2+3wnyXniZ25J2Di2gSQF87N/UGHrMGj6fDlLD8s3MD5Wl+vHB1juX3dlZt8jxkVCb8QOssRGNWF1L0c78NCHtUkrmOs6SzvEkqKtiRiXgC765H9MtlHJBXtIh3HqggcStZitauuIRkV7UGlBffK01uX0RZqoStGKL8fF0ZTMND9lz69qmYQWxnBbykCsa0nXqz8shs2VUaWfctTH5zXLdMVbRLJ1nWOmEb+VPpBnQImpqgzZjjo34Hhk+yApoNnUiyZan0AtpPQ1Y2oMnEwmYizdRQ5Z2y6Abdpybk/T5RH9ZwYuKZde115NmbY/XaiXjd65UZaxL0NgAR5RnbiSnCn/wNDduQ== 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)(39860400002)(136003)(346002)(376002)(396003)(1800799003)(82310400008)(186006)(451199021)(40470700004)(36840700001)(46966006)(2906002)(40460700003)(44832011)(4744005)(426003)(2616005)(36756003)(16526019)(47076005)(83380400001)(40480700001)(26005)(1076003)(336012)(86362001)(70586007)(70206006)(4326008)(41300700001)(316002)(7696005)(82740400003)(356005)(81166007)(54906003)(110136005)(6666004)(478600001)(8676002)(8936002)(5660300002)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:44.6306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecc7da14-2752-4883-d656-08db952e0294 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5085 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org With nested #ifdef statements it's sometimes difficult to tell which code goes with which statement. One comment was wrong, so fix it and add another comment to clarify another. Signed-off-by: Mario Limonciello --- v9->v10: * no changes --- include/linux/acpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 641dc48439873..0d5277b7c6323 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1117,10 +1117,10 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr, size_t size) { } -#endif /* CONFIG_X86 */ +#endif /* CONFIG_IA64 */ #else #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) -#endif +#endif /* CONFIG_ACPI */ #if defined(CONFIG_ACPI) && defined(CONFIG_PM) int acpi_dev_suspend(struct device *dev, bool wakeup); From patchwork Fri Aug 4 21:01:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342334 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D2EC41513 for ; Fri, 4 Aug 2023 21:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjHDVCM (ORCPT ); Fri, 4 Aug 2023 17:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjHDVBz (ORCPT ); Fri, 4 Aug 2023 17:01:55 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE484C3F; Fri, 4 Aug 2023 14:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gV78pjsOmBMmCY57qfe4gPqZjk9A21htGdS89Sc7CaeKHeSfcHhI2AHZBmppxbsr/tRbcSHlK1vPlcqrOxJnu1ehIg+qXVRKa88mBEU+//lQq71QkiV+Yh0HG4DZBcBQOTnsxIQNRu1LrYvLOpUDfQZ3pHUQ0r8OZJwj7HTded5hwU9s+O81Rv5Uh+eRo5sy1Ur+jKBJf2c3BLxgLvMxF7kPWKwpJ+DDvlSQrJfVRV2ONB5Yv9LR8KWIyg5XomPbozYoeokj3HwvRlHCGf0izP6r/9Y2Tc2V+39/FvbAQlN54PmoXGUmnda1GLZIHcv1LX0xk1PKZgvEczXR7IZZ3Q== 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=q8wy8q3IOgcBEWWi5OVXq9YyjyJNeJK0uA3uWwtwarQ=; b=UK45pmuZz/Tkco0+lKSu3lKqnF42OVHhntWZwDnE3k+8CmF5JvKNPovUw2gpVldgVIDaTmmwxBLJxP/DeJPBcRXdmZLPGoFQ9PCgDARakcJqG+kV+r5ejk/Sz0xjxoJXCKMDk+Pt/wscy3tx3t08yfdjc/1KD7UtQcJY3v0FnJr35rFxjI/qgPn+M9ZuS9Q9GBbxz2GrrPh2TqztxyWPdP76UPiqUtGuIEZ8Ocp8V0R2yQ5WgnajR3sI42Uc+zlAR4HzfjlTTb+kwR5Y2m9UubGBbeQHijZf3UQTWkcedeRAKhBE1dzMN9UPxzDVb5z0FSqYzCM4pB+XhZqHt2uIcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=q8wy8q3IOgcBEWWi5OVXq9YyjyJNeJK0uA3uWwtwarQ=; b=5gVf/tYDZx7epYqBsnxFI8GiBg0Yjivbd+bT8E/LI89CGckHQPoNOrb6ZEC0MXf68fX0N2bTA9+uVJUFwy0epqYObx7Y8dK+OJXU1ftGUIKbkpszr+TnVVBQApuvDtiFBhUrC5DHhU2JuM9udLkjFqqJykb9hS/vVpIjZ1NwqXU= Received: from DS7PR03CA0241.namprd03.prod.outlook.com (2603:10b6:5:3b3::6) by SJ2PR12MB8036.namprd12.prod.outlook.com (2603:10b6:a03:4c1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:01:45 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::33) by DS7PR03CA0241.outlook.office365.com (2603:10b6:5:3b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:45 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:45 +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.2507.27; Fri, 4 Aug 2023 16:01:43 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 2/7] ACPI: Adjust #ifdef for *_lps0_dev use Date: Fri, 4 Aug 2023 16:01:24 -0500 Message-ID: <20230804210129.5356-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE32:EE_|SJ2PR12MB8036:EE_ X-MS-Office365-Filtering-Correlation-Id: 374a5de3-d96c-435d-e653-08db952e02e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4xkOlRQMtCfkwMBmo3OkytxErwLQ5fT4hoPWeph6Xc+fzzr9WwLitoZ0cGyjCZwih/GYn7uCopLiMIfUhyGwPZVs7KyVTBbUuRHQD4X4l2Zp9od0090wrO85IqkxG3wAfe6YXQdc3c7oWmBSRZZ0qBqWnjlaesZWwsWVfHx4ihh62g20odsnk+JQqXzjL02stUuHDNmALWnxBc0+x608eE+4XCBCKMhI1hMORygBdqPHLEadOqEGu5zksNLJo7eTtyJsjOkydsR4vRYDko8ozStOfvthzRZ0SLlANS7adPIQPCTy04uUJaL7QBb6+GuNh8NcNJKWEtkgDZsBmwDF6JcWvghio7XC7SOUxgC3aXcZjOGSB5mjIGp60YKueYj8+wm5buLJB76G4hCxohvWidZYebGInC3pHaJkeuX5ayOh56ZxpfIFTwllUVRNdbnhyp5qzlEJViQqh4RqOGZLNbAu0t3XexyhAV/SgjnqDHP/V4igULB6Zsb78P/a7spfC+WDbso81XpZWQVFliibbhSqtVMLfOc8jeVVspN+FiIeg8VfDTfCocAiKNnvnwQ0FV3OkHEwPKx2xX+5tIJgK3sIgKMuXeGz7cWDLzES+4BYgg9bdX6lTIqzgtxOLKIE25mBjb59DKhwmEGubpPEgoAqpxI4Zyn3tLxvhDYQ9GLkH/2ev9mdQMFVw2HBMg5cEMjPSMG2ZhlY9btRo1MOJCM9UGcpLOCMOi6ehJKk3nNXF38SV6cufSm4iGcllOmBQwEMs52dHlKlJPRkuTUvFA== 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)(39860400002)(346002)(136003)(396003)(376002)(451199021)(1800799003)(186006)(82310400008)(40470700004)(46966006)(36840700001)(41300700001)(40460700003)(8936002)(8676002)(83380400001)(36860700001)(47076005)(86362001)(336012)(16526019)(26005)(2616005)(81166007)(426003)(356005)(1076003)(82740400003)(316002)(6666004)(478600001)(40480700001)(7696005)(70586007)(54906003)(110136005)(36756003)(4326008)(70206006)(2906002)(5660300002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:45.1618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 374a5de3-d96c-435d-e653-08db952e02e5 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8036 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The #ifdef currently is guarded against CONFIG_X86, but these are actually sleep related functions so they should be tied to CONFIG_ACPI_SLEEP. Signed-off-by: Mario Limonciello --- v9->v10: * split from other patches --- include/linux/acpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 0d5277b7c6323..13a0fca3539f0 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1100,7 +1100,7 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state, acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b); -#ifdef CONFIG_X86 +#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) struct acpi_s2idle_dev_ops { struct list_head list_node; void (*prepare)(void); @@ -1109,7 +1109,7 @@ struct acpi_s2idle_dev_ops { }; int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg); void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg); -#endif /* CONFIG_X86 */ +#endif /* CONFIG_ACPI_SLEEP && CONFIG_X86 */ #ifndef CONFIG_IA64 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); #else From patchwork Fri Aug 4 21:01:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342332 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF1D1C04FDF for ; Fri, 4 Aug 2023 21:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbjHDVBw (ORCPT ); Fri, 4 Aug 2023 17:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbjHDVBt (ORCPT ); Fri, 4 Aug 2023 17:01:49 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2066.outbound.protection.outlook.com [40.107.243.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FDC14EC7; Fri, 4 Aug 2023 14:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8CzH4YvMTxbuMjWQDol/bbIF+WRHdt6sQyMuc3P0VkmedzyuWTUSvseQob8XFTvsxUpOlYD7xB6PaFsWTPeO/IHq6oDEZqKln2ebW3arOHNWbi4TetdYOEOUQarWCUE44dkjqvgcj3f/72z2fImPlheyDaUKzqTh9Gd023pXdf8NrO3r7WQTHFE8RkkHWcvBttvnsXRdLGj4ta5n5cNkYtt9GyrgF+OK6yvD/fKqxoFvSXJpho1QatBzF4ltrzxqF1NYeW7vDBg3kRk3UBjwWBFj/HISH+2yNKo1/bCpPhtmmZLjnSnMZxe5y8IgeR342KHPmYFs0+6DTYuB5oMSQ== 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=G+TY3ImzioxIbedi45ZnKUekgHsOAKUBzr+1AI1cdws=; b=KUAIYeo3oOIHvJBeSrlZuAbgFclbQ1Cyz6l9NYSyw6ChQQWZfFkrHxaSwOIqWCIw2pvhvfx0yUlS6yDOpYV64gDiokS9KVzxxzwEONw39Ku2P2b1u98Nx3UclAq9XzEb3fxdtj6juiSgrDXCat5NDsoa0XORusroZj93APY33/ZHNbpTfOehPDQEx+b2ZPrt+1Anq4NdAxsVQOD/V1GBUeBwwUSQYh6y0Ixc9D0RTUVxGcDsltoeft2NUUIhQFiXibFcWAlf10b3sMfJqIqunVnT9SA3/Ru+aTUTkg6I9DaeBMP0T9XPLD4VJsGhSCIVi2mI5dP2WjOxnwc/PnSewQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=G+TY3ImzioxIbedi45ZnKUekgHsOAKUBzr+1AI1cdws=; b=zVyP130PvPauLtF7MncAtlXmkcc7TJpwO9KUcKiyvKKeemrXQeoTfQ0+MrrWK9l7KxCVEYqST03Txp55U0DOUjThpxOb+2hhTiGw5MhCbFjs+VqZPNbE/yHomZ1W3RkfGMFSBafjfLtd0g4kTLN6u5c7xO/VSyNkHn9mBHn03Xk= Received: from DS7PR03CA0261.namprd03.prod.outlook.com (2603:10b6:5:3b3::26) by DM4PR12MB5038.namprd12.prod.outlook.com (2603:10b6:5:389::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 21:01:46 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::b4) by DS7PR03CA0261.outlook.office365.com (2603:10b6:5:3b3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:46 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:45 +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.2507.27; Fri, 4 Aug 2023 16:01:44 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 3/7] ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table Date: Fri, 4 Aug 2023 16:01:25 -0500 Message-ID: <20230804210129.5356-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE32:EE_|DM4PR12MB5038:EE_ X-MS-Office365-Filtering-Correlation-Id: e621c67a-83d3-44e3-f4cf-08db952e0355 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5/+Jrqn8YELcYifXNNhCstfGuQw4s4VNtl2gUySRViUFizz9xJyz2PQ+CpYBHpzittetKirOd+YLrgV45oBe35j/IPXfDT+he7vGDF5mgDMOmZDX7lSC4XEBxhn6CCUPqBgKGwsqtVR9P9ecfM5oHjjHlwt10uGt9nET4WjT7mYZlfywVERkn6hTj+FVGxMUhk3PG526I3o0yUGRxgOQAM/F/2AauPTpa774s/imWPO2MLzvDaJeYFhHdARY3MAdFzfk9WZZgZC/qf4dZx+fkea8vTSIgmv9U4eIjSSd/JvkBeTHQO9/g+IZMmlHQIAL7RE39kYFunKoOBR2j3XnAiaFazFGIo+RBZSPUCIjsyRYtOapx9WbpiIRL/oKzIQnNcVgDEtgf5/BPqJH0+0hQB+akD4Tgy4ozgy9wRBvECVD1qlb69QMLgMlcLgIFNwdU6LOql+hF0jqnH97K+5U/XLxW3PcPXoOcXtgN+qd4mo+RibzVYEUOC/SWT0xjViXDQoqyX8VFbBt0lVJY1FPIjLFiu2f7/gZMovYUahdc82/olWfd4YLUhMF90QyLGieLfnRpcWstuZGgC/eoErn3DcBDs+HPX8dJyT2VI99y8Up7Lc2WGI1VRnGiQxv4JudKwa+d964UAv8QWTJbQT9/yxXyBxwQ2W0Kv8nQjylCEHG1/boCUXS0/QHedZG1sKsWGLCYimkIu23iDQxK8g35xKwz2PXeJ/LIrSwOpBrWliEBUveLqr3rL1Nv4CvXolek6dYBZaaMioYbshKiTe/Ig== 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)(39860400002)(396003)(136003)(346002)(376002)(451199021)(186006)(82310400008)(1800799003)(46966006)(36840700001)(40470700004)(7696005)(6666004)(40460700003)(86362001)(36860700001)(26005)(1076003)(40480700001)(426003)(16526019)(336012)(36756003)(2616005)(83380400001)(47076005)(81166007)(356005)(5660300002)(41300700001)(8936002)(8676002)(4326008)(2906002)(70586007)(70206006)(316002)(82740400003)(478600001)(44832011)(54906003)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:45.8962 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e621c67a-83d3-44e3-f4cf-08db952e0355 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5038 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The constraints table should be resetting the `list` object after running through all of `info_obj` iterations. This adjusts whitespace as well as less code will now be included with each loop. Signed-off-by: Mario Limonciello --- v9->v10: * split from other patches --- drivers/acpi/x86/s2idle.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index ce62e61a9605e..b566b3aa09388 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -129,12 +129,12 @@ static void lpi_device_get_constraints_amd(void) struct lpi_constraints *list; acpi_status status; + list = &lpi_constraints_table[lpi_constraints_table_size]; + list->min_dstate = -EINVAL; + for (k = 0; k < info_obj->package.count; ++k) { union acpi_object *obj = &info_obj->package.elements[k]; - list = &lpi_constraints_table[lpi_constraints_table_size]; - list->min_dstate = -1; - switch (k) { case 0: dev_info.enabled = obj->integer.value; @@ -149,26 +149,25 @@ static void lpi_device_get_constraints_amd(void) dev_info.min_dstate = obj->integer.value; break; } + } - if (!dev_info.enabled || !dev_info.name || - !dev_info.min_dstate) - continue; + if (!dev_info.enabled || !dev_info.name || + !dev_info.min_dstate) + continue; - status = acpi_get_handle(NULL, dev_info.name, - &list->handle); - if (ACPI_FAILURE(status)) - continue; + status = acpi_get_handle(NULL, dev_info.name, &list->handle); + if (ACPI_FAILURE(status)) + continue; - acpi_handle_debug(lps0_device_handle, - "Name:%s\n", dev_info.name); + acpi_handle_debug(lps0_device_handle, + "Name:%s\n", dev_info.name); - list->min_dstate = dev_info.min_dstate; + list->min_dstate = dev_info.min_dstate; - if (list->min_dstate < 0) { - acpi_handle_debug(lps0_device_handle, - "Incomplete constraint defined\n"); - continue; - } + if (list->min_dstate < 0) { + acpi_handle_debug(lps0_device_handle, + "Incomplete constraint defined\n"); + continue; } lpi_constraints_table_size++; } From patchwork Fri Aug 4 21:01:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342335 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98B1BC04A6A for ; Fri, 4 Aug 2023 21:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbjHDVCN (ORCPT ); Fri, 4 Aug 2023 17:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjHDVBz (ORCPT ); Fri, 4 Aug 2023 17:01:55 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51EB54C3B; Fri, 4 Aug 2023 14:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNBU57HQLJKk6rxIrR0BLdwyJZHtxQ6PfoLrK5qyofNdOJG4k1AocX0W6r32JilOCHJdxR+O4UhOlOiKlo7JYhgsN/GiyNPTd/0YoAyW13Bn0PIg9K9p1wptlVCndroRylVWfGkWv88b2YeUNciHvEcOATP1jOCC0qerY1cTTMI9XjYqF+QQyVrYLw+1n+Mp7BoFQO8RAUi0TxP/jA8GtaC1VRaXhO5xUpHQ01Wrhrqq/gP2E3XN9zG9kmGbONLQye6f0PIGsZ3pqMecGfh8XPxOLDUOPO7BCq69q775rICW9gjy+GMckmTjUj5Fuc39grHcjDNRJMJwwCGMp54s3g== 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=Buh7vRqbmd7eHrsaIoJVA2qwwyxu27Pby6rpmQDTkbY=; b=mc65TaPZy4PYoqyrEHppEgFXGG5KClZn/szg+a3sDSdOmI+1MLaH/flj72bJIsFGmzEtAhI25k7FhvwclGdPppO2xBDXbafkY8H+Ilj3LXJYfkhfPMVTx+IE29ef7skTe+WkKqpZn8nqXSV+65xoqlEpXWuHokQEYhkv1+M3qg2dXGVST/zMvlA179KBcUDIf+Kc8oVD91HzLkPXYjlMgFfHw1G1uUOPA53yUZJiqHrw8Qu2nCbO/k8roDj+te4WVXvckpDoTSWHQh9afq+BTQ9YlPV/V3O15MsCwSbyomYb5qRgCCMCzZ7mBMpkRibIZtm6+eMl9fDaHMM3tIhJTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=Buh7vRqbmd7eHrsaIoJVA2qwwyxu27Pby6rpmQDTkbY=; b=3hiLZJmWvSNZy/g3PfHbAYSOFnyKx3fCvYZeQgmLpnaterpwMRA+4tDvq/dEKQlSpsfKm+9gDnHvUnhv4a0T5BhP3AbfbKDjUqTRRKM6pwcsEHmrFkSGRCNU2RXa155fFzI6eWeXGt6WBqkWbnKZ6Y1xaKBx9An2Ntl6yRTy4Bs= Received: from CY5PR14CA0021.namprd14.prod.outlook.com (2603:10b6:930:2::28) by MN0PR12MB6224.namprd12.prod.outlook.com (2603:10b6:208:3c0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:01:47 +0000 Received: from CY4PEPF0000EE36.namprd05.prod.outlook.com (2603:10b6:930:2:cafe::1e) by CY5PR14CA0021.outlook.office365.com (2603:10b6:930:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:46 +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 CY4PEPF0000EE36.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:46 +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.2507.27; Fri, 4 Aug 2023 16:01:45 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 4/7] ACPI: x86: s2idle: Add more debugging for AMD constraints parsing Date: Fri, 4 Aug 2023 16:01:26 -0500 Message-ID: <20230804210129.5356-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE36:EE_|MN0PR12MB6224:EE_ X-MS-Office365-Filtering-Correlation-Id: b43397cb-cb54-430b-cb6e-08db952e03e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZnbziZ3OBHj7t8uN5Vzy9qL1b3GrJRm3YM75W0ou7vlgEZM33lIUqqKql37rx6n0IFPFxtptLFNW1QmxbprKmzFC6A3PM8CtjKPqEp/NCoR1rPKoVYbujH9Q3qxlLHS7HP+rg7e70DKE0cPhIHJXaqHHCCvynIuw93kq8f43jAx3gn6HL+c3sehw29zriUrzE9uC/SmZTa0nWDG159wOqYhlMu9gWWgPc5Ak39mgReO1q7Yd20DdXG9w8ieyPwcCbgCLf/QCETtiZntKopHgZYFGb2vPC95Ws2LUv58hpLpV2KGOUHTrrn/KuvLkn9DXYwx6+TtG9M657bQETT6MWAnV7CstOKuvpJ5O/uBLLxrzSrSYX9lyYbtBpYtvJNUrMTUEdSapaEhcteqcah2wRhG5MBFSj2WJQQL1hFTAlDo4X5vCkV8X7l+YF7t2rSrdQeWzcqmnLhr74sKqw0XyVAkwcitmbw84gpGHzPmjmFt3AVfYRVLEK39Zt2AolzdDckoMrqs6zoBHjmyzqP39KYi19fY0ku5V3N4NVm+aDrceGzKkIwuCvDvW7q1LYWxUFLRGPVDc2EXEqNJ7Dd+Sue1R3ffTRwuzfVoGWH4/vPvfRDMrxvO7X34IUrK2yw28ENSHNz9kScAj5zP6MXJxtbaEmr8GkxiMTZBRIcfDahn7L6z5OJCVgfqXz/ldZrRig+JHpgnN0Is8D4C/uRjy0Xlav8zYjXwsl+4qUPmggkRMn3dF8aQjDCg9+3SE0cTGx1PGEl5evx5cQ2atytp6OA== 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)(346002)(39860400002)(136003)(376002)(396003)(451199021)(82310400008)(1800799003)(186006)(40470700004)(36840700001)(46966006)(40460700003)(16526019)(83380400001)(426003)(1076003)(2616005)(336012)(26005)(47076005)(8676002)(36860700001)(316002)(2906002)(70206006)(81166007)(5660300002)(70586007)(4326008)(41300700001)(8936002)(44832011)(6666004)(4744005)(7696005)(54906003)(478600001)(110136005)(40480700001)(356005)(36756003)(86362001)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:46.8807 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b43397cb-cb54-430b-cb6e-08db952e03e9 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: CY4PEPF0000EE36.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6224 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org While parsing the constraints show all the entries for the table to aid with debugging other problems later. Signed-off-by: Mario Limonciello --- v9->v10: * split from other patches --- drivers/acpi/x86/s2idle.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index b566b3aa09388..91cd6f8b8ade0 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -160,7 +160,11 @@ static void lpi_device_get_constraints_amd(void) continue; acpi_handle_debug(lps0_device_handle, - "Name:%s\n", dev_info.name); + "Name:%s, Enabled: %d, States: %d, MinDstate: %d\n", + dev_info.name, + dev_info.enabled, + dev_info.function_states, + dev_info.min_dstate); list->min_dstate = dev_info.min_dstate; From patchwork Fri Aug 4 21:01:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342336 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E603AC04FDF for ; Fri, 4 Aug 2023 21:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjHDVCO (ORCPT ); Fri, 4 Aug 2023 17:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjHDVBz (ORCPT ); Fri, 4 Aug 2023 17:01:55 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2082.outbound.protection.outlook.com [40.107.93.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A62064EC4; Fri, 4 Aug 2023 14:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YuOTxfnITYq+hLEBZH1KEyDoD7Yf0MFQXsyOKzZrPjRp1kz1YaebWzHQQEmKK+kWuAd/47bQzlozd6knFC/xLta+8IgS0LnoLIJZpZvCTIChOY0xuAwxE+wSoL6mW9gxppRvm+ZrKs1wBzSuPh60OarORv/l5/MoY8VYYFb+JIOn5pNWivp4jhYlOn3GTkek+iJOwsEGxxXlKDZCCz5thQhgTNMi7Azo3Vd+qtj4jYTSo+5JwmYuAAZylOLCdX58wU8QMTrh9IVTdDOnzEXxzFUo3e1cjpjEoIApr5cc5o0NHmF17k7Bbfg3jtThlJ82Iwpy2F8Ald7/XFcVUQecEw== 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=VdDivnYtujAWAa9il7+N1e2ydP3LuW8rnDj+y/wNgT4=; b=hFrd00VdaGc4jd2mCUxgEu79zeiJSU7AloI/N5Tg+rvgl/by+qxrF+OxavXh8cLItkMtCPaPYaZyook64ycmskAk65RtFKKZRCxOtbspZWXSK7q4DbvLLRL3GsVpfcbWDPLWhYIC9z1xS7IPhtmazgdMWAdDq+uHt0d5cq6R4rXDpBKoLNnkSKdAjUjkbM1RPa4hDURSo66iZuH+As2EsxN5UZWnFdbTuxE4L2HarvAb1WcBcDJGT5Uy4yJHZBtJfEiD2uL/949bPzGw839hMKvHdNF/MyuIWXAZgTKrZg8uM1MpznhlMHk0zMlXP7USqy8NwA24bDo58wxnhHj5Qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=VdDivnYtujAWAa9il7+N1e2ydP3LuW8rnDj+y/wNgT4=; b=N9zWzJv8F0TftbgfNq0YnoT27nkL0NHqY71ApbdgMcEx6h5J2pudc90VTCAONxc3k0W8RxJh0vltrxVsk3AA9+uUc6r0YuDrmj9IQn0zmVtD+NboPDZQiw00XunOBBtUWDBDTkjy38uayFrBl1SssCgGPVxekG6hFzi40xLZBQs= Received: from CY5PR14CA0024.namprd14.prod.outlook.com (2603:10b6:930:2::30) by MN2PR12MB4222.namprd12.prod.outlook.com (2603:10b6:208:19a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Fri, 4 Aug 2023 21:01:48 +0000 Received: from CY4PEPF0000EE36.namprd05.prod.outlook.com (2603:10b6:930:2:cafe::6e) by CY5PR14CA0024.outlook.office365.com (2603:10b6:930:2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:47 +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 CY4PEPF0000EE36.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:47 +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.2507.27; Fri, 4 Aug 2023 16:01:46 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 5/7] ACPI: x86: s2idle: Store if constraint is enabled Date: Fri, 4 Aug 2023 16:01:27 -0500 Message-ID: <20230804210129.5356-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE36:EE_|MN2PR12MB4222:EE_ X-MS-Office365-Filtering-Correlation-Id: 57143717-cb95-4c7f-140f-08db952e0474 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cqHnr5bdLXLmD6O9bA3nD8kISjuvz+kWhVtMwf1Do6Wp8MM+lloJ+/0Ywu1HFCPjHH0jCFGQuMpreX6GUYYp8FtD6xbOiUtrWkjDyK9ZeH30WjjJJAP5/l6KKnrCxIgwh2bu0doDP83uvslxdRlxZcPOaun1ryJbTdgkwpyRbjtzcFnRRYFXTkRjFbTWynPurmouXopwT/a7Zscy8QSCi4WZYkDmWRE6w6WZMoeyDtuHNBwu1TQhoa6irCiA87wsBrJOFKbTqiv4t9ybLM6h/4RpBSNRJlXJ/hqsMaqNAlUhtKaGmaBwPiBHW4+OO8fVMjeKjbHmr/DB8lyE1i40cyUQmmD2/Ik8Qdev9auDtbvPlqVkYTehhIg0rzuXv3CHrDKJtlvhk39Q/WAvnK4yBVHSlorjT2+vKFBPEMGnacgL8lNqF23/HKvN/CHmx+9DVfR6CuUrtpP6tJeQRymdWlB4XKv2eD8T59H7OW7MYL0GQZ3TPyviZUtsf368Biij8wsutNw7l8gNTmhWGcM9Q1/jqwnhJ5PYGAg2Am+J9HBcLc9tjshtdsZH8rlddzRe2fyEQbaxdczUwzFP3KhFesOsbymKqOyvAWTS8wDgJquoNY2fwGoXq+Hai0xO2QqxDS99GMQyiyTWcqYqzYPWhqhbWz1WtMwG3D731JguO8uz9SwuthBajGcS0WTcWOB4MYzs3cSivR2hON5Fz7zF5kOQssUwOonSJtBa4mOOiUHam+06F0YUmakKjlbZUYA7iIjJ51e0fg2zmtePLMvVSg== 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)(396003)(39860400002)(346002)(376002)(82310400008)(451199021)(1800799003)(186006)(36840700001)(46966006)(40470700004)(83380400001)(2616005)(426003)(47076005)(36860700001)(40480700001)(41300700001)(70586007)(316002)(70206006)(4326008)(7696005)(44832011)(26005)(1076003)(8936002)(5660300002)(8676002)(6666004)(86362001)(478600001)(54906003)(110136005)(40460700003)(81166007)(356005)(82740400003)(36756003)(16526019)(336012)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:47.7713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57143717-cb95-4c7f-140f-08db952e0474 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: CY4PEPF0000EE36.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4222 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Constraints are currently only stored when enabled. To enable the ability to check if constraints are present they need to be stored even if disabled. Signed-off-by: Mario Limonciello --- v9->v10: * split from other patches --- drivers/acpi/x86/s2idle.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 91cd6f8b8ade0..0c8101acc92ef 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -78,6 +78,7 @@ struct lpi_device_constraint { struct lpi_constraints { acpi_handle handle; int min_dstate; + bool enabled; }; /* AMD Constraint package structure */ @@ -151,8 +152,7 @@ static void lpi_device_get_constraints_amd(void) } } - if (!dev_info.enabled || !dev_info.name || - !dev_info.min_dstate) + if (!dev_info.name) continue; status = acpi_get_handle(NULL, dev_info.name, &list->handle); @@ -173,6 +173,7 @@ static void lpi_device_get_constraints_amd(void) "Incomplete constraint defined\n"); continue; } + list->enabled = dev_info.enabled; lpi_constraints_table_size++; } } @@ -235,7 +236,7 @@ static void lpi_device_get_constraints(void) } } - if (!info.enabled || !info.package || !info.name) + if (!info.package || !info.name) continue; constraint = &lpi_constraints_table[lpi_constraints_table_size]; @@ -247,7 +248,7 @@ static void lpi_device_get_constraints(void) acpi_handle_debug(lps0_device_handle, "index:%d Name:%s\n", i, info.name); - constraint->min_dstate = -1; + constraint->min_dstate = -EINVAL; for (j = 0; j < package_count; ++j) { union acpi_object *info_obj = &info.package[j]; @@ -284,7 +285,7 @@ static void lpi_device_get_constraints(void) "Incomplete constraint defined\n"); continue; } - + constraint->enabled = info.enabled; lpi_constraints_table_size++; } From patchwork Fri Aug 4 21:01:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342337 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 865F1C001DE for ; Fri, 4 Aug 2023 21:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbjHDVCV (ORCPT ); Fri, 4 Aug 2023 17:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbjHDVCM (ORCPT ); Fri, 4 Aug 2023 17:02:12 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9C24C3D; Fri, 4 Aug 2023 14:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LMbtIAQxzS/uNwprGW+9T1qr492UcSpMNP/KXJGNyNwXu7rFP+4FrVI2HI3qaXenPVHUQESksxptD4GYkP2nL83tjzTUQk/Pah/czc4A2eAEkh9FbglW9X4Z83USf7bMdRGtjfhgIPfg9Bynw5d7o/OIm0/9Z+boGEs0zB33+xcYdBvP9NomvmXXgppXtuRV5UyPnJybWjddANYkxzZp2lfH0D1RMhVTG1KsMJqMs4kVh6M0MMhiPFbhjFnj6+vA2Rk1/lOwJajJr5ORg/kG1CubO5wbYoq+vxoGrUxj/PCZV5Nhr3cS/azFRkQrEjVTGpPqf1zU+xkFO51ebOXpfQ== 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=WKNaYVBFM4Xk1GipR8RNik/wQAL5VS75hCyaNge9iE4=; b=hm/BOdYugYxwHSlQ1ZEW3M710pO9ixqin1ug+H38+ZANCJ7JLEtbyr5qhS8NSdu5TEhjg/tFWdLLrScoxRkQ4UWXUQaHlcqcEvsOWko1hsOPlRPKWjw4ycKS8EHCTWdc+BM7SNmLSjeWO8gnmQP27QNRqNxS2F+e2Qkp0fY1eh4l+YRc1MAsCZNPI6amEOk7WDanwqGwLFkFR++YqVMnfVmEDLJeByFfw4DsOJ22oT4+6XCxeM8/sONlJE07E0dM8X4GjbWA5vzJt5E64SUN0Hse4X8S+sn9f9EqAr8srZXNpxkxitOVBiN5ZRSCRDftVDAnjRu3s8xmWMsDwmmasw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=WKNaYVBFM4Xk1GipR8RNik/wQAL5VS75hCyaNge9iE4=; b=B3zKHur+xjYN8ukBf7XcB8f9YghoG92N9c613CilGbptWUaiOq6u7E42ny+P6+7Ag0MOSP3J1Xjlkvrz4AUpogmERrP0eMctO5UPZPdrslPO0Ev4PcSC2s/QowNzSvZL/VdEmX0lOxtmBnQIV5pAuujfmJYYAV4CNd6nneCUVfQ= Received: from CY5PR14CA0019.namprd14.prod.outlook.com (2603:10b6:930:2::26) by DM4PR12MB6086.namprd12.prod.outlook.com (2603:10b6:8:b2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.20; Fri, 4 Aug 2023 21:01:49 +0000 Received: from CY4PEPF0000EE36.namprd05.prod.outlook.com (2603:10b6:930:2:cafe::d) by CY5PR14CA0019.outlook.office365.com (2603:10b6:930:2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:49 +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 CY4PEPF0000EE36.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:48 +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.2507.27; Fri, 4 Aug 2023 16:01:47 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 6/7] ACPI: x86: s2idle: Add a function to get constraints for a device Date: Fri, 4 Aug 2023 16:01:28 -0500 Message-ID: <20230804210129.5356-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE36:EE_|DM4PR12MB6086:EE_ X-MS-Office365-Filtering-Correlation-Id: b865b85d-1fb7-4dc5-bdca-08db952e051f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dO+Y0MWuABpwG7fwRFh4UPEdIMjkHgMipARy16HLjS2a5wzdqKY/HKUeD6NMHGj3cRoP70PkB6QWh4/7KkiU9OiST1XZNKFLDEii3/99YZ9NRBQDXxRHaJuV6j3EmC/WIEU+3voCOFldeCEn30CVHHLnsFtJaLlsWXelIG5AYnH8pKztEtaaMfpEPvPWFIWVVh3cZtpTlt8EHZ1iKAFaw2BKD1pUzJhYsH9hTuqg9WtUmKPvc5Wmqh89sTcfCdFF/nQk76cHXKs+BbmdaQ9BHiMQXc+T66H22Go1LQsPJ3FRRKSHAz/E9Zl/EyoG4uJKfXPlg4susK/kjYNR6TzLifyrhTqMZydP3i6c/4bxw1M31rJnCFsNIByVvHCyY24EwRBkKj85W0r6o7zlJVAaJBKT+WERyLr9OdYrEs0qMAdi4C3rH+wp1KuRVInOSEF2LzapMjSRXzCR3jy4FbppFnCxpuqdty3uJu/4BfBbzoTzpMWZgZzMZ+ss0j9Qla1hy7lHGIyatBCx7FGwh2HVGu/3BApnei3ErPyksak9a8255VKMeWUWkfqqVsyHNPzIFggRwKrNPZ/DKyQxlZw4hbQyPKSbOeGmE/t6VIABEpo/KDyw2tn3v4XUewf9NBZNH5D8EZgqssQG2F99exUdqIVWrfGa+RzKt4s8n22HHGzEKY3QsnMRYTY/6mdwecfu2vgM809HxLRGR86FyeHLrh7fkgjJsXPVoGmjKS34Mx0cDi3k69/c+QBhtpHpbAcPMBPj1kUizjKTi9EnojE8vQ== 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)(346002)(396003)(376002)(39860400002)(136003)(82310400008)(451199021)(1800799003)(186006)(46966006)(40470700004)(36840700001)(336012)(16526019)(40460700003)(41300700001)(6666004)(81166007)(82740400003)(356005)(7696005)(478600001)(36860700001)(26005)(426003)(2616005)(47076005)(83380400001)(316002)(40480700001)(2906002)(86362001)(54906003)(110136005)(36756003)(70586007)(4326008)(70206006)(1076003)(8676002)(8936002)(5660300002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:48.8963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b865b85d-1fb7-4dc5-bdca-08db952e051f 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: CY4PEPF0000EE36.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6086 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Other parts of the kernel may use constraints information to make decisions on what power state to put a device into. Signed-off-by: Mario Limonciello --- v9->v10: * split from other patches * kerneldoc fixes * move debug statement to this function --- drivers/acpi/x86/s2idle.c | 29 +++++++++++++++++++++++++++++ include/linux/acpi.h | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 0c8101acc92ef..2a1a482f4803a 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -295,6 +295,35 @@ static void lpi_device_get_constraints(void) ACPI_FREE(out_obj); } +/** + * acpi_get_lps0_constraint - get any LPS0 constraint for a device + * @dev: device to get constraints for + * + * Returns: + * - If the constraint is enabled, the value for constraint. + * - If the constraint is disabled, 0. + * - Otherwise, -ENODEV. + */ +int acpi_get_lps0_constraint(struct device *dev) +{ + int i; + + for (i = 0; i < lpi_constraints_table_size; ++i) { + static struct lpi_constraints *entry; + int val; + + entry = &lpi_constraints_table[i]; + if (!device_match_acpi_handle(dev, entry->handle)) + continue; + val = entry->enabled ? entry->min_dstate : 0; + acpi_handle_debug(entry->handle, + "ACPI device constraint: %d\n", val); + return val; + } + + return -ENODEV; +} + static void lpi_check_constraints(void) { int i; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 13a0fca3539f0..99458502a7510 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1109,6 +1109,12 @@ struct acpi_s2idle_dev_ops { }; int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg); void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg); +int acpi_get_lps0_constraint(struct device *dev); +#else /* CONFIG_ACPI_SLEEP && CONFIG_X86 */ +static inline int acpi_get_lps0_constraint(struct device *dev) +{ + return -ENODEV; +} #endif /* CONFIG_ACPI_SLEEP && CONFIG_X86 */ #ifndef CONFIG_IA64 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); From patchwork Fri Aug 4 21:01:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13342338 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67ADDC41513 for ; Fri, 4 Aug 2023 21:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjHDVCi (ORCPT ); Fri, 4 Aug 2023 17:02:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbjHDVCM (ORCPT ); Fri, 4 Aug 2023 17:02:12 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABBE94ECF; Fri, 4 Aug 2023 14:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J0dbideA9pr1+wlfb8IXzss3QfEfnSpTUKIrfcK5BfELVmv6MGNSBt1pxbAS5GcSYooKm7rxKpTrcTcYG0VhLwivXtqqjNxh5xCvxFUqEWwt0OUZ5wa+quPN8Z466O7cxIm0IWxa4Dc0B215XR7I4Xsdyy3h72IACKuhtiPq6X1w3S/zsctG5gyC/39UtJkSgSH5RIWCTwp8r4OUvM7Oc+va9EatMdx7JLty1/GjxquZXGgUU5QZN+2E4Skb+QAuJHrJWxyav5/7SIud2P1Ep948IGn5+FARoMzGmVWyBDchLN28dM8Dsc8NAt5ca+09iECYOUmyUueXv6cWDiZzGg== 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=VVzSB8XhG7EkculefJ5zANMspQtK8AhiENAPpnu4IMs=; b=c8Itve3125iFjcYqnEtS/V5VNOzfpsWdEVIGV4iLfWkIyJbSV4ahXP5LToeajpYSHsN3x1T+qnqBSpO5fVSBnGzkR1tmy5KieRX7HyqLoJ1oZguzjCS/z1olLb2+Dd2IBf900finbCUZHvqSrhOkzgvNuz8+jYdnHUcn2QILvLXnRHtGTY26mBYouI3J5qkyoQjcg2t5R/wkUh3r3mIbEyGKq8/uqXl8yQ6BmDWiY2uWOt0W/k4yTVICcQtId5qYGKtyBounlMoWPYuTAPFeMmzBPGbBpidzIObBJGSr1tzM9Sm/uOy7cIAFgEku6qTLhZuc7P3PDojtlLYhzueo6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=VVzSB8XhG7EkculefJ5zANMspQtK8AhiENAPpnu4IMs=; b=GEZEizw5IjfxUW5cb5SK4uVPCHMlKi5U0Bc2HEOAYb0Hl+TBTz1d1ZH+1xk5a29cvTqhdX/NkQGbboeBuCaabTpRqzaljFaVuEENgqMRm1CHC11OVBOAuMBHR+5M3QCoCRhc3kvd3/uyKv/bptWhvxo7Ap/hTtR5KFrnU+mvgRc= Received: from DM6PR06CA0083.namprd06.prod.outlook.com (2603:10b6:5:336::16) by MN0PR12MB6127.namprd12.prod.outlook.com (2603:10b6:208:3c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Fri, 4 Aug 2023 21:01:50 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:5:336:cafe::8d) by DM6PR06CA0083.outlook.office365.com (2603:10b6:5:336::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Fri, 4 Aug 2023 21:01:50 +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 CY4PEPF0000EE33.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Fri, 4 Aug 2023 21:01:49 +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.2507.27; Fri, 4 Aug 2023 16:01:48 -0500 From: Mario Limonciello To: "Rafael J . Wysocki" , Mika Westerberg , Bjorn Helgaas CC: , , "Andy Shevchenko" , , Kuppuswamy Sathyanarayanan , "Iain Lane" , Shyam-sundar S-k , Mario Limonciello Subject: [PATCH v10 7/7] PCI: Use device constraints to decide PCI target state fallback policy Date: Fri, 4 Aug 2023 16:01:29 -0500 Message-ID: <20230804210129.5356-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804210129.5356-1-mario.limonciello@amd.com> References: <20230804210129.5356-1-mario.limonciello@amd.com> MIME-Version: 1.0 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: CY4PEPF0000EE33:EE_|MN0PR12MB6127:EE_ X-MS-Office365-Filtering-Correlation-Id: be9ce5ce-d491-4873-8e3e-08db952e05b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Q8yLEn4KTH2hgcJUhWl+OFhNZ1OoClzypJnSk+GlVP2JYmWIkov8r7l0FcGX3h7KqG00+mO6H7mLq58q80efBWrIoASgqXW4H+bT72crYgW9vGg7JTmodn0oJ/A+8xeq4oZ9mV1U4km8i1EDOBebRVpduZe+jK2mXALcaWryWvcS9/OctzMbpGbO9S4srNAaB3eZmaWNGy9RA4JZNqo1vK8uUe6BBuXA+LMZye18MC/KkzHCWV5pH5AP23fj89VbILrEEzB5cD3PpeT3W9JDRTqwp1Hs+P0il7ru64WeUmjRu9CTGzzaAdP9UkDYyGrWdkAmCcXDOxodBC0TevqgU+P6QgZETwLJSaT0WF8507bktkK8h9XKUTkcI6dHpEF9rYxk1hwxiilD9651DPi5up2fcpWWqjaheLfaVjE+vr/iUrg13+2qUJkhGr6yorbMldEcPZ/3EBOB/J7wygYqE+GOuW+TiuJ2/wORVBuTQuhid19C0E/ypK2TZMqwGlxc3sQt4s4ttYAwhEZlboeMJbUnTd2pROh1JoUR4L4TMwuQVEttr3VCa/QuyRVHMMS4srDQnw5RsBSSNugV6wzJErYV5qOf49kw7jkTnWd4mvIee4L9BroDzTBnekamQlimZVXmhjnzUBGaAMHKO6JRde1chnkuRA9KaR80ZFxKbYSKKgk2XGtfcenslECHyZ+q22pmkxz+ty2WjuyPp3yk6QOTOwZhNBfR3xTMXbSeFgz0FnRRFKMGrzG2lWdzlLPyO8ODloOOVbPV/wC6fP4SW49A3DqXeXeayQVU6v/t70= 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)(376002)(346002)(396003)(39860400002)(136003)(451199021)(82310400008)(1800799003)(186006)(36840700001)(40470700004)(46966006)(83380400001)(40460700003)(16526019)(2616005)(1076003)(26005)(8676002)(47076005)(4326008)(2906002)(36860700001)(316002)(426003)(70586007)(81166007)(5660300002)(70206006)(40480700001)(44832011)(8936002)(41300700001)(6666004)(966005)(7696005)(110136005)(478600001)(54906003)(356005)(36756003)(86362001)(336012)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2023 21:01:49.8716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be9ce5ce-d491-4873-8e3e-08db952e05b4 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: CY4PEPF0000EE33.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6127 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Since commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") PCIe ports from modern machines (>=2015) are allowed to be put into D3 by storing a value to the `bridge_d3` variable in the `struct pci_dev` structure. pci_power_manageable() uses this variable to indicate a PCIe port can enter D3. pci_pm_suspend_noirq() uses the return from pci_power_manageable() to decide whether to try to put a device into its target state for a sleep cycle via pci_prepare_to_sleep(). For devices that support D3, the target state is selected by this policy: 1. If platform_pci_power_manageable(): Use platform_pci_choose_state() 2. If the device is armed for wakeup: Select the deepest D-state that supports a PME. 3. Else: Use D3hot. Devices are considered power manageable by the platform when they have one or more objects described in the table in section 7.3 of the ACPI 6.5 specification. When devices are not considered power manageable; specs are ambiguous as to what should happen. In this situation Windows 11 leaves PCIe ports in D0 while Linux puts them into D3 due to the above mentioned commit. In Windows systems that support Modern Standby specify hardware pre-conditions for the SoC to achieve the lowest power state by device constraints in a SOC specific "Power Engine Plugin" (PEP) [2] [3]. They can be marked as disabled or enabled and when enabled can specify the minimum power state required for an ACPI device. When it is ambiguous what should happen, adjust the logic for pci_target_state() to check whether a device constraint is present and enabled. * If power manageable by ACPI use this to get to select target state * If a device constraint is present but disabled then choose D0 * If a device constraint is present and enabled then use it * If a device constraint is not present, then continue to existing logic (if marked for wakeup use deepest state that PME works) * If not marked for wakeup choose D3hot Link: https://uefi.org/specs/ACPI/6.5/07_Power_and_Performance_Mgmt.html#device-power-management-objects [1] Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/platform-design-for-modern-standby#low-power-core-silicon-cpu-soc-dram [2] Link: https://uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf [3] 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 --- v9->v10: * kerneldoc fixes * split into more patches * adjust return variable handling * Adjust call-site to avoid problems for devices already in d3cold --- drivers/pci/pci.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 60230da957e0c..108eacc4f8dd9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1082,6 +1082,14 @@ static inline bool platform_pci_bridge_d3(struct pci_dev *dev) return acpi_pci_bridge_d3(dev); } +static inline int platform_get_constraint(struct pci_dev *dev) +{ + if (pci_use_mid_pm()) + return -ENODEV; + + return acpi_get_lps0_constraint(&dev->dev); +} + /** * pci_update_current_state - Read power state of given device and cache it * @dev: PCI device to handle. @@ -2660,6 +2668,20 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable) } EXPORT_SYMBOL(pci_wake_from_d3); +/* + * Find the deepest state from which the device can generate + * PME#. + */ +static pci_power_t pci_get_wake_pme_state(struct pci_dev *dev) +{ + pci_power_t state = PCI_D3hot; + + while (state && !(dev->pme_support & (1 << state))) + state--; + + return state; +} + /** * pci_target_state - find an appropriate low power state for a given PCI dev * @dev: PCI device @@ -2671,6 +2693,8 @@ EXPORT_SYMBOL(pci_wake_from_d3); */ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup) { + pci_power_t constraint; + if (platform_pci_power_manageable(dev)) { /* * Call the platform to find the target state for the device. @@ -2701,23 +2725,20 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup) else if (!dev->pm_cap) return PCI_D0; - if (wakeup && dev->pme_support) { - pci_power_t state = PCI_D3hot; + /* if platform indicates preferred state device constraint, use it */ + constraint = platform_get_constraint(dev); + if (constraint < 0) + constraint = PCI_D3hot; - /* - * Find the deepest state from which the device can generate - * PME#. - */ - while (state && !(dev->pme_support & (1 << state))) - state--; + if (wakeup && dev->pme_support) { + pci_power_t pme_state = pci_get_wake_pme_state(dev); - if (state) - return state; - else if (dev->pme_support & 1) - return PCI_D0; + /* pick the lesser of any specified constraints */ + if (pme_state < constraint) + constraint = pme_state; } - return PCI_D3hot; + return constraint; } /**