From patchwork Wed Aug 16 20:41:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714406 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 EBAAAC27C52 for ; Wed, 16 Aug 2023 22:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346768AbjHPWKw (ORCPT ); Wed, 16 Aug 2023 18:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346783AbjHPWKo (ORCPT ); Wed, 16 Aug 2023 18:10:44 -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 07BE42705; Wed, 16 Aug 2023 15:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GlsAmYOZ8ZyXxllrDSb0W5NkRdVmqkd0KYPgO7P1GrodcEB3qXscEeqQ+W/VVcmZKG94Cz9HCzC+sAOodwzqdkoHEjhTLaG1ErJlqhntajEPG31aoy259JrnARvikabtDcSE7oc7aqCnHOtXXAdvp9MYFjIIIOxVccTAhDVM8UkFIBqSppmwdQ78XShKPiQf5g+61dEg2HneaPdDfsJ/xDPdifm4hIVMfYPtyQQxUvCCTvk3rbh0/ZD2DSRDX2FKRTnUL3aIk2vdJaZ65TqvigpmNEU9W/Yq53iguHgPlbO6y98ls/LvCC/b4ThW/GNuwClR+rs55tVj7g8fJ3hYvg== 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=gojrmQe0oMSxo8fKEOfFyeY57kRMGKmdGy2narGpftpQEp/jB8xEx47npgMkkK2aYfP45PGjs0eUk6b5PbIozjQ+gbSKobMavMno5ZMseVYGph6TwGf2ESOAILSyImzTwvSCAJlSFz9F1YbSo+lDh7bCTnXM9grX4ty9AUziW2X+tiq3mhUCFN3JMPW5+bpY0hgcHdOwmWzvWNMEsbUbxeU3a+gtofalbhLp/h+lATGBsa/lQmwNQRzEtarDq32SsMLChPIVkinHFj9EJaHM60C7IKqC2slX7PiSfmfavFB+c8rnTyTfagL5celcR4L70i0xVKZ6gvXayHbsmyPMuw== 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=DN0z+qgT1P285eeiVk6rUprXUDSGrpj7+hSGg/nZYH6aeIV1tpEt9YtHIT5xdUcxIaYEKxRggDk+e8mV4anwgDN1QOQipPmE2E56qQDOPTAoI3aompxGle9CflXcK+DVrHjbtjaIW89GHTirsgGqZMgqBrQHc0eTie7kpIvazNg= Received: from CY5PR15CA0212.namprd15.prod.outlook.com (2603:10b6:930:88::12) by MN2PR12MB4189.namprd12.prod.outlook.com (2603:10b6:208:1d8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.30; Wed, 16 Aug 2023 22:10:40 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::61) by CY5PR15CA0212.outlook.office365.com (2603:10b6:930:88::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10:39 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10:39 +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; Wed, 16 Aug 2023 17:10:38 -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 v12 1/9] ACPI: Add comments to clarify some #ifdef statements Date: Wed, 16 Aug 2023 15:41:35 -0500 Message-ID: <20230816204143.66281-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|MN2PR12MB4189:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f8bbc7b-98ad-4d55-724b-08db9ea5a04b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d7yaY2sI7RuXY9dJv5kL3XEX4ypJwEalu26cbouMHFIzEtc+xa8OcKAQmo53IAIlnYIRwllkKRWWG9n5DkGOx2tacpxvay6C+W4Gty3FNJ3XRDq+ZUyhqrX17tGmlifXBAq97cN6LZRp7/sicVJnC5DrQNOc+SBphhfPNQ7YRKx/Ap4IYjvHK2NvF9j0/P3vQAMYYcQLqrkPne/SAID/jLmyI+V6TG28V4fSwgt4rFvYgWDVbkYxkCn5vy8cnIKSoPOJKfPomp43ZRVHC9mvmWkZtKrfjl5P526qio2wzYDe9F6ry+YsFbYSax5g0t+t9o6YyLA1GozoiJAlQ/ul6TLWysqyihYPnCJx6NrHnNrdzysB96wvus+BcEKXbRf1eHWZrAVEqyt52/AaJvBjoO29uom4RROPxykMwg1JQHrTfm9/rE5oCtkEn3UChbRsPxRmCPCx0Zh3O/ST8u8yD4wrefzALQZ0HhkwSX61DqfFZFKVejaBQYIcAhQs9JvFseUJECyTqH0MyGZCUGOJQtROy1UIsvd43HHaIXB7Qq7VlYsgbElejeX94zk4Y7lXecKmnpNhFKNqQ49PpU+ADKQYrLqlkoo1szP//t2v837FncN++JDoqCgSq0EXxVysFHxCCHSWh+/bJcS44cJVlN2wsO/PQSOipvAX4o39Pp8g3+/93qohiz58V7trmzDn9F8aRlhxv/IVvDdYS7tfcJi3zpDlcdgt9j7FnuBK1zcEptN4Xu2l0yHT+/ZHepBNKYZzchTIYxqIGkumI9mOKg== 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:(13230031)(4636009)(136003)(346002)(396003)(39860400002)(376002)(1800799009)(82310400011)(186009)(451199024)(46966006)(40470700004)(36840700001)(336012)(2906002)(4744005)(1076003)(2616005)(26005)(16526019)(86362001)(426003)(36860700001)(36756003)(6666004)(7696005)(356005)(81166007)(82740400003)(40460700003)(47076005)(83380400001)(478600001)(40480700001)(70206006)(54906003)(70586007)(110136005)(8676002)(44832011)(316002)(8936002)(4326008)(41300700001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:39.8054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8bbc7b-98ad-4d55-724b-08db9ea5a04b 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: MN2PR12MB4189 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 Wed Aug 16 20:41:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714111 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 5DAF6C27C41 for ; Wed, 16 Aug 2023 22:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346788AbjHPWKy (ORCPT ); Wed, 16 Aug 2023 18:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346781AbjHPWKn (ORCPT ); Wed, 16 Aug 2023 18:10:43 -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 6E20C26AD; Wed, 16 Aug 2023 15:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XM591bejp9/kl31M06PQGsOQJBKjfg2O8o2T66jloHa9KBjdRj5M+kYxuf9NWISmp17oFW2CfZDIaCEDvxHJ2sqHuBQq6S1+BEx+f0Bh3edvMWOOctshEkr+HvZvmMF58JJJ4oce0VSljqOOLi1KNgqNqFsD8T+yHQZefmYzdQA16x4xWUPgHuDuBP8yzFxE5nPx5i/gBMvpE2qVrPSelRg8o8M38is1jY8lSLuN6rcPmoQJe6V6gsFfhttC/GdeB8uz3uUFdSK1QJosjl8diHXMa5J47K1Sse57rJHeDIKbuety8RTXWM2V4r2zJt+0cWYP1/LzI5+x9L/V5ceueQ== 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=pw+XV7GtgEUwRkSV6AQqTr6LaCctBOfdlfpI+jarcDg=; b=RHz11aqmsul2jupRWir72fZQe47RVleQkR5IrXh9tWwS8O4tuSyrHySWqYRIqv+9w69uH8q5uhGSePtniMXYOSy2xalh/G6CMYhvvb+VrVznAho6AaeWsMMDNX5Ef5qdEYxGGaJv4was8SbAu9yladMJiUEtw/Ralk0n5VLj4rNt8C8oYe2OOs4pMH2Sb3znFJm8cUZsnybzu6LMFeGwJwMqe7pNElwfo/Skk0+ET4wGaqNgedpty/p7mfQAS8nBOCw1Urn2Ap9TC4HOuOlOaVV3md6FsnrPJTXiQgHuYr8xiSMToxW8YdxGc/WSQv2XdUnjdIXk7drUUkBuWHU8Ng== 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=pw+XV7GtgEUwRkSV6AQqTr6LaCctBOfdlfpI+jarcDg=; b=O7MfdqLjLm1aSZQOSPwl6ZTG8W4H+Pj7j4oDt/jMmLv89nxeJcluAFoWod7o9sHF3RPJ23b7Zxn82Oyxm7YTz2PTEcJ1aPE0ItcRHSRZnbE6eQMuemyI3MVFEcXuQarhR07MKRRlZevIirontJhKbWXRHHBF/SUv0ZL3wTT13D4= Received: from CY5PR15CA0225.namprd15.prod.outlook.com (2603:10b6:930:88::26) by DM4PR12MB6327.namprd12.prod.outlook.com (2603:10b6:8:a2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 22:10:40 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::76) by CY5PR15CA0225.outlook.office365.com (2603:10b6:930:88::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Wed, 16 Aug 2023 22:10:40 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10:40 +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; Wed, 16 Aug 2023 17:10:39 -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 v12 2/9] ACPI: Adjust #ifdef for *_lps0_dev use Date: Wed, 16 Aug 2023 15:41:36 -0500 Message-ID: <20230816204143.66281-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|DM4PR12MB6327:EE_ X-MS-Office365-Filtering-Correlation-Id: 94fe3edd-7507-41cd-5b35-08db9ea5a095 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y0nQ210cAhXz5cHQ7ci+RtuSJQSBVimsLtORQckDKTBkSqUWVyq9p0W9Bj31H/EeSBN6GTDdK7bII1jEID9muY+zYtTJuGmBgqYjSu8HSw/HU6CH6vB9lIG8DriZhHRUuJfDAYsoN+89f7Ao8euYlmJYIfVwcncm4csGffg+tK7pY5k9y6m/RV+ikeai8OAORySm7Djr7N6X1DYQV/z5uLecDNVNe/Jjl9GWf7jsV7MThUIfQpQ1otndzX2A3ZzXuKBsGxSQUi9TiraZgMOIhTcYOiu+XE3tzV/Xhso54Qg52qCHThEpqvv4Z42gryodZWgdkpbuCOcBKfr1rnwAfRwEjcgRLHTjEjnpg9KeSUq6A6hEHAlZSRprm4RbuCUzSRR2u2y74VGbU8wfK29PjG6Y6fFdWS48uB8YMLbAnAn56pPfjOmndwmkV4wWwbX3MSK9kzrTdTZjNPpeAFgXFuQlNuU6L3gHeI8FXyLcQ+o3xYRGX/1MyM9aB3zjEABIn7aFyDTG6ga8f3gwp0OQ4evjuKJvZJmbuzRrumsbA8QXeAO3a9AWhlZ9W+fIkvcpJHPlbVf3xD9lJwQHyhh8wMeJMFlOv6AIw3Wn209oA4yJNPH2pqThGxEDC2SSCHce3pYJwzQ7nbX33ALMeh2Wbn38fQHZ4+00IeiOn8bbmFg4Od3zOuZyR8VczMWw+BxXadMuh4/yNY5kMULJ1NX99lEq5jEt7qGuhQJ/DOeahqVKfjGj62a+Bxje0tTmyfPFjg4uwBTBvjjOfnxp4RRM1w== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(6666004)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:40.2898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94fe3edd-7507-41cd-5b35-08db9ea5a095 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: DM4PR12MB6327 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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_SUSPEND. Signed-off-by: Mario Limonciello --- v11->v12: * change to CONFIG_SUSPEND 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..f1552c04a2856 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_SUSPEND) && 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_SUSPEND && CONFIG_X86 */ #ifndef CONFIG_IA64 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); #else From patchwork Wed Aug 16 20:41:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714109 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 3C6C8C27C65 for ; Wed, 16 Aug 2023 22:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346794AbjHPWKy (ORCPT ); Wed, 16 Aug 2023 18:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346785AbjHPWKp (ORCPT ); Wed, 16 Aug 2023 18:10:45 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2053.outbound.protection.outlook.com [40.107.101.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1322126AD; Wed, 16 Aug 2023 15:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBhLcYZceIVbdxwZRhlOrIs1ewazCLqrTqOLm7y63KKa+1tV9/JJ4OK5id1Hxccbn0LL+vWBDt+PQuEY4mmxRZEL7IZA70+FjyQHWYq2dx9N259vqVnqhlPav2sFYGVdvyWsaNsb6YP4H2lVOBmhxs7wg1NAYTq/MEmENbhunlwAwOVUIsCBZowGihQxp7uO1t24MaCLx5hc9i0HQEc5yIZj44kS1JCN8RcwPZWSj/rW+PDGmSLhyvLjC9dNs6nQfCsSrIB1+QhJEbIOwEkIeD1rMDR7CHXsWjn3hnUdsspS6EcPLcMlSL02jzOxHAlg4G9UilQYfmMZvtsqFcTmpQ== 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=PsIjzWM4UwG08vvkQ8Of6qGSYx+/t2ioEsg9zc6Ur4s=; b=Xd2RvCdpRByl+qIwhXBjhAhKq9IvywuqGK0dsBLR2oHNJaVmPnAcaIVtb5a4HDFyfTFBCq3k6x3Q0Nzu1ZA4H+kPeSxMONxgdhLCiR33ML0WRdQsKx/nBJ5myi6+QGgfyjA/zWhPtsyWW1kCr7th7741dx4UjW2cyR/YFBGpdsoXGHQGizerNamBOrrnAeZ2xF9PhagDuAGaVTVPAu70nyekSGhMFJMoB68D7s45T4ccoiZng0+l88uRoGQcDAPVx5clMxiM+EVv0WC79VeCsQEfhZ3+eFjAQ4/sQcoH5KjsQwNTxCVS8upsU3m24UZpKQ1/YoiMOOlRwP4eT2k58Q== 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=PsIjzWM4UwG08vvkQ8Of6qGSYx+/t2ioEsg9zc6Ur4s=; b=F3OxNiqUwvuWGACCWU2USmFyVRJvtB4YeoV0HaBAsNEgnqobtAadjc/yd9BEZ1buRbol8kW3kQR8eHOom214A8TR6rwQ8FWOxUKrpt5K6fOtDn+CsOtsq/QPRfm8glhk66tzcuP928W5FYvo812DCGrdusEjNB/vXGT2i2i3Qyk= Received: from CY5PR15CA0223.namprd15.prod.outlook.com (2603:10b6:930:88::9) by LV8PR12MB9335.namprd12.prod.outlook.com (2603:10b6:408:1fc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 22:10:41 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::db) by CY5PR15CA0223.outlook.office365.com (2603:10b6:930:88::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10:41 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10:41 +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; Wed, 16 Aug 2023 17:10:39 -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 v12 3/9] ACPI: x86: s2idle: Post-increment variables when getting constraints Date: Wed, 16 Aug 2023 15:41:37 -0500 Message-ID: <20230816204143.66281-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|LV8PR12MB9335:EE_ X-MS-Office365-Filtering-Correlation-Id: 8765e684-6fbc-4a26-69d1-08db9ea5a105 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dfrQqG0cX9aTbLyjHm7xx+xiTZMQUpVVFMP6AuDUo80FMxV2yFl6XADxQq/4KfoTGVXxwKGEIljZ+3M7M9OibkzHWkcb5yDbK3+jSk82e6ZXLrDFwRlUec+7Sc2MAE52EhXxv5uiQtTB3MQ/NQcdtLdjYIjZsizGdWUerPH5IfhRrB824HD6AdehjLyw/E1tW5aV6hHJv8bau/cbO4m0lcWePTxBlcO8gN38Bhbp4rdm1HWoICT8iPhfU4/4vosU7xMTeaZu6UzT9QOw9ZoulgAKFxdnHJZXNtWnHbol4B2x1dm+CP0wVyfWkI1SHsA+vnNJV09D1sbwfVF0j/1m2t17+wAl4CLVcXMLpRqvqzxq9dk27UzmGvXxeODauWwCWHduFsLo2KNGkgNWG7IY4/cqDn8EX2T4bzLanKLCZj/hLb2nfJ3Y4KAbzIUGhb0/2sgqKBQZcBf/McfhIVynolDkOvaZUrO6w8lm34fqi9UJVI+v7F7dX4l4KKq1WB23Uwxk+kH91o10niSx2fTiqhw7JmBFEAHouLw+hZTtMshvwz0Yo1VS5PfTaRdH4Vz6DVNrcRDfmKQHfdsE4QMH84rZKo5iLxcU5yjq+qCfN8St5ZV2A0/+S+RzzYElAWz81VJX5bE0M8g+7RSspLjz9hU/KDHJ7Onn2CffxUBgaXQmIg0ATZDE26/5rih0HdSbsWJfiiCQ6hN7q1zUCEAQbd6/rI7+kd8dV2Ac4VAADhQ1yLVYUd6HKY82U77QkjK5EVpDrpPI5PUszNEDz7oKCQ== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:41.0243 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8765e684-6fbc-4a26-69d1-08db9ea5a105 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: LV8PR12MB9335 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org There is no reason for the variables to be pre-incremented. No intended functional changes. Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello Reviewed-by: Kuppuswamy Sathyanarayanan --- drivers/acpi/x86/s2idle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index ce62e61a9605e..7711dde68947f 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -123,13 +123,13 @@ static void lpi_device_get_constraints_amd(void) acpi_handle_debug(lps0_device_handle, "LPI: constraints list begin:\n"); - for (j = 0; j < package->package.count; ++j) { + for (j = 0; j < package->package.count; j++) { union acpi_object *info_obj = &package->package.elements[j]; struct lpi_device_constraint_amd dev_info = {}; struct lpi_constraints *list; acpi_status status; - for (k = 0; k < info_obj->package.count; ++k) { + 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]; @@ -214,7 +214,7 @@ static void lpi_device_get_constraints(void) if (!package) continue; - for (j = 0; j < package->package.count; ++j) { + for (j = 0; j < package->package.count; j++) { union acpi_object *element = &(package->package.elements[j]); @@ -246,7 +246,7 @@ static void lpi_device_get_constraints(void) constraint->min_dstate = -1; - for (j = 0; j < package_count; ++j) { + for (j = 0; j < package_count; j++) { union acpi_object *info_obj = &info.package[j]; union acpi_object *cnstr_pkg; union acpi_object *obj; From patchwork Wed Aug 16 20:41:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714405 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 0A157C27C56 for ; Wed, 16 Aug 2023 22:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346777AbjHPWKz (ORCPT ); Wed, 16 Aug 2023 18:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346784AbjHPWKo (ORCPT ); Wed, 16 Aug 2023 18:10:44 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D707C19A1; Wed, 16 Aug 2023 15:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+HxEhz/Iu+w8NEGZHOkJWAzmPcS2IoRc2wIfbo308JwiGfggmuHwrXu0kQvT+Pdn9pEs0xv+/vgCBS2SZXpUrUYPOD/HR2aG9HHNhhRT6jc2VO266Rz4e8B2LzWlt1m+QruCFv7rvjj7grqDJ/G/bcVsNComh4aJal0MOdFe/iAvnpL5hWMUbdEGbSE/nNxnxch7DcXe/zU3NXfNJE7Dxdf8Ub7X22q5webP1bwTZNn2sM4r2nqj7G8b8NWUJOZgW+prrBCBGeWkiULERdK6Odx/skPzjiivR7qRRPzhXsAmpcfNnlrfEMUAwtzCen2nnAip+cgVoHRp9pI+wmezA== 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=qEDVgXKd5mNpSBxC3wfR85w392WHlAZwDxTaCkxX1Vw=; b=HBQDN7cLJIZPNuS3Tq0kksGneb/Z/VVzpepNtvjd9b7NkmvsvL2uMrlNlyTQtf03Bj3NhRPeOWi0Jxz8D22+Wc6Ea2djeNpH5OnI3Qs+Uh4wN0wkaGK6rcuwGQq1Q+b3l83aWhPPalKEo+9B2bh13p2sMc3DtOCsfMwEMfU6/p8sxb6tezzMeOpd8KkgrQWKGhPpAeFBGZ38hmISsLZ6uBqg1SOyEse5z1OelLZHmAoObBd3zHAe8Z+EZxydqZQD0jux1ORLTeqsCkUCdHc1vJPpnvzjUZ89gQLzKmhgUMUDRiYdXrDA8yxdokywDY8V58plIylPlK7KfcS/MdDExw== 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=qEDVgXKd5mNpSBxC3wfR85w392WHlAZwDxTaCkxX1Vw=; b=NHwH5u8DeILz7tpJHywV03EUy69tHcZlQVFpk01rRkGOqhVEYrYW7237eWVpv4D73OTgWyv3RpaNpTt6Wlm16yJMFfzECU6ATS8dVWox/SZB302rUiwTb6ub1MOvpeIgDm14XBo3cO0JvRTfaS5StGwH/E6sgpW0r8yfMQbX9zE= Received: from CY5PR15CA0220.namprd15.prod.outlook.com (2603:10b6:930:88::22) by DS0PR12MB8454.namprd12.prod.outlook.com (2603:10b6:8:15e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 22:10:42 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::40) by CY5PR15CA0220.outlook.office365.com (2603:10b6:930:88::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Wed, 16 Aug 2023 22:10:41 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10:41 +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; Wed, 16 Aug 2023 17:10:40 -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 v12 4/9] ACPI: x86: s2idle: Catch multiple ACPI_TYPE_PACKAGE objects Date: Wed, 16 Aug 2023 15:41:38 -0500 Message-ID: <20230816204143.66281-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|DS0PR12MB8454:EE_ X-MS-Office365-Filtering-Correlation-Id: c3a7757f-e826-42a4-9f92-08db9ea5a17c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w7jqrxNc0x5/gvsj7oR2MMqIgxhRXePxVHVKCd+93fq1YiWjNYEoluPj2dCUD2K0Q0M/PUuJXnjNlkzRxY/YPP5+q6BnsekUvRg0cytF3klXYhQ4fPVHsh2kAcJg0RyLtAXejVO0OEd8k882O/IFFju0k5TEJOSaBAhnKMUuuT3QKXtMC0FY67fAfXoXCMd7gAP+c6aWw4y547MhtRG0pNJlVa47p0IbKtdgteNEm8OTXXnNOZAzE+DlJ1Ddz8sDgj7G7kdiUy/K+BmVD3fpmfzvcs0DXw554IpzCoixHcNjf+LlBWRY9WgDxhjhlBYJKLvLaYmKrofAfeOyQFrC/puc18UPB/+cP6OYoeVBKjERXqSMEHLF4YtQtir5UdbFCq8i7txo5wEH7QpJ9A20/7l0qdKaEqn0xj4kVThJ5lMncFFbf1xTTNDE0heqzyJn/ERcNOXcoNyEag+7hbNdN2pAp75sWe+RZFS3g5mtk+69eOXgTLot/RgdoQa7od8Doy0HHcgYBPUXLF46y4gK537FUf60s2ZTh+0vDSiestaQjqkIKHR8TQQCegqAxry9xPqwmJiMRy7E96hZFUW9+Vrkwi5Qi0YJ/YGQgb4q11pkj2Uwmt3b5CiCAu/6X3p7lHTEKrHjHYRuc+12uuY6XTQehlbQKfRej7Jn6gEtNkKXTAZ3Le6EnhIbseW7j11TEUZ7b0q+XCwTYMSe3aGbiTzfbBdonFM7OBnCd70SPutpDuwAevb/hyyTFEigLJtThOnS1vaBSLC3pxXD8Im4Lg== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(4744005)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:41.8054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3a7757f-e826-42a4-9f92-08db9ea5a17c 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: DS0PR12MB8454 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org If a badly constructed firmware includes multiple `ACPI_TYPE_PACKAGE` objects while evaluating the AMD LPS0 _DSM, there will be a memory leak. Explicitly guard against this. Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello --- drivers/acpi/x86/s2idle.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 7711dde68947f..508decbac2986 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -113,6 +113,12 @@ static void lpi_device_get_constraints_amd(void) union acpi_object *package = &out_obj->package.elements[i]; if (package->type == ACPI_TYPE_PACKAGE) { + if (lpi_constraints_table) { + acpi_handle_err(lps0_device_handle, + "Duplicate constraints list\n"); + goto free_acpi_buffer; + } + lpi_constraints_table = kcalloc(package->package.count, sizeof(*lpi_constraints_table), GFP_KERNEL); From patchwork Wed Aug 16 20:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714404 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 AAF9DC27C79 for ; Wed, 16 Aug 2023 22:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346799AbjHPWKz (ORCPT ); Wed, 16 Aug 2023 18:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346787AbjHPWKq (ORCPT ); Wed, 16 Aug 2023 18:10:46 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8c::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13CC26AD; Wed, 16 Aug 2023 15:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nCC1LSms9VDbi07R8q/z7A1a/4a8/6IPWWYOJyimtGms5WycYqRBPPi5xIaSNJ80gapYXm9GGkvepxZ4L4YNDH6a0jpTRXJuzdVe9GemFBVFOXQG9K0j1lwK40C0xhstyY7hjhOdepjJBSImVG3OlrnKestxzIuoyak1SBpOfwavn7t68FzyYgSsUFfDJNYoNgsN1sF47SSbw+DY5wcHTGoWDBvCfAbxVnhhgLXi3fzSX/fIJyD9fAHLkHhfbya3cZg/rfHHBKVVVRhiiTWJHvjS4N5GwlWSCX4DaJ7OpUaDB/UKzlLGHT6fmVfS86LBrArt2rQyJl9KLwhoyqsWug== 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=HJcKY+uKW3wE4TuJNRk4uzTjHr7jUaX7A5i8dW7EEu8=; b=PuXvzzyhLf5TnUpgrS+hieDqn78OpHoyekIEFd+r8+BDPGFcFHuVhhpKUqjAXwRh15u6AdDQRu0Jj+Tp0/Wcp2iw+cxuM061R0/c9HTzG1vxnPwHBB4iCTF4pxqkMrXlToiA3PgrvC3mhHX+SGzwyNduY/FYxXG0GSQ90IJslIKp7JNg9UtOwzDPyJubA1GduEcfjmwdiWVjSPZR9o/1qwjAwyuHZ8NPkoiun4mcmcSlUX53H563SA+WONTKmsqWu2LGUi+RjNv3UKIsyF2wmKEy24CTBFHMrxJn+tM+FIi9xuGBmvqVkDgVB8fd14qLt3RXhXnk9Gotszz3SK+FqQ== 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=HJcKY+uKW3wE4TuJNRk4uzTjHr7jUaX7A5i8dW7EEu8=; b=DNyuH4UYAtFlSVbOxy8kcKiQ7LdtbSx6N6VL4cRIBR0AlWqzi4OJFqtvUlnPM9LQP7ErT/NRKIo4cf/SvsWsmAYFH4VBIhXXH45kUqwBmc2mBTXh86FhdoT3i3EqBCgPu4BuYhkTRiOmhEKDqtYapCXhkYCnZ5ChSC2l+ZDy++8= Received: from CY5PR15CA0220.namprd15.prod.outlook.com (2603:10b6:930:88::22) by DS0PR12MB7745.namprd12.prod.outlook.com (2603:10b6:8:13c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 22:10:43 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::3d) by CY5PR15CA0220.outlook.office365.com (2603:10b6:930:88::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.15 via Frontend Transport; Wed, 16 Aug 2023 22:10:43 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10:43 +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; Wed, 16 Aug 2023 17:10:41 -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 v12 5/9] ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table Date: Wed, 16 Aug 2023 15:41:39 -0500 Message-ID: <20230816204143.66281-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|DS0PR12MB7745:EE_ X-MS-Office365-Filtering-Correlation-Id: b3036c72-5c4a-4489-d28d-08db9ea5a231 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5MUz6vukEVqEo0KGcW7XgyNkZnWIU3U7wnGXViSDVJOskv17pWOmEMoX2mTab58LI8tO3lvsYiqjvbGOcizdOSgOG62C3U1UtWWkqptbo/QG+UKlQL7Ji/b03EHMLVwzbGJmFfxvZVucl6l+8edpSObcEEFQJh2JKrNui7pSQInMb4bEoyfG+O44rGeFNlxcxDU8CCEuFm7xKXJxtHfNi32br5RouozHMIAOCZq6ApB6ausLjheEmQGbKMGfXstfPUr+y7d5CVS3M28uFU/O8zjF6dXN4J21wwR3oa2ijjR1b7p7ruuINkei2PWMyGd817A3vCvEpJdDWb5aGn0ig/afTECD0uDNyekQ2g1rDrhCEpTIuCbqbShAvgmus8Njrl1Tvr7V0aOWFlXH6dXrqe4nhEk7rYvuzY50cKCCjPo33cQ+bK20EO9eZGSkGPpGOCTmOoBuL1lmIs1aQaLKYdEKzjS6/6RtJqpx1vYey2KzVaD29IV1FAwOM6E4UT9e/NoItxpGKS6CkxdfWG8tuduZRS47NVdHtrXCGunbWH3wUVvTT8ppoE2j5FA7eZF8FcSmhD6pFfj3aSI/nCVl6x+Kcd09+iNuLrZULYnMg3WWlnYltSSyZ9TuRiI4Ln2EAFmwS9T2OMvdEkIVUg6Z9TFsme5U1yPDvkYKhN44cjICsPwYEjbzclJo/iR/k/5NeNif8PLqOKrND35huGBRJKokac7JY/PP6z11Nmhm7Jjp/VqAb+KyKhXd3ka9siHcEGiNhdXwsZ7eTnEMeJvXPQ== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:43.0086 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3036c72-5c4a-4489-d28d-08db9ea5a231 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: DS0PR12MB7745 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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. This fixes a functional problem is fixed where a badly formed package in the inner loop may have incorrect data. Fixes: 146f1ed852a8 ("ACPI: PM: s2idle: Add AMD support to handle _DSM") Signed-off-by: Mario Limonciello --- v11->v12: * Update commit message v9->v10: * split from other patches --- drivers/acpi/x86/s2idle.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 508decbac2986..290514c21bb90 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -135,12 +135,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; @@ -155,27 +155,21 @@ 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; - } - } lpi_constraints_table_size++; } } From patchwork Wed Aug 16 20:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714108 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 9907DC27C6F for ; Wed, 16 Aug 2023 22:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346804AbjHPWK4 (ORCPT ); Wed, 16 Aug 2023 18:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346786AbjHPWKq (ORCPT ); Wed, 16 Aug 2023 18:10:46 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2089.outbound.protection.outlook.com [40.107.93.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E95B319A1; Wed, 16 Aug 2023 15:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQBetMD7mLHsGiVkEY4afevREewRf8pGzCvTzVX2B9lJT2PTtE5mFNC9roLlvBoYlwQgcBi1Sn4AlAnm8yE7am/42oc0vZcxu6Gjs3BQiLhspauS0WckhP4llVVlQGvvm0MkAnmAXM0/hxt5+PY90sXDPk/JiymjSYWpPFk95IItT8nD5/PY0Zs9sLS7iCluHCMY0gO7IWuKujOHfE9Hy5CmwQe/pdEGoFlXEcpdoGhUHXG/NMzHb1/aDLjxDpuDZ/xaod6CMGvcOWUzAUc94DIbcF1NZVGXfTHXCNE0PzPRfPQQRnJbw8p6eXriLbbdWyMLUfRMd9j5gMzwqT1H6w== 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=jcPVR/SmLRby7/MkRu0jxkL7rUgU3v7HgZOuE2DbrA4=; b=O7STGdF4Ewh842kwJXvgA8uB16b7JOTmi9lLCXykkyQOMvS7Kh0B26zH41ySchGejRrOFdQNCamg1HOINkk4PuIcIyGtPV8xGJ5wBZTGSHrUxNyT/igBumvdwNyzycCx42u2CToCtm41+Zteu4VC9NO9t3eY7OYUDdYvruCI5nqR9M5zfWxaNaKinLEWo2qroL3SLgRX9uXN9W7bVBZ/27k5rEt1R8P1xgGqxHLEY4SqrF2Kjnnx2TT7vGr9Vrgt54a4z30StsL8G2sDmz84wA1g1jZpnoAvyzmtoC6aOU78UxPDhn8WRJxtQyY7/ITjK4LJlzs3kCi9h3MdXFCTzQ== 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=jcPVR/SmLRby7/MkRu0jxkL7rUgU3v7HgZOuE2DbrA4=; b=fHPZmq/KF17Yvtx3trvdt/VpvgnoWdtD7DE+I5jw8KJYRkoAKSb0TYnSAPd8WUjbuCDRExma0ILvG0fBn+sHYKkB59k2O5eLAfBqL9sJzRw4RLG4Rg7AIuvkauzIHwJemY2duXfv3vsz21hjX6Y7ub9RtSI9KvImOZJJw4tF1fk= Received: from CY5PR15CA0211.namprd15.prod.outlook.com (2603:10b6:930:88::13) by CYYPR12MB9015.namprd12.prod.outlook.com (2603:10b6:930:c8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Wed, 16 Aug 2023 22:10:44 +0000 Received: from CY4PEPF0000EE33.namprd05.prod.outlook.com (2603:10b6:930:88:cafe::c4) by CY5PR15CA0211.outlook.office365.com (2603:10b6:930:88::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10: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 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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10: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; Wed, 16 Aug 2023 17:10: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 v12 6/9] ACPI: x86: s2idle: Add more debugging for AMD constraints parsing Date: Wed, 16 Aug 2023 15:41:40 -0500 Message-ID: <20230816204143.66281-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE33:EE_|CYYPR12MB9015:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f7dc310-3f72-47d4-cbaa-08db9ea5a2cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YmX3pnZX2z5cNz3mURTsVNIsNezXrDEmR/rKL4qHTdQ5l0NW0qfS6EcsP+7XLNIccl3Ce2vttXwwj/vYk18BDkZr/BTqlBIyX3swIsQoIhafhKCxsFacN4tWShQNu1gAhCjA+Omhf/cVoOe8+W/WPvMFK5HajX6uTr6IHKAJHVJdOcju/PIULL6QRGEFS5EoilJUV8B6yufUWn4QN4TMNTPN+nxzl0/ndz92q8m6UukjuX9QPla8nvch5dGH6hPpxIp7D8NxqcFIcU/Wc1jW1sF2iALMnUEwFMXqhVK0vqHswJhL69yELZidCyKPrTfB1GmpFeAC8etuEFxXSewgYCLEHvfx4Kq6ZK+/Rz+UomD/5rKLscBRbN7vngDlW7masMHh7Jht2sgazbw6GOvTcN/nFBoEKJ+eI0Zx/a2UNI/tbHPwmVjS4MH2JVhG8T2DUsH6H7N+CKIwMsYvDm4Bdge1MOTBr5deya2WwPmNhbqSSBCuZDwwytLeqZ9LjgHMMHocvri4J0Ydik0Q1+euPaiz5QoTKjVO5pFFXLC0h4NLLow0ciGr0S4Bnr42LFxk16Dv4oBsDxGsQ2Re27H6BwW6/pkIzd5XlPnjauRAyYiHTiLHYrWU1g2pF6QGB+7wAlSr3ArdHCH4JoLmXr6w98Ntzzc+G+u4w92DXePd1csLGX6Eu/KLNqDa21StqEl4GW2jW1pS1oE6P2hDR0y7cSn5wYol0dkBsSUJLCcwSpPoZT7ykjEBHFU1450iLAZUj2+pCsuHHdKJlVPPbRC9mg== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(4744005)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:44.0242 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f7dc310-3f72-47d4-cbaa-08db9ea5a2cc 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: CYYPR12MB9015 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 290514c21bb90..b8b3151215f0a 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -166,7 +166,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 Wed Aug 16 20:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714403 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 067CAC2FC02 for ; Wed, 16 Aug 2023 22:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243037AbjHPWK4 (ORCPT ); Wed, 16 Aug 2023 18:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346790AbjHPWKu (ORCPT ); Wed, 16 Aug 2023 18:10:50 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C262705; Wed, 16 Aug 2023 15:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrvqDGxXRc51w5OlZ4MK8mxyhHy1i8F3cAqc5Dv9OYz7/rvkOjYS5At0gsiUnVyuoVMdOtq62akHVJcGQeNjtvFMsQpv2P9N5N/8te8cZnkXICywc0U9PbAsGP/NkBFfjAFIRGCX39NlUeAGn1T3xB1jQ/w9Sc2wW2UM3qBvyGRlUWxiLRaoiWIEZUfVkzeaPmvNoQ56wCx1S6v4N043rMMPy8UXxkp9DESS/8abyDLftbBnO+MK9RX6qhkpHvyT6JRO/WZtYASu0MUmmOhK+NSDL38wtPOAnpqdzV+tvVzIzBR10bKq8Jn4rIJ4PBA5OAg9k+/wjQTbKmbHYnJMsw== 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=dIfryX2RvXwZl1oT0n3qxt+4Hmo3lCcDx8YQEcm5ybo=; b=V8UV9H+jI58G5xGfCw0kTkyaOvVvlFlILl28Er2S1A+Ot1onZVCzXHQIuKmaYlGySJ+wfNiaxb80Syw9bY9PcYLfB48eZfaCsUq5XNzJEsA+KVwc7SIyTJN7pwMIAaNjQPh9bQTxOwfhMgAESoEVmncNxaGj+dynhei6gGdyhRDZQjHodDRDhGBz8o4TrTIrlQAFqtbW87Ljaj6GWRQjVnK1YJlqMPKCjupPPKGYKkEZyorLrJjBxOZXQ+WqjfG2kY2sIa45ew9Ft8FbY0V1q/cpgf32JMXQObJtjI+RD+Tr4Fu943DLFAibzahLkWxgDPbMBhtL6Q1ExOcHCu9ohw== 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=dIfryX2RvXwZl1oT0n3qxt+4Hmo3lCcDx8YQEcm5ybo=; b=DOry0NNrap37fKbB1If3JQhMSCPP7pBI/Bn6MO1T/faDFSqHxRP4U9xySQVyH+KGasgO4Re8nrIMx1RwUHBcf3rKxFmUgvB8zvmHA522nTkctc1ZJJUS2jUCUtoHHx1ENILkGWHw6tH4m2VZvrGh2ER/v5d8pECaKOVj0Lc9Mgc= Received: from CY8PR11CA0022.namprd11.prod.outlook.com (2603:10b6:930:48::6) by SJ2PR12MB7822.namprd12.prod.outlook.com (2603:10b6:a03:4ca::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 22:10:45 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:930:48:cafe::8f) by CY8PR11CA0022.outlook.office365.com (2603:10b6:930:48::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10: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 CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10: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; Wed, 16 Aug 2023 17:10: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 v12 7/9] ACPI: x86: s2idle: Store if constraint is enabled Date: Wed, 16 Aug 2023 15:41:41 -0500 Message-ID: <20230816204143.66281-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|SJ2PR12MB7822:EE_ X-MS-Office365-Filtering-Correlation-Id: 6da86bfe-a5eb-4b93-32a1-08db9ea5a349 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iTSRhA0Ywiumzpnnv2S7BpntYTylTbUve6thrp39cq/3vQQ2kAI6pz9WN+FPRWipnxQSb6/gzbU7qgYkJOzpJEZf7yaGpKMQlep8NYeKoIo3JzYywGPf8Vkx8W6jmQE2rigbziVxTrL87LmsJvVFHnjnl4VZYskM+tHF2uRhfRBsglJjs+Veaxd+mwOC9Tu1n9FILFlYyUUONqh70ssJuyzLLwQ5ft1zmW2rXdT56C/uUvCxrBNZNciwXdZf/tCo7wQg/iXjlvdwKPP+44duycuVK8aGe2Fs8LeOZuLH/ZeGPFlyR4j/zm7At9B8XTuABv4uMzdBwzCjrl4j+QRDJWooih6VSJNfOaEHRFlSrFstOfmI9UaKA1ilkn4QcLIkSjbLk+N6E4SE2MPhDlmgjR1fgEc3cpHTOreXrjk+GXoY1iSKZ7nBGv1W+aYniqa622FkGezJefXZCmM/oJ6ZezXTjwZIRgguUW/Yec/B7SEXtD5TcFFm9wN4rjONnkqyGVz+4Zc5RJRVXiIfPVf24eLwJfOONZN4qZDqZzLIugwgs7CodAz7ciJbeZ8bCeXWxFtnwcpCgCD4y73WetmkfJHHnaincX/XzOYQiD/GHEbp3z/XYwtzUPG4vk7uS/0toGGjtWCQ7s52uqx6IvZ688f8PbzK+yygda38cZ9Z8oPgujrWWRa6+6RSijkvlLreHk+sXoX5YzK2Q6m9HBQhQbre2ALZsn3DlT31WdhWe9AcX+5jqmJlPNkzooOrWXqTeUSzgYeRdQQrpiLgrvuLFQ== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:44.8395 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6da86bfe-a5eb-4b93-32a1-08db9ea5a349 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: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7822 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index b8b3151215f0a..826f2924d05fe 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 */ @@ -157,8 +158,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,7 +173,7 @@ static void lpi_device_get_constraints_amd(void) dev_info.min_dstate); list->min_dstate = dev_info.min_dstate; - + list->enabled = dev_info.enabled; lpi_constraints_table_size++; } } @@ -236,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]; @@ -248,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]; @@ -285,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 Wed Aug 16 20:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714107 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 340CBC27C52 for ; Wed, 16 Aug 2023 22:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346802AbjHPWLZ (ORCPT ); Wed, 16 Aug 2023 18:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346780AbjHPWKx (ORCPT ); Wed, 16 Aug 2023 18:10:53 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 731812708; Wed, 16 Aug 2023 15:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fq8f1CbcAVhRkq2dpC6gDeg+LYphyzyTKGNsRfdCUeI4xweQWUl5+6rwtswRW5oI8evRYFaBj5crpudoekIlrruuhRCR6+oM2x/5zGw0+yjRezHK2k3J35HtHVgFXCOBflvmzaa/wOMrsKPQRQIc2JaSf9luN2skQXYPG4eahIJBQ0NmFPq5hVyX0atCGCrvfBxzzkFI1pStI0B9JZn9LvsJYxix9ULpqb2m44te9bXlh8VWUsd38QHMKrTHxXP4F8cs/tGLrFZrpOL9RVDmBnYgvvDWhmH+tz2MlUgKTvkrB7aTvZJTyayfULT+8IefiiQhWXQPquDUTyEp0QBnjQ== 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=1z0oISn2A7L4+VMcPvWfDi5HZ7KR3PmdMVA1EiB6hso=; b=DQoeO386q3z2TsLqraVaIAu/87b5Vn6SXw+RiKgEUMa5m1rkjYSbSAXfkKv2miydNqaEV8PFpibn69cYlDfQX3qrv+LEBJggbe2tjDfVRYq9MRxz1V3dfYsz7nPFaLJZp1wpGUOv7y9lCayjbFQ92w6FQj/1gqag7VOVj86WK54JGlRVPxTNl0I5ffi19cea/V8Sag1cUhGSFofu1odzD2mVhRpgNgtXkHKnJIbxQfu1f+drnU3Hmp8wwYRZ+3bU8Ak4OP319F37LqiJdmvg+7gU18wELdmRhKCvhdLOdTc/5kKfX9kWC5d8Fk9Fj+UoE/ScZ+qnk7afj7U7CnVUJg== 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=1z0oISn2A7L4+VMcPvWfDi5HZ7KR3PmdMVA1EiB6hso=; b=L0VWLB5hlzSNCIHP1g5m2nuqyoeFU/PAdEdZj1+ilvyK7RiJocIMPDqX3QOBRnrKRZJOwwQIg/EwZB48lZRhtVO2392CVt1zLjUNi21qhNlnBYnzwkqJ+idqS6ouaXStVGxNUbA35/Z0gLSgzLLRslpReW7cDNgeFQCgxCe9ifc= Received: from CY5PR15CA0176.namprd15.prod.outlook.com (2603:10b6:930:81::19) by CH3PR12MB7617.namprd12.prod.outlook.com (2603:10b6:610:140::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Wed, 16 Aug 2023 22:10:46 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:930:81:cafe::35) by CY5PR15CA0176.outlook.office365.com (2603:10b6:930:81::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10: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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10: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; Wed, 16 Aug 2023 17:10: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 v12 8/9] ACPI: x86: s2idle: Add for_each_lpi_constraint() helper Date: Wed, 16 Aug 2023 15:41:42 -0500 Message-ID: <20230816204143.66281-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|CH3PR12MB7617:EE_ X-MS-Office365-Filtering-Correlation-Id: ac67eb50-d9d6-4e59-f2f9-08db9ea5a3fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r3E4ApALcMmOHGdSfdJWL542I4Kp8qKmezy2gjEDnnp7J48apQi6nTKhxF+Ja1oGNwoYiN7YP7Rzc2apSVyePEdEnz51weA/uO78hTpzEr1fW8TNikJNq0nX+xwmMgdipDTjJpsbWJMVEs0OX8egwxPUd1eeLqlBSrepFk67Teba/jv9LlYyMBqpp336TkXVWWgB27JUpL6fN6bTp8iFAmOLn3+rmkYn8MNy7qLWuPpCuxzMoHLCHxdMMIBdzwLoR8HPS0DOnFG8OH6Dc0AoSYmpIsVSdCf6B4Ex+blfrBwA4qYwtIJNHkTC3fhsDvZAZpN9SLoHJfpho02idQmR4R7wg9MKsGZPJsr6mlMTy/LAUWCuWFwd8X7TqxmF8FlP1fw4UEXw9HphSystXhFoIgFbn6mBCLTwgq9bRvtvVTKIjDmLrKr1mxO9maSHNA04DBWWNhIeDLP3hZCMfqoGd69cv1ujA3iZa3O6UKwSEw6qjOCblzPl/MTbSp+6X2uofsp9jumifIm/SKwdmuaVzdP6H+S5YnFEJEbYtxvbmh5v8+6GQpkSNAjF5Zay0VP3JX/jF+6uTmO17v632cGfGcJINXt6MoETsNpagqHRDJhd0MCZEGl7HYOo1F0gHk5V44bNU/WOySoVmI4g0IHmI8cnC3gZdNm00nQPwtq/+Zgk+EKLRkiU+0FbkMTdQnbrYlwZhOXS8ZcVDH9Es1LHPWHnm67rqkFBTQoBHeWiUhrjT6FSiAL4/8Fyk7F8M+7ilxC+vkbFfAwOVX66Sg/dUw== 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:46.0175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac67eb50-d9d6-4e59-f2f9-08db9ea5a3fc 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: CH3PR12MB7617 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Andy Shevchenko We have one existing and one coming user of this macro. Introduce a helper. Signed-off-by: Andy Shevchenko Signed-off-by: Mario Limonciello --- v11->v12: * New patch from Andy --- drivers/acpi/x86/s2idle.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 826f2924d05fe..8bda45579d44a 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -95,6 +95,11 @@ static struct lpi_constraints *lpi_constraints_table; static int lpi_constraints_table_size; static int rev_id; +#define for_each_lpi_constraint(entry) \ + for (int i = 0; \ + entry = &lpi_constraints_table[i], i < lpi_constraints_table_size; \ + i++) + static void lpi_device_get_constraints_amd(void) { union acpi_object *out_obj; @@ -297,30 +302,29 @@ static void lpi_device_get_constraints(void) static void lpi_check_constraints(void) { - int i; + struct lpi_constraints *entry; - for (i = 0; i < lpi_constraints_table_size; ++i) { - acpi_handle handle = lpi_constraints_table[i].handle; - struct acpi_device *adev = acpi_fetch_acpi_dev(handle); + for_each_lpi_constraint(entry) { + struct acpi_device *adev = acpi_fetch_acpi_dev(entry->handle); if (!adev) continue; - acpi_handle_debug(handle, + acpi_handle_debug(entry->handle, "LPI: required min power state:%s current power state:%s\n", - acpi_power_state_string(lpi_constraints_table[i].min_dstate), + acpi_power_state_string(entry->min_dstate), acpi_power_state_string(adev->power.state)); if (!adev->flags.power_manageable) { - acpi_handle_info(handle, "LPI: Device not power manageable\n"); - lpi_constraints_table[i].handle = NULL; + acpi_handle_info(entry->handle, "LPI: Device not power manageable\n"); + entry->handle = NULL; continue; } - if (adev->power.state < lpi_constraints_table[i].min_dstate) - acpi_handle_info(handle, + if (adev->power.state < entry->min_dstate) + acpi_handle_info(entry->handle, "LPI: Constraint not met; min power state:%s current power state:%s\n", - acpi_power_state_string(lpi_constraints_table[i].min_dstate), + acpi_power_state_string(entry->min_dstate), acpi_power_state_string(adev->power.state)); } } From patchwork Wed Aug 16 20:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 714402 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 5ADA1C41513 for ; Wed, 16 Aug 2023 22:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346773AbjHPWLZ (ORCPT ); Wed, 16 Aug 2023 18:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346762AbjHPWKw (ORCPT ); Wed, 16 Aug 2023 18:10:52 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2040.outbound.protection.outlook.com [40.107.102.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E7C2705; Wed, 16 Aug 2023 15:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z+1HjORXII7uy8/EM6/g+yIPKJ4mj0q7YpSnnle30ERqRt/wPmbshVxhqXKgZWDLD0VI6IOEEH4DZFNETBbtN5+VbK0d1h7Zugldn9FlWI7bTPC3XKoFjvrdI8NyXbFAk4hOdc1yZBEYs6JJwqxcuFfCCExVd7iN1ymZXGcP9Vpua5Cd4O2JZFfNDSiS5uGcPB9y/sFOWcQuAxptzRLX7SU1P03BqdFYqNIkHsdwM55yICtJehNVYp4qxjMzs0uaEtWHIeNsTQlFQ9IjkQZRi72ZCEIr2rrLprE7GxZAWyzfLmFpK3aeQKh0j+hIQXa3vs3H+2jqO6keKtwJyyxnFA== 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=xOT/bDPHPcfmfuiAYg/h8hEQjF+5iXFTsYFLQAxyyDs=; b=LveWGoZOuXT6buHQsmaI86Ol9ubNc0A9YlI0fYLQbaLhizS7lAmowPIBQjAU+hioPCIxpiQxbYj1xQOxYQU6NIIKrMqW/PWG2QiwX36yxOCPagMmxt4xEeN4xXBK7ZZPTRAseEJ/RuoB0gzZO429AP7/2Y0dJ5LzX0H3FKbvmuc0LM1DTa6fGQu5xuNAIJx7ZvgMfzZlmdMb2jKuX7kUnRhb5j73Ywnjs+ii3llQUk6Kv8lM1WY++Xw5r3GqSOzKOMAmJBSUJvonkWd78+SHNARtt8ryTGZgnOqiI1mb4iR+sSmFmYOTgV6ekljWQiBnFrbcbm1DwSXA3WvTPIuYFw== 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=xOT/bDPHPcfmfuiAYg/h8hEQjF+5iXFTsYFLQAxyyDs=; b=KIj3aj292xepIxjuiOfgKhMtFMVke2DavGCQ83IqYkCA6bWr7R+zPUhD+myF+zXkGNPnt5MosVk5TXuz812xKu+KGCHlEmxOQ4uFcFQG2GgEyXgHUujxgv6b67AaRZgKFO2xmyJA/8g3xAHkx5h+FNigV9sxiO/Nvr+IP/6a7+A= Received: from CY5PR15CA0170.namprd15.prod.outlook.com (2603:10b6:930:81::9) by CY5PR12MB6551.namprd12.prod.outlook.com (2603:10b6:930:41::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Wed, 16 Aug 2023 22:10:48 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:930:81:cafe::eb) by CY5PR15CA0170.outlook.office365.com (2603:10b6:930:81::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.33 via Frontend Transport; Wed, 16 Aug 2023 22:10:48 +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.6699.14 via Frontend Transport; Wed, 16 Aug 2023 22:10: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; Wed, 16 Aug 2023 17:10: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 v12 9/9] ACPI: x86: s2idle: Enforce LPS0 constraints for PCI devices Date: Wed, 16 Aug 2023 15:41:43 -0500 Message-ID: <20230816204143.66281-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230816204143.66281-1-mario.limonciello@amd.com> References: <20230816204143.66281-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|CY5PR12MB6551:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c71411a-0aa7-4108-bab8-08db9ea5a569 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BH6MJlzG7o7IXRhDVcNRV+Zj/+eta0tOza/lIZ/BC24I2QFygNO0JU4d3V/z9eaAqxK43EZFz2jy/E8zSbP2bQcmuaJZrOEgDwYYRu2PGNF7Rpu5A9Y+SaEwaxBuAt+fv9cYVMC+LG6EjZixbCZuq7NYIQ4nnap2eHFUfdPkfQ/7s8Sjw11V8bgjB9BMcoa+fwVIXX5TW3M0QedjaMeWmDOB0UxsW+z6JMw7yFc8ziF+eYBGw2tGt/5z8GXrVzVnbhC4MFLpPMSVGrtSRPW8vt/QR9N+YJpVD7Ie4jfWr0jXNUVUzpkwEt41ks53KBpRPNXfPP2liOJsuxYs47eRin6jHolCa9sN622MJ5iMw4QGL7XvTFg0jSb/JW4BojZ1cDs6iTlEyTjEXeu23Jd12r/cZ5RjgVzAmdzOUWnoArBGbSUnjov+514JtQ36GM/skBQxyCtBSOBcFI+WLHY2PGmTG+OtoOhtmFxQjtyWAtA/8CwbBoAB7Qpu4nJWCSOzGePVMI9emrAn4DykB0neeQXvE22lEeWwSSBFmnMM2LDRL1ZEg0W4+TPxyL6DxIHR3zLI248hFJssDeQDiMTsHKHIOm3rmUJgZP7U7YWHIm40AB26kX8vstKXT/NGmPpls5t48aCiNhwh184kKZZtgbljpnulRC2x+0lCUQnFP9SVzuLpHUeHWZeRFFKAQ38ChahCD6itYLdH+2chgO/U0gRt7Jd07RZY/9L3/f7UTCbDY6iAUzOi/GTizCubVmbTjZvP+yzvdQL3C+BHaxEwQ8x+Bp71GxQAbnoU5JV1M98= 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(36840700001)(46966006)(316002)(54906003)(356005)(82740400003)(81166007)(110136005)(70586007)(70206006)(966005)(5660300002)(41300700001)(36860700001)(44832011)(47076005)(8676002)(4326008)(8936002)(2906002)(40460700003)(83380400001)(26005)(16526019)(40480700001)(478600001)(426003)(336012)(86362001)(45080400002)(7696005)(36756003)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2023 22:10:48.4081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c71411a-0aa7-4108-bab8-08db9ea5a569 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: CY5PR12MB6551 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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 [1]. When devices are not considered power manageable; specs are ambiguous as to what should happen. Linux puts PCIe ports into D3 due to the above described policy. Windows 11 uses the PoFX framework to let the an SOC specific Power Engine Plugin (PEP) [2] [3] [4] to decide what to do with those devices. Specifically Microsoft documentation says: ``` Devices that are integrated into the SoC can be power-managed through the Windows Power Framework (PoFx). These framework-integrated devices are power-managed by PoFx through a SoC-specific power engine plug-in (microPEP) that knows the specifics of the SoC's power and clock controls. ``` Effectively this causes PCIe root ports on a variety of AMD systems to be put into D0 on Windows 11 but D3 on Linux. Instead of only using constraints for debugging messages use them to enforce that PCI devices have been put into the expected state when the system is being put into s2idle. * If a device constraint is present but disabled then choose D0. * If a device constraint is present and enabled then use it. 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] Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/device-power-management#device-power-management-in-windows [4] Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") Reported-by: Iain Lane Closes: https://forums.lenovo.com/t5/Ubuntu/Z13-can-t-resume-from-suspend-with-external-USB-keyboard/m-p/5217121 Signed-off-by: Mario Limonciello --- drivers/acpi/x86/s2idle.c | 51 ++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 8bda45579d44a..5192a7147655d 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -300,28 +301,61 @@ static void lpi_device_get_constraints(void) ACPI_FREE(out_obj); } +static void lpi_check_pci_dev(struct lpi_constraints *entry, struct pci_dev *pdev) +{ + pci_power_t target = entry->enabled ? entry->min_dstate : PCI_D0; + + if (pdev->current_state == target) + return; + + /* constraint of ACPI D3hot means PCI D3hot _or_ D3cold */ + if (target == ACPI_STATE_D3_HOT && + (pdev->current_state == PCI_D3hot || + pdev->current_state == PCI_D3cold)) + return; + + if (pm_debug_messages_on) + acpi_handle_info(entry->handle, + "LPI: PCI device in %s, not in %s\n", + acpi_power_state_string(pdev->current_state), + acpi_power_state_string(target)); + + /* don't try with things that PCI core hasn't touched */ + if (pdev->current_state == PCI_UNKNOWN) { + entry->handle = NULL; + return; + } + + pci_set_power_state(pdev, target); +} + static void lpi_check_constraints(void) { struct lpi_constraints *entry; for_each_lpi_constraint(entry) { struct acpi_device *adev = acpi_fetch_acpi_dev(entry->handle); + struct device *dev; if (!adev) continue; + /* Check and adjust PCI devices explicitly */ + dev = acpi_get_first_physical_node(adev); + if (dev && dev_is_pci(dev)) { + lpi_check_pci_dev(entry, to_pci_dev(dev)); + continue; + } + if (!entry->enabled) + continue; acpi_handle_debug(entry->handle, "LPI: required min power state:%s current power state:%s\n", acpi_power_state_string(entry->min_dstate), acpi_power_state_string(adev->power.state)); - if (!adev->flags.power_manageable) { - acpi_handle_info(entry->handle, "LPI: Device not power manageable\n"); - entry->handle = NULL; - continue; - } - - if (adev->power.state < entry->min_dstate) + if (pm_debug_messages_on && + adev->flags.power_manageable && + adev->power.state < entry->min_dstate) acpi_handle_info(entry->handle, "LPI: Constraint not met; min power state:%s current power state:%s\n", acpi_power_state_string(entry->min_dstate), @@ -512,8 +546,7 @@ int acpi_s2idle_prepare_late(void) if (!lps0_device_handle || sleep_no_lps0) return 0; - if (pm_debug_messages_on) - lpi_check_constraints(); + lpi_check_constraints(); /* Screen off */ if (lps0_dsm_func_mask > 0)