From patchwork Wed Aug 9 18:54:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712711 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 9FF0FC001E0 for ; Wed, 9 Aug 2023 19:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234185AbjHITre (ORCPT ); Wed, 9 Aug 2023 15:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233324AbjHITrZ (ORCPT ); Wed, 9 Aug 2023 15:47:25 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E113710E0; Wed, 9 Aug 2023 12:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Np66/hxiz46aJnvMbkFFYzGXvdG8UEpN1dOVDXbmDr87jsr65owDuVFaCAan3+4UlShbQSEpgMthRT6W1evYqBcRoWiWGlInHOcDc/ItcmsSbSGKiltvde2DciZLgZkKWU5DMBYCtW0NCbic2oLTiDvIDlD2wNRgIKlDF+qfbn+HhDo/sOFX+6w9y/wOnQqmY3Zo0PCLeu0xxhQ+dDmwAsPnfT8ktod8XJ4Zmojfx8x+HqGQHwCNSaodtNZGlskj4Fos+a17ckv5hXiG3QzyqbtGYZqUheoQCNRdUus3ObfEu8Rolw3x3ibX7GA+t8cB9nH9pdeDILF6vrUdd670mw== 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=isb8vP6wiQMbys6pB/mXD1VKCquzHkkVG2iu0QaG4GJ3GdkGyPCi0wYKyBVKzzB51s9/UsaM58J0xF+81LPgQn7vY4IcCLkiQ+2Rc9JaQsWVArRhcD/aCUjLnraxe3bgI6RFaTtrJmuyt5F6Q/qLHuAIIcg3qgdfeBLemiCArJAa5ZmypMsGuYUkXdzYAVZnWwKVkLkGNQLK3FpLwZlui3JP8iZPB6UM4552tKZ6cnuhJw0cp+cZZQrbK7gX5XCiIkXTMXrtde9x78z/49vFwh0sr4aABogHg18gos7TnwebfZupWoNTk4xJZNceQDldrZTZHqiM2nyyYF8tknVmjA== 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=a8Vq4MB8mTeaP0OasiDl05jVuP4Pn5dYXnDgaCxm4DsUn16Sfr7t/HCF1bpMopY760qgT6T20zApxo2sGF1XNfCRSIYeJwOw+uDtaoR8htGq9N0Cavq0kgmWIZxuQOlRlbB6FVL+jKKtXd3UPpelKof+Y/mhZg/ZApFUDZixUDE= Received: from MW2PR16CA0070.namprd16.prod.outlook.com (2603:10b6:907:1::47) by DS0PR12MB8247.namprd12.prod.outlook.com (2603:10b6:8:f5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Wed, 9 Aug 2023 19:47:14 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::2c) by MW2PR16CA0070.outlook.office365.com (2603:10b6:907:1::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:14 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:14 +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, 9 Aug 2023 14:47:13 -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 v11 1/9] ACPI: Add comments to clarify some #ifdef statements Date: Wed, 9 Aug 2023 13:54:45 -0500 Message-ID: <20230809185453.40916-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|DS0PR12MB8247:EE_ X-MS-Office365-Filtering-Correlation-Id: 54f8c016-0553-4f5e-b564-08db99116e29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HkRpPB8NivTsIWGjcXGvsm788vg8ZT2MV3iDjdlDPydCbRRdTx0mM7ZbFjZ9OBZN7plVrgCuvUC7zf/FiELoMJUkRo9P6M31uFZ6aopssNKxZKzDMw4zAjIaHwMyvjCp4Ys/ZOycETjxcFQKnqbgM15cbXbQ7xafz7y+kgBWjxDewamI2FuSzmbJlT71iUf1FX6EwwaPWhYCKP+veq+o0HDUgKxlo/BkuD5Coev+2UpuwLOE0hwcy3GKu9Uw/nTP+gyGqIrOpfss5oEleqki5aLSw9gaHsmrlN22uzEwTUfLTYJ9Rnbo+/0DOR13lUJHAafMGDUShWK61KGusylbAxQfTjF55VOdsI3+pfzpBqLn3M9UPB/O4DIL3j7caAsT4ysO4rc5KplemUJRCoxPtDSF+QZXuJwom+fMejXuNhgGydpJv9INqH3mDEF5Ugmvjn+RUvuPNKiVu7x55BRuduGkMIuXUxHZV98Kw2Kp/QGcYZ/BoWifhbYUCNfDVmG1IVJNPUVhceSz2sXDR1FZZSO2EyajgYZwfdf2UTNne/3ocEdBC7vzU/gQUZmEWT4aLL+vCErutiVLqPfcMKCBmyWyCRy5c7Fe7UZp/YVpNF+Y6WBQ+XA+6AQCTyc13hGurXFf40k45biaEwbrJ7JgkULxJuFkQ3SI6Kfz5ir2nrSVCnLHDcjCypTMqUhp+/Jre5eKUrZA3ZCj6WgD6rpMj939+duc+PTxp40fOevgM607tQzETvB+R07jzFxexrRoJBUl9XgkGzq91ywct3fs5stp81YJo1eGBObaOdu30MrWe2zcJ+JXdagX40KPQRxt 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)(376002)(136003)(396003)(346002)(1800799006)(82310400008)(451199021)(186006)(40470700004)(46966006)(36840700001)(8936002)(8676002)(44832011)(40480700001)(26005)(1076003)(5660300002)(70206006)(70586007)(356005)(4326008)(478600001)(81166007)(36756003)(110136005)(40460700003)(54906003)(7696005)(82740400003)(316002)(6666004)(41300700001)(2616005)(2906002)(4744005)(36860700001)(16526019)(86362001)(336012)(426003)(83380400001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:14.3371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54f8c016-0553-4f5e-b564-08db99116e29 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8247 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 9 18:54:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712710 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 84B45C04FE2 for ; Wed, 9 Aug 2023 19:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234151AbjHITri (ORCPT ); Wed, 9 Aug 2023 15:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234111AbjHITre (ORCPT ); Wed, 9 Aug 2023 15:47:34 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::60d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 669E8268D; Wed, 9 Aug 2023 12:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NuthpxLLtB15KBDSn3BfYU+IhfHIlK25XWlqAeKOeoUZABl6he+VeJZfmi2H1Fo5k+xMpNOqoXOXdxFYPjZQyX2LQqaVz7MZzYXdTwuqcj9qwv4v+tfUdTaojUkBAVI81H3Ju3EsAqjqlhTBzAJgwCAsPbzwdcNW8iCQwo4i7EoADK1cyVNlb66LyEEVwKuFjWypwuTSqt2ujU/CTfNW91RHjPHupxPzg+t1qOCgv6X8xwQJr0bRCp4SYSbTy4AlOTZFScDJp5BZnVbAXKR3rRA/JMv6pl1/1FaZ61tJduMPOuqzqsLzSR/CPyhBL3Wqt3fhzJR/drDMR7E3nmP4lw== 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=CyTDbMfLE04qJ3eZvJSvpqIaVzNMTP3ADvo+o1UPQGu8UUf5tApomh09a3u3Z8Gx8Iw6xRTVk39Fy15Nse7VwxTYrwtH+eX6UKreFYd/hll7w6M9Ijv4d0TQ/A3dvjYpk/vfrj8Etvhw0N5cBNOxFTjAuF39SiOmNEDbkZtnMDHv47ZHL+cc+z2zSfpuMJKZHlAv+ye9p/SlVFgvHNxjJOGZwi25QLcoqFIl+94YYA6ca4HMDRwrNvU82PGYYnyPktJMlV+holEsP5E3oTpKzJZrQBKGPSJaSdOpybn/SrwZEy0YwesgMcAaEw57LTUVfVfEzVmwXaP3k2eGHU6eUA== 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=HnXufxSu5sUOow1AK8XBmtRyokksX5MhVJJUGWx/EPODPk9lClt6nG/TtIk4p77tNiS3pI6cSW6meo/cqq1aPPgEx4UTLym6JtzCaqHN01tJwQZG1o96PPwCWJTbqRBoPdYS+jumkDGyA5TJDBrNWy4Ns4/UavgyVSOT1TPf3Rk= Received: from MW2PR16CA0040.namprd16.prod.outlook.com (2603:10b6:907:1::17) by MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Wed, 9 Aug 2023 19:47:16 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::58) by MW2PR16CA0040.outlook.office365.com (2603:10b6:907:1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Wed, 9 Aug 2023 19:47:16 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:16 +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, 9 Aug 2023 14:47:13 -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 v11 2/9] ACPI: Adjust #ifdef for *_lps0_dev use Date: Wed, 9 Aug 2023 13:54:46 -0500 Message-ID: <20230809185453.40916-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|MW4PR12MB7031:EE_ X-MS-Office365-Filtering-Correlation-Id: 543ba54d-72e8-4927-82fe-08db99116f39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hqfSwu8uUdEb3wc0i8UMCox6UtH9w9FkGFjo5tBLzI8jBLOOsv1g9kccqgngvx8S6rp2HRGnA5v3GUpUtuZH29WCRhn1MNL9LYos0GtVYVEdlRHuHsHV69QpD/ZxYonIKVFk0NTQfuSKCrUzWYgU/eH0ga1nw67hd+a0BRFpZyU6psYR6fO9zxwj2jdd2tGj5/xrVtKt0lFWUDwGLRKn3ztYNKEUlBydSGnbCukEb0A1y/IMIhm55FsqIy5B6Cp/60Q8Z89HyzgOsSQWVllD+9F4Tf7xuI7iow/G1Z2OBm7VvxOAhDAiX/AADzmAlTgNLJbvXkKRTObJrDR7f6VsVAa+HbchZSkaspWMPrWmAJTwzHahT2jJMpXtjY2NW6wKuz/bTHXur5UtnSUOD7BSNyRIm8azod3IviHXNFZUTSQJlmJrJHGatA+GHtjdP9AK3tyy0tZUE1clvz3uFHuSAH3JYjjy4Q+QaoBy8ejRjFReCm48ydjxC6q+IRJ3PeN7nCj35K9hyfDXQuDwU38h4deIhYVWKm1z0+bHHt1S/4jcWCaZNvn5X6qlHURd7JXqCzlM4bfcgEP9/JgfrNcMV34IblMdgGTfo2INmqMl3qja3kVtgmVxpfoZjv/QPsfgwCA/UBSONsJ4BbaSvbGdDRw81IEL1U9D41kHc/ixMvOsfh6jIsrfEZQMMIpQcNOjUuK9Hk7N26zIPigTdF6wwTiL/xInTbecBj1NV78+kH5EyzJDjqExTTGy/oy3GE1Lo2vxFErshCXjygP8Ztvs3w== 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)(396003)(136003)(39860400002)(346002)(82310400008)(1800799006)(451199021)(186006)(36840700001)(40470700004)(46966006)(356005)(81166007)(82740400003)(36756003)(86362001)(40460700003)(40480700001)(7696005)(44832011)(8936002)(8676002)(6666004)(5660300002)(426003)(83380400001)(2616005)(336012)(1076003)(16526019)(47076005)(110136005)(316002)(70206006)(70586007)(36860700001)(26005)(2906002)(41300700001)(478600001)(54906003)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:16.1184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 543ba54d-72e8-4927-82fe-08db99116f39 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7031 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_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 Wed Aug 9 18:54:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712023 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 D994AC04FE1 for ; Wed, 9 Aug 2023 19:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234246AbjHITrh (ORCPT ); Wed, 9 Aug 2023 15:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbjHITrd (ORCPT ); Wed, 9 Aug 2023 15:47:33 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DF7213C; Wed, 9 Aug 2023 12:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jEMODrSPbWlwGmzk10IcYZAjqDTzLvMGdnPpmpUdu3HBtmE01Szb7F5Lx/dmI1CEJHXE9plZQG/j1Py0qyHVZaFQ3gHRbeMbgsZQkI85vdaNoCbKnTiEyYDaX1wfnNxnFJn5Ack/bsFA3i86AEnw/l8Fk5MhK1hqE3DGv14Yg7jqa5dgizZ8XZuQ84t+GVm3zjNyI0XrdjvXxGRGojdbV6WqyVBDuM04UFe2coy5bVU4wH3Tjhe66UiYRe3GQ7BC2CK8ld4vOpBdi49ERg5BXMcww4ji4lNLo0/VnlyIZk/VsWizobe6RCtHw8P+WoF915FlHHQPBU8MTKT9YEoMPw== 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=ltXweho05GiwCob3wS96eJfLwH04ihc1KEQTyjCcPilWNxK1MYxzZl6/lxXN2p2o6AL3ki1xm+azdml96mUEQuy+FXZeraDzdPmwAu77gK3vbwWSkIU27TJnuIwzp1sUSONtzeQ6+i+k/FmIO1qIZ4/tTSvotr3acgTFJA7fLY7VA5HclXe4x1kdnNItrFM5XaMw5zqrjhhk9EyfuNvqP6Z2jEdrfnmY+1NSn3Q//5Ak6VKjn1i+1vkluiNHl2w3i4z+edb4y5ZZnksBNVYm6iMrnz36SmGZQbdHlid3wKPeDBZGqG9tKHRuL3iuO53oHKRF/vtzEw9n/TOaIwV6uQ== 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=bj77V9xTLVb7SXRJQE7C2gYMEmF8xvI43p2AG+zh9gqBCWt/BvCRkMl2+kw7dsPWZtkjWIFSfBqnrOb9C4wMGt1calT2Qhs2kpuDEbe4YKYSLzqKcLBTs653dO4VgeHTnN3XZ1ZKviyRAoiC6PkjUdcR0VrFn6m6Qm36LtYqOZg= Received: from MW2PR16CA0037.namprd16.prod.outlook.com (2603:10b6:907:1::14) by DS0PR12MB8218.namprd12.prod.outlook.com (2603:10b6:8:f2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28; Wed, 9 Aug 2023 19:47:16 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::f2) by MW2PR16CA0037.outlook.office365.com (2603:10b6:907:1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:16 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:16 +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, 9 Aug 2023 14:47:15 -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 v11 3/9] ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table Date: Wed, 9 Aug 2023 13:54:47 -0500 Message-ID: <20230809185453.40916-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|DS0PR12MB8218:EE_ X-MS-Office365-Filtering-Correlation-Id: db191310-0d9a-49df-8044-08db99116f77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e4pzeMg9YNld/4TF9I7aBnTfQ8RvLhs9G1wv1VyOJ2tnU53CA3TXY+mLzgw5/pV++7em3rMtSXBLxPquSZEMWDF+ksABpPmfwkjhgW4zvrDREyOL1pv2Kna3lBjynQMMZ7z6wvdQ0s9C92wfUwzPauvxtTAGHONATEl8Mrwd0e32KBvD0C+P8kmNrpPNntLsX67snq4G7hyMayBH9ShK+P7VoPBl4WAfYYyk6ommOZ8CGqeZIymTiVNAtXWw0sYLtVM0ca3ADQJsmcPu+i+12q/7pGtpv/zNNsMv3prfXIGyC+qxfIHuM2m1ke7M76NNAwp/pQ9oaxVGmlCA919pkIn5GwrPbj5RtKeHxEM1QjiC3r0ejEEAb4+lbIw3n/rtfGlKw0iyNpqriMGR97N/+KatoXwTIm9Jmf7Oho6OPdTrPRkX/5dLflm9P13JCxPqH7OCIlWh93QEDSWmb+nHBY+NCFyZiJmaXxHazRVAgZYepDV+jUpxPRdpsQSbFxhQSCzoJ69FHYhYtToCEz5Jf0JySD71B0P5aKz4yjoGmElrz16pYmHpbp14qJfxEMWjSg0MoCnad9k92T6RB/HNpf8/so22BqVvVtGRkOEqYn75VRLHC03TIaBz1++LWvC9EDd/p8s4wG58R9tsr7k1YhiAl3CWO4vp4hYhHa6n5qt0EtkPsU8TwOryG0c3PPBasC+z8Ri1x/kad2/uI0mpMdLFFtYnf9I3EDgWvuPKXtD3FYV2FmMtIoDjwd3iC/Hkf9Pa1F6cAO3GgFtUDc1RxQ== 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)(396003)(346002)(136003)(39860400002)(1800799006)(186006)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(40460700003)(40480700001)(70586007)(54906003)(70206006)(336012)(16526019)(26005)(1076003)(110136005)(6666004)(478600001)(36756003)(36860700001)(82740400003)(47076005)(83380400001)(2616005)(426003)(41300700001)(316002)(44832011)(4326008)(2906002)(7696005)(86362001)(81166007)(8936002)(8676002)(5660300002)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:16.5247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db191310-0d9a-49df-8044-08db99116f77 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8218 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. 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 Wed Aug 9 18:54:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712024 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 B190DC0015E for ; Wed, 9 Aug 2023 19:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234224AbjHITrg (ORCPT ); Wed, 9 Aug 2023 15:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbjHITrb (ORCPT ); Wed, 9 Aug 2023 15:47:31 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B0CE2139; Wed, 9 Aug 2023 12:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jhquoon4val693ZryQIT0oDdTGUqKtBj6Fu9A8+6UmyUwq0WScn5WCg66JJZ9tuWOylgVCmgqvPxu8GtbsOlfE7d9M4gaAYNU9Gaa7PM3vcyegjOnPEUU8YxDmQK8CWgoIej7vewj6VPZU9kdrwUGJUNuzufBb2mi68z2u48P6Xat3XWvoLJ/oukOYHpxZg55p2w6QYIMyRT6SKswQOupZERJMDPcjcrbTEqy4Ocl3TkARBcgXROM/YLRwda8+bgDYgKRfcT6Ipjbp4Z0aIUww/18k1Lt5qyznuat39VlnTyVoGiqnQe5bthkpqtweg8gfqcJo2rrJQalIfFGqzWHw== 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=ZUpD4FS+caM0HC8bqkdc8Ntx7tilQSBPgnMRT9PYdvts27ImZTF8Dq8fLIaRPRSTQKT83vsA5kq/afgGxxAep/jySri/IuaGmGhW5uuRNtrhs7SlBsw3xaOJlkx9p7ra8d16n5dDVvINdb3YA64EvS69x6FRVQg2vUoV7XXkYhyPWJ3+cVxtM+dGWMITliPPs3rAbgknruAxMk1bV5fzSBbkNncKw8QLlK18LHUY0yrqPleNSyRhgTYUJu4xlxt/j9Q33rxAPykzwxpx0vh9wXbzLqXG5hqdiXOlsuxM4unnhJBHrjovap04vAFQXKn6BFlmRAX7DMMn2iyLsr+eiw== 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=KQEzesYCxBPv5ncJHTcvinj9RrJ4Y8Cc7hli6yz+YozeY/9HestACAWNGgB2bQOq5zbxUOFDr8VWL9mmJjcdP/vYthtMHJifuOLXuivnRwymyOzBTpyQjvcW4dbeim2V7rqq1j5bV3+XQAYMiS+u0J3MacNokFZKqyDin0pnTVA= Received: from MW2PR16CA0052.namprd16.prod.outlook.com (2603:10b6:907:1::29) by MW5PR12MB5598.namprd12.prod.outlook.com (2603:10b6:303:193::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21; Wed, 9 Aug 2023 19:47:17 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::7c) by MW2PR16CA0052.outlook.office365.com (2603:10b6:907:1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:17 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:17 +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, 9 Aug 2023 14:47:16 -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 v11 4/9] ACPI: x86: s2idle: Add more debugging for AMD constraints parsing Date: Wed, 9 Aug 2023 13:54:48 -0500 Message-ID: <20230809185453.40916-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|MW5PR12MB5598:EE_ X-MS-Office365-Filtering-Correlation-Id: b11a1106-b242-48a5-5555-08db99116fcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A5ZgVE/vfnAjhGKm17uCC+/A0LTpKG+9kTHs0VqHBC9VuJ196ryt3t/vCRx6RBa7NFK3tH8RrYyPzifbfmAm55d8bzT5C820Ik9RMuvltO861JOD6f28HKCRLsoAmpufYtNiE7XHJ2TqgZiL5XNGVrLDbw/xqHI1Y3ifhz43PnSiWHczYS6buCbOfniNwp8rvLVO3OGzkWq4ZrgvNCFsrcAsWWyp3G2chnyQiJ0RrTMXvzJtxdpYh8MnurF4zq36r4ZIv6FEI2ZT8pEtIaHXxcCaBIFT3YzcfKsqUOib9tkd08dhiXZChnxxe11aRyfuFoizmXuKjbKaahHgDywXY6EmlPkZnj9WHRq2uxiQBpFrDeA3b9kVy9QMyHEec8rlPcyHVkDRCJmnPXle2lqWtnLSEE9vhiUvAxE4XdwaGkXIpXRGfcNJN2E/dXZJTdnJBexjt6mbknUoSKNa91LUJLOXH3HukanGuD2rr4Lt++LDQl6vor/0qVAYyAsrwMQzljn1DQmgLqAt2H2NqSvh1IXUNO62O7WxmsJb19E8b4MqxCE47mRCctxhOG43VsJRuqVSETm0X1WNaX9WP6hFD8ouTwpgqEYgJXNeh7U/Rb8eGS0Y77AxnyEhaeR6lupXtkdGgRlPCEDOzmNKHpxgFd7ttuPruiI6lMd+xDsm2jVnYxH1Qk34OowCoj5LB5Gi5w8d8uxaJ55wMO9CPxhH73oUa5LJEFsDn1BSHRWxM70vKa3ZZi681Gdfm09sOaL06uE7iM8EesK4nmU4nXQ5Vg== 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)(376002)(396003)(136003)(346002)(1800799006)(186006)(82310400008)(451199021)(40470700004)(36840700001)(46966006)(336012)(2616005)(47076005)(356005)(81166007)(82740400003)(478600001)(16526019)(36860700001)(83380400001)(426003)(40460700003)(40480700001)(1076003)(26005)(110136005)(316002)(8676002)(4744005)(4326008)(2906002)(7696005)(6666004)(70586007)(8936002)(70206006)(54906003)(41300700001)(36756003)(44832011)(86362001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:17.0872 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b11a1106-b242-48a5-5555-08db99116fcd 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5598 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 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 Wed Aug 9 18:54:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712022 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 44D56C41513 for ; Wed, 9 Aug 2023 19:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234183AbjHITsD (ORCPT ); Wed, 9 Aug 2023 15:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234176AbjHITre (ORCPT ); Wed, 9 Aug 2023 15:47:34 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2050.outbound.protection.outlook.com [40.107.220.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EF32697; Wed, 9 Aug 2023 12:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L0IeWBKk60jkabbA2igS7nf9luSicGgh6YPvNJfbnlO7xMyIiv/QjXOxBG+54DFhHLToD9CmLJIV0c78vYSMazE5nXU2KPtVqltiMLgxNMkMo0gamB0qvZfNnZ8wAgAKSeTiA5hOyfEvxq9nWGZM74Tfzpw3YoEYqfkL7sKI62Fajka+UZH2NV2Mgx//Mq7qAqymKUDhcbunrlyCk54vgVIU/OYpG69PEgRvFldUFBVIremITaX4zfG/U8SS4FwNP+1H4V4mQTBF/aob2QxTqrA4PQaxsMKrH4RUdGqLj1l96Krwqv1XBz+M9F/wAzY9eI20xfNvrm4Q8dg1YVOcPQ== 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=QRFX8XvWvfAbMOsGqkNVmiHiHYxztU6EJciZdRNeJlZPzk59JwYyKlUv07kgVGbxiEVlLxpDDBXnrqWH0K36jv26jbykXMits6rZn/P8pAooznAa/T8yvBoGxq54CwjspTuFp8V6a8TgNK1p95zo0GsRo5pehb5qtZ2R7IaFUyuLDiMu8gGbKRHHTtwpWZNnYa6/UtiSpndqQUXT5W/pc2CVUW4VDZATw+rqmEaAbF6umt1EAplM7X7EweDqSOQZXlBIOi0pt44mdUmTXzrfRdgOO6/wRz+AZ7rdc0nNTqGNLCFcswAJWlFU13inSiZBa+NircT2VuR3k3wmG4hyzQ== 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=mDtXHnKeqG30YRh8umoToKK1+ykpQGE61njbZNVzfGwQEWLnANfYFMRZqhkT8vBmGCLQSmHaNQ1Wqt1k+f2XrM8o0ZY9ND4rX0hwLYrpIcImVoN+nhZr59IGTjjsXnIyJdQ/+e0ReQW1NCVteRlSKeWuhWbJkDGyzizxkbCD97k= Received: from MW2PR16CA0053.namprd16.prod.outlook.com (2603:10b6:907:1::30) by SJ2PR12MB9191.namprd12.prod.outlook.com (2603:10b6:a03:55a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Wed, 9 Aug 2023 19:47:18 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::a2) by MW2PR16CA0053.outlook.office365.com (2603:10b6:907:1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Wed, 9 Aug 2023 19:47:18 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:18 +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, 9 Aug 2023 14:47:16 -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 v11 5/9] ACPI: x86: s2idle: Store if constraint is enabled Date: Wed, 9 Aug 2023 13:54:49 -0500 Message-ID: <20230809185453.40916-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|SJ2PR12MB9191:EE_ X-MS-Office365-Filtering-Correlation-Id: ac39a05e-f0e6-44c0-3abc-08db99117074 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eJGCtlU0s4N2PHGwAT1RuDTYPIQUW91BywdC2KnGiDEin9lvZFua1O+T/yuwYJR0Xce7ZUAigN4T69WS3qqZ22tw4TU9sLF+q8BZcR99N0uM21WH2Yu87TW0PPSe9pffz+bMgQ9KG+ZIvd00V/zOjHGKFa48qOYqlsqBapgzeA6cG21EWqe4cLH0k09lH2UB07ADMj5kyV1vY+T8w0q3hBcCNijffgzu6iG/nWngvylUjGx6Uk4YMG0Vpfc8fCkP9JT98DSnr4ForZ69rZE7nIGjlhKJgRK5sb+tu4rJheENZmnmzA6f3eM8lszyWH22iMlzqw7f2hGRfxGiJIUsiOnn6kexmndv+DWEJCodoKls5++dmyYZI3cFR2tZNBrbqtD6n4SNzHaCC0LM7H6hOtxKj6ammUbGvPrN3IoYKsrX6d7/U9dtZI+KaMeN11d1E5MBoFsAlgB5UZRw2dJdl0VDDkOnGBN19S5DHy9/25AXaEFtfVEDm+JDg1zWeXbvYZvXo9iaceI+ByM0/WagImB0tPn66LX3/NuX6toX8/2DxjK19XacHkBRxYD1sjdZEpU05d6tlgwv344K+OyVxhokCUO0j1Uli3l+AcgOZnDrLKyr8tV0Ivr8LhemFM6tcsK252j9MazfczRLvJxxHY22Y6F3ikTR6fbbq0EVQk62XOaE76Qd0HuskBUjsDUZMW0rUei3dNP1dTqePuvSDPWwNqL2XThN/abXM6eB3aCv5thE77gWtn+nGD77AHknDIDDvHcrDKLidWK6cK2sFQ== 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)(376002)(136003)(39860400002)(396003)(451199021)(1800799006)(186006)(82310400008)(36840700001)(40470700004)(46966006)(478600001)(83380400001)(81166007)(7696005)(6666004)(2616005)(1076003)(26005)(82740400003)(54906003)(110136005)(356005)(70206006)(70586007)(4326008)(426003)(36860700001)(16526019)(336012)(5660300002)(47076005)(8676002)(8936002)(40460700003)(41300700001)(2906002)(316002)(44832011)(86362001)(40480700001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:18.1810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac39a05e-f0e6-44c0-3abc-08db99117074 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9191 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 | 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 Wed Aug 9 18:54:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712708 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 9401FC0015E for ; Wed, 9 Aug 2023 19:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234210AbjHITsJ (ORCPT ); Wed, 9 Aug 2023 15:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234207AbjHITrg (ORCPT ); Wed, 9 Aug 2023 15:47:36 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539AE2700; Wed, 9 Aug 2023 12:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LLhSdSVQkAD+V0r2DokewZ3/6TseT2B21zbWpIMmQ+N9doXeEWQv86IKTTBIlyEuHGvvxQuMXpNafANngqIB0SjXCOK9u8J9xc364XNg5dc7zA+LaEWxSi+ipZSZf052uM7G0pTs89v5CJ25bpXYhDsJGA8rBD3hj7BjthkLobc/DwTWvVJcI2jHzJs0mJVABVcf03UGr8gAfLDBqg2gk9SGPOYTMbwjEGiJ7fCDPKQLHdtoHUFzLoIAN3un0/91R0DGpznnpGPFApSNVcEtQQsFUF4ZYOYKSdI+fvfHKfhNHBYAtSk0AmtCNDU12NSlVspOMFMSQTfsVoEAyHGlrg== 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=oH/7AXLzjMdD5jno6+fxGPxW2Zv403s7qkNoP9TuH3mUmoPbHhfGKn05onRFW7LOLZH81DB5siSrlPSVrLlk1Ts9GxncsZPFzPwC0+w/k5cUkvYfjCGH/LtDIUiUqwnCUB42QavHsi0Wrdf0jkjrATGwakhpZDbDCT8wXb+PPR8BaPrDTwW9bCph4LYQLn3JVFKoxpwaIRuG6//HBMDzJRwzgEYbL26IZV4y6dF1Z3sQTh4zPfoojbyoUMI9d4+mDsuuTM5ib2Fs5q5+vsMVkZEhBl99NksnFL1b1Lm5FORxepNrNcJGhtRUBPWD9smel0kA46bggfaB1wH2QHQbLA== 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=UE/uKpJGXJvkz4vZ1K3BSmH2veH2jsZoNu5SZrQthCqGDJ8HDdVCX01RmcWZzw/kVNnT0TvaCfFW4Uah28nG0ocvAqLGPgd31CinlSbrZqJa+gyt7EBPgrSMf+t8JmDlq4d6PBgMG6IXqAuTz8fnkNcXHBVESemtFT1qdu4bKKc= Received: from MW2PR16CA0050.namprd16.prod.outlook.com (2603:10b6:907:1::27) 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.6652.30; Wed, 9 Aug 2023 19:47:21 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::1c) by MW2PR16CA0050.outlook.office365.com (2603:10b6:907:1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:20 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:20 +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, 9 Aug 2023 14:47:17 -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 v11 6/9] ACPI: x86: s2idle: Add a function to get constraints for a device Date: Wed, 9 Aug 2023 13:54:50 -0500 Message-ID: <20230809185453.40916-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|MN2PR12MB4189:EE_ X-MS-Office365-Filtering-Correlation-Id: 03d15408-ff37-43f9-5290-08db991171ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uYO5J0LkAdOWnsWp0PbTIeU1jkfMEt4DfvMGwpPcVZMWTdSGUkfYDMNy2BztJyTbF17A2hOfmdopkxfHBGpuYCnGSC5kHr7B9sdK7yiA3/oX4t+ekC6TvkLwInL1dvs/kAfF6TyC7WAEXx+WU/BiVpmDDPuwO2kJqX4DM1F9f/Dord+Z+qb1ngklfE5sAmDNrjqREaoWG01JqHtuyQ4bYNZSsPCsRi1EsulOpJ2jPHN9vJOtc2OFeQ0Vbx6iMGUZBbOP5ywlyiEK8eKjJCMVx/Ke9i2pTnwtp3TieLj6JnDM9BTG1JjyrSFI4c5nGUXJGzGXg8LuXP4GMt5By7oV1qJ9jph3ISzRKsKWm27GtFNeW4kq40LxWQYoZaU/xNVfYg/aGPnqrbHIG5919ZnaIztLYQd4cAB2Z7WK1ncMK+nfi6rg8ituXzI4CSYvai+FwAZHJQl2EgzQ8proRjj3KgYlYpSk3epktt8UxdWDv1vakv0RVIgnT5bbskZ8CvW+1jUlhthYjDx+1pqaUhaZKtOBK9eGXuSYvQr9xdmzEjq27QFmVowuiz2kUYkmBYSOOk+sbvzun+kBH6t7/Dol/l27avGWcgJc4DAByUlS7NMvInRPXEizbrwZUlXBsnIhbqxpQc41sPoKjZl4HzGo9pFIsGA+UF7J1rk9UHrx4IvV/3OdUdTdZMiEgnCup6mHIROPNMSvMW6as3+SvP1aEF6mP8u9oHcg9CeA0U0z1xLgBMFjXJCxNUPTmATGBhrCu+enMZs5N+puf38R6YfIOQ== 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)(136003)(39860400002)(396003)(346002)(1800799006)(186006)(451199021)(82310400008)(36840700001)(40470700004)(46966006)(36756003)(478600001)(6666004)(70586007)(70206006)(54906003)(26005)(336012)(16526019)(1076003)(110136005)(7696005)(4326008)(2906002)(41300700001)(316002)(44832011)(8676002)(5660300002)(356005)(82740400003)(8936002)(86362001)(81166007)(47076005)(83380400001)(36860700001)(2616005)(426003)(40480700001)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:20.6654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 03d15408-ff37-43f9-5290-08db991171ef 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: CO1PEPF000042A9.namprd03.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 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 Wed Aug 9 18:54:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712020 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 DDBD1C41513 for ; Wed, 9 Aug 2023 19:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234386AbjHITsT (ORCPT ); Wed, 9 Aug 2023 15:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234238AbjHITrg (ORCPT ); Wed, 9 Aug 2023 15:47:36 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48EE82707; Wed, 9 Aug 2023 12:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RFR8IxUhGxa8tAllbZMoDACl/rO6CdAYvc2pxLa4YrnXXQ9TftkTBJI/SxeWy3Y14CGpvvwY529ljdg3Rk40XPfj7Wy2wqBbi6nQN0+UhOajP+qrsdwn9nMykwQXVZTZnGmUbnq3/gK5reElAOYp66Qz4hbxNPKrjq4Jhj9MHQXdJ1VIJ0OCpuw5YuZJpwzCaLvJr1bZ5BNjd5ltK1MENK5s9h/xDh5hH5du8hLHuTfk9irzGbtF/S9+/qOLoT6agp61YiK4r6x2CM/OgMaE/0N+tkcG2EY2qDf2LN8YOoL03q3cFyZGwx0Xzb47KZxTrgZPvdL2HeQfPb5pjNm53g== 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=p8t9dWr3SYEGcReSvoWYqCJ1XUDQSml1FxGQjktYRqU=; b=KCg0/rYopcrFNXgMeSvXevcvrgRqUy+X42Ig10/Br/J9krqnG6Hk8N4uq1fTR6DpX/rm/f1t8O5yKLNmLrF+XIg617NzTt++PItU+CipLlHY1z4GCx6r2Uy11tVhS4QUHNZSmZ90dbrXl3sK7B25T4MC4Yn8G5imlAW71HxI6ytwgl3zBHIyqGZpXGdNAczrN5VnGJGPdq6dViQ8dmnR7VQh3nlXHR9Bf2OxZU8JpDqxWAGX+qfB04ELm1vSe5juQYV8UoTcfDYRqlvDecbOFTOFExx2L/7i9a/ucdDrGKxXexyHwI6uYURHmXYbbMJr2prfGw4TFwLNUvgYeikEHw== 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=p8t9dWr3SYEGcReSvoWYqCJ1XUDQSml1FxGQjktYRqU=; b=H5L5B/FKPCZ/8xeds+gs0eQKvgVWP4Xl6uo0lxNRIL+qCM+V1GGCsXmHoTOFdxIWFZ8h2VqyPdmg4ROnEKyPlFHb4IkEd9dKlJs4jGwQ+K53KBq8pFjPR0PVnv+JJ4rpsYheXEirG3L6vwKZWdrCw6LR1NRFDFmu/KXm13Khhu8= Received: from MW2PR16CA0048.namprd16.prod.outlook.com (2603:10b6:907:1::25) by CYYPR12MB8749.namprd12.prod.outlook.com (2603:10b6:930:c6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Wed, 9 Aug 2023 19:47:21 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::6f) by MW2PR16CA0048.outlook.office365.com (2603:10b6:907:1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:21 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:21 +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, 9 Aug 2023 14:47:18 -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 v11 7/9] PCI: ACPI: Add helper functions for converting ACPI <->PCI states Date: Wed, 9 Aug 2023 13:54:51 -0500 Message-ID: <20230809185453.40916-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|CYYPR12MB8749:EE_ X-MS-Office365-Filtering-Correlation-Id: aa3ec20a-7055-4942-9ce9-08db9911725a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TGipiBgWgACHlqu8io5shbGvJMuSwdJ6BsK+GVGnfqD+it3l1rGyp1ldCOjjDwTT5nBtfGyC5otXvafpivxC7Ri0ox54jFjzhjxGhUG7nqNZdtiFe5JZytBb5s5jNyJBu3GU3aWXnq1EEKAfOLvL1ZF2O0JXba1sVqdIA0+OzBD38Y4mZ4QSy+0OcfGYjnd6+64lLkFAzaVpiyPZmQ9ul6ccXrlXKtOlo8yUg5agstCphZuKuNTRcFrzmpGm3a7gfvGjDxNrhLpl2F1WohyJ8bhEWOf9mDgukpBBeuUK2pOHaXPSEsC/J6Iici9GgSlakIFuzobdHw6KevXDJLTtm/lqMies1UxDn1N20htY5hblb07FmUFiqQ7MaM/cViDizY8vvhp66khzLtvjGEyw62FLVHBB3ARRe7znA1dzal68e4d46WpR6EtXTW4dZHV0QW6r4QPwWldWaLn/z1NBaeSg3znTh7YXfIbYMHduwx1g+JDiIzwyaiAalLYU3qfXlP+Sw7VT+ps3dCCK3N61FCN74PVof52rM1f1awEgyY6WrqOiGT7WPXolCo2bD0/VoBrDJ+xPMzFIe2pV+aJmBfPptXl0PtnIWad/MRQvZI94lO5CBg1UMmuTaF48h8XUVmLQ5dCgI+xtSIsSKtrgFN7qD6Odw4w8bwAQy0Q5EPmrJqtVHLe4U8/UiTE93RtwUjHjMpYWizliZF++Br2OgHt6cN6zKu101NTYJ+/8hf1JKDCR9+1ETHqDaPO0oFOUQqruKgHhFv43vXGsz8S8UA== 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)(136003)(376002)(396003)(39860400002)(451199021)(1800799006)(186006)(82310400008)(36840700001)(46966006)(40470700004)(356005)(7696005)(36860700001)(86362001)(478600001)(2906002)(36756003)(83380400001)(40480700001)(54906003)(110136005)(81166007)(70206006)(70586007)(2616005)(4326008)(82740400003)(26005)(316002)(41300700001)(47076005)(40460700003)(1076003)(16526019)(336012)(426003)(5660300002)(44832011)(8936002)(8676002)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:21.3685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa3ec20a-7055-4942-9ce9-08db9911725a 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8749 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Several functions do internal mappings in either direction. Add helpers for this functionality. No intended functional changes. Signed-off-by: Mario Limonciello --- v10->v11: * New patch --- drivers/pci/pci-acpi.c | 87 +++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a05350a4e49cb..b5b65cdfa3b8b 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -884,6 +884,56 @@ acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); } +/** + * map_pci_to_acpi - map a PCI power state to an ACPI D-state + * @state: PCI power state to map + * + * Returns: Corresponding ACPI D-state, otherwise ACPI_STATE_UNKNOWN + */ +static u8 map_pci_to_acpi(pci_power_t state) +{ + switch (state) { + case PCI_D0: + return ACPI_STATE_D0; + case PCI_D1: + return ACPI_STATE_D1; + case PCI_D2: + return ACPI_STATE_D2; + case PCI_D3hot: + return ACPI_STATE_D3_HOT; + case PCI_D3cold: + return ACPI_STATE_D3_COLD; + } + + return ACPI_STATE_UNKNOWN; +} + +/** + * map_acpi_to_pci - map an ACPI D-state to a PCI power state + * @state: ACPI D-state to map + * + * Returns: Corresponding PCI power state, otherwise PCI_POWER_ERROR. + */ +static pci_power_t map_acpi_to_pci(int state) +{ + switch (state) { + case ACPI_STATE_D0: + return PCI_D0; + case ACPI_STATE_D1: + return PCI_D1; + case ACPI_STATE_D2: + return PCI_D2; + case ACPI_STATE_D3_HOT: + return PCI_D3hot; + case ACPI_STATE_D3_COLD: + return PCI_D3cold; + case ACPI_STATE_UNKNOWN: + return PCI_UNKNOWN; + } + + return PCI_POWER_ERROR; +} + /* * _SxD returns the D-state with the highest power * (lowest D-state number) supported in the S-state "x". @@ -919,19 +969,7 @@ pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) if (acpi_state < 0) return PCI_POWER_ERROR; - switch (acpi_state) { - case ACPI_STATE_D0: - return PCI_D0; - case ACPI_STATE_D1: - return PCI_D1; - case ACPI_STATE_D2: - return PCI_D2; - case ACPI_STATE_D3_HOT: - return PCI_D3hot; - case ACPI_STATE_D3_COLD: - return PCI_D3cold; - } - return PCI_POWER_ERROR; + return map_acpi_to_pci(acpi_state); } static struct acpi_device *acpi_pci_find_companion(struct device *dev); @@ -1056,13 +1094,6 @@ static void acpi_pci_config_space_access(struct pci_dev *dev, bool enable) int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) { struct acpi_device *adev = ACPI_COMPANION(&dev->dev); - static const u8 state_conv[] = { - [PCI_D0] = ACPI_STATE_D0, - [PCI_D1] = ACPI_STATE_D1, - [PCI_D2] = ACPI_STATE_D2, - [PCI_D3hot] = ACPI_STATE_D3_HOT, - [PCI_D3cold] = ACPI_STATE_D3_COLD, - }; int error; /* If the ACPI device has _EJ0, ignore the device */ @@ -1089,7 +1120,7 @@ int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) acpi_pci_config_space_access(dev, false); } - error = acpi_device_set_power(adev, state_conv[state]); + error = acpi_device_set_power(adev, map_pci_to_acpi(state)); if (error) return error; @@ -1111,23 +1142,11 @@ int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) pci_power_t acpi_pci_get_power_state(struct pci_dev *dev) { struct acpi_device *adev = ACPI_COMPANION(&dev->dev); - static const pci_power_t state_conv[] = { - [ACPI_STATE_D0] = PCI_D0, - [ACPI_STATE_D1] = PCI_D1, - [ACPI_STATE_D2] = PCI_D2, - [ACPI_STATE_D3_HOT] = PCI_D3hot, - [ACPI_STATE_D3_COLD] = PCI_D3cold, - }; - int state; if (!adev || !acpi_device_power_manageable(adev)) return PCI_UNKNOWN; - state = adev->power.state; - if (state == ACPI_STATE_UNKNOWN) - return PCI_UNKNOWN; - - return state_conv[state]; + return map_acpi_to_pci(adev->power.state); } void acpi_pci_refresh_power_state(struct pci_dev *dev) From patchwork Wed Aug 9 18:54:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712707 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 1ADB2C04FDF for ; Wed, 9 Aug 2023 19:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234153AbjHITsU (ORCPT ); Wed, 9 Aug 2023 15:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234240AbjHITrg (ORCPT ); Wed, 9 Aug 2023 15:47:36 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2048.outbound.protection.outlook.com [40.107.223.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C269210D; Wed, 9 Aug 2023 12:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SG/V6ZrxslfLLJYzmfaRnLLMUtl082REVAp/7MZ0xTtGj1O5GhNHvi+B6GnpsWBzRolew01VnTm851QaCsLphLLXa88Q8d+k6cnyeUCIkKriDD9NQkOMedz5oxsHJQefqxIKbEaV1D3rmHOW6mr14TMHWA7wlXZadG8JuSuflB413xe1wfttogROMI08LH0Kp5Tk17xJ3Eqwmn/o1ppw6I5ebhmyHfR6hj7QlsQdoajK+b1wsyUIAQ/wRYtmXnunB1v4HKYXhG3JoV2WzZgwrBHtKUDHKa+YFG2b2SiLvOQVPmZc5LmV1zGnFrMqNXa1+BdDCwlBUvbhWLukkdxlgg== 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=U7IljWi8fyJCaKaHKU70C/9A6XxwrDPhSFrCKPfFtKY=; b=WO67AGQfg1g2mZqBe5VhseRg/RkxRMhbfexNJDxxxmoZRHLt2Rkk7zX82q52C9Lyy0qbj6xET1h7jPuYDg7RFGGlzJDJ/ouvhu09KRkInmTsIw3wiRCNlBDFc89TxweZZxO5WCJwk4deLlmYjQSnv2oWvXmYAaRg6fkXdS2mFVsUhAvN7oXR7Qx6NGeHb4NXtIZRvJghW6X7/s/NWDID/AHN4MvFVFdoFx9NR+hI0MAjWeJocBufe71L+wo/nUn19lEsG/KBLSUQJfB2OtVvRONjNjl6DTiNiogRwIx5EjRmXaCmxCqW3Oqi6njXRccuXcpvwcHAFQScQtqQFoM9Ow== 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=U7IljWi8fyJCaKaHKU70C/9A6XxwrDPhSFrCKPfFtKY=; b=46VVImrOUqrOszIcJMllAyK9grmcjgup1j8pV7pSrWk82E89j5ZJHV+a61ps+nvsWwwoYtZ8cr3MiLLVXgYs2GEJY2t0W7t7zeoE8B0tXoavI4mlp/OOVY85cw0NoOzhLPxOnriO5QucVEXVDaS1r7f5kcybkFFDYbWgXLx/Hgg= Received: from MW2PR16CA0057.namprd16.prod.outlook.com (2603:10b6:907:1::34) by DS0PR12MB8342.namprd12.prod.outlook.com (2603:10b6:8:f9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Wed, 9 Aug 2023 19:47:22 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::74) by MW2PR16CA0057.outlook.office365.com (2603:10b6:907:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:22 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:21 +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, 9 Aug 2023 14:47:19 -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 v11 8/9] PCI: Split PME state selection into a local static function Date: Wed, 9 Aug 2023 13:54:52 -0500 Message-ID: <20230809185453.40916-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|DS0PR12MB8342:EE_ X-MS-Office365-Filtering-Correlation-Id: da5aeb87-5ed5-4666-71f3-08db991172b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YVkYUY8kmZ/BydUO2qrjjIWDdSxd+kaiCeriLKumzdgWf7wW3mtUkIwyY5L/ipSqzKXzkgv38c6ghclQ8k3XIP79vTIM45LOS1l0Z1Qtr+bA2Vas9txE6pwooMeoG1UDfsplsPWNUa0ZH92gqodXQDHvC+aQplIa3h8G0FE7mqoWAlNEI+O7PaAW1njO13kotlN5VH2rODNZFsR6VPkDXYNIM1AaHO4dljcIfRb5axl0S/zE5195RuVUBZ81TIVNJmTVchUCY9qpQ+k9ZQvnj2tNue62Z8H7pkeJaf4RapLlrHKlDi81Vu+UPZ8zak40x60u1vbBg/ziLZSsxnBpQuEu6aoAKffItN5Fo3+UL33JyoWE52zoT49FayplzuImFx66xW9tSHXJuh6NdJbz+AY/BQ0+tHvGfG4OWfIq4mW3kjcUnVbxqsw1K9gAzV8hiPOnPDaJkDV4LNP5wzD09ydbpJ8kR0fmygf+mbzAl3C7IwdjMedm+cByScMks/omqOhtat5XqjzpfRN0eeqnpcEthT1Nb2wS4eCJqvP9jIt+QWfh467C/Wyl2RcZwmF+NNXi9S/ubfLbtZMdg0JyBTVzsYlFw6VOk+TVl+TQy75aU3PfiORwXjBWLmDtUWsOenKlg4t5+Z1ryElmVAO6xFd3BSJCH0YeyZAV4Qy+79O4/DODSl2KJUCLs1ddbyO1/p++y+0BbSuc9+Dg+1vgGRfpPKj8pOt6/Y3thQNfF3pJsHr9nLsyBimdvbFVkqUKbrlF2ax9Xu3dbZZ35alcCw== 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)(136003)(376002)(396003)(39860400002)(451199021)(82310400008)(1800799006)(186006)(46966006)(40470700004)(36840700001)(6666004)(7696005)(40460700003)(86362001)(1076003)(26005)(40480700001)(47076005)(426003)(83380400001)(2616005)(36756003)(36860700001)(16526019)(336012)(81166007)(356005)(82740400003)(44832011)(316002)(41300700001)(8676002)(8936002)(2906002)(4326008)(70586007)(70206006)(478600001)(54906003)(5660300002)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:21.9310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da5aeb87-5ed5-4666-71f3-08db991172b0 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8342 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org When a device is not power manageable by the platform, and not already in a low power state pci_target_state() will find the deepest state that PME is supported and use this to select the wakeup state. Simplify this logic and split it out to a local function. No intended functional changes. Signed-off-by: Mario Limonciello --- v10->v11: * New patch split from existing patch in v10 --- drivers/pci/pci.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 60230da957e0c..693f4ca90452b 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2660,6 +2660,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 inline 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 @@ -2701,21 +2715,8 @@ 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; - - /* - * Find the deepest state from which the device can generate - * PME#. - */ - while (state && !(dev->pme_support & (1 << state))) - state--; - - if (state) - return state; - else if (dev->pme_support & 1) - return PCI_D0; - } + if (wakeup && dev->pme_support) + return pci_get_wake_pme_state(dev); return PCI_D3hot; } From patchwork Wed Aug 9 18:54:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 712021 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 B4D63C001E0 for ; Wed, 9 Aug 2023 19:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234361AbjHITsS (ORCPT ); Wed, 9 Aug 2023 15:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234089AbjHITrg (ORCPT ); Wed, 9 Aug 2023 15:47:36 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D32C2706; Wed, 9 Aug 2023 12:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aj5spEmeXGp2RpJ93ybJko6IZg4t4TxlfUReSyeSSlnND1m/Z0IARsNzTBuJi/R7n93aiaXx8wbqASCr80Fc1N8Lq7AZVLYjJ/jFapzgqYlRiJ2lR3mxQx6OBHQPjX0KILIQuSjFuff6JVyn9/PGIJKU83hR85apUOoKwMCTyKVKgs2Qe6586r8ISb0D9wHgy2rF1aNyDdG++JdUN3RxFUt26uV1R5vCXO1N7k5EF8F3xU9AiHWYsM7l8uBy0XgMy4bnPJnc/aNDpS1hsQRshVVMEUxK4lHjqPcFJyEaJU3pWCctaV6CkF6XfChM9ydafF+r1rihTcLzsvq4w2XyfA== 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=v4GfhYTjADv/+HmXUdgNqQPK/J5d9hVs6Fyt8og/gwI=; b=B5eTgZyNaxGiv+qAhOKup/KVEUamIwh+2+Pn9KoB0GmnmX01+6+VOudU8odglzZynDF07lLAdaGJQMBsgvXV9Hnlr1OXhXmAsPpK9DSOujhPGdM45euBo/C9DKtPwhom824KCiJhYh4giHozspbADnx/pC6ZNlL5wrZmm2QxxnICAGrNbLDnHIOYbjKkx/MU2KxQkCb6T7PmjA1zV1iQfR948sGf8+92ND/TVg7igQoFIotv7jTk5cfHbuXRuTPrXGVEgquGQOZpi1+nb18iTsXZ7ckZlRKUY46gdgOo65jFRYWVp4KMwz66zireknD8XrPAZq/Nz+x1FKZsPFWF1Q== 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=v4GfhYTjADv/+HmXUdgNqQPK/J5d9hVs6Fyt8og/gwI=; b=yW1KkATkOp7Cd8XAPvKbqYya49VZg+nUpBZHW1lh77PAeLATyruWG0BUzSfCZ5j0FgviUmMVkGwDok42MajRSKNY8GsRhNMx/dWDnxj4cFYNStvLq4wq6i0JDMggfGYTd4zlEYuOtmAoPxNTP+QIIkED4wzqAsD4eHgCEHcSzmc= Received: from MW2PR16CA0046.namprd16.prod.outlook.com (2603:10b6:907:1::23) by CY8PR12MB7515.namprd12.prod.outlook.com (2603:10b6:930:93::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28; Wed, 9 Aug 2023 19:47:22 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::b9) by MW2PR16CA0046.outlook.office365.com (2603:10b6:907:1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.28 via Frontend Transport; Wed, 9 Aug 2023 19:47:22 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.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; Wed, 9 Aug 2023 19:47:22 +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, 9 Aug 2023 14:47:20 -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 v11 9/9] PCI: ACPI: Use device constraints to decide PCI target state fallback policy Date: Wed, 9 Aug 2023 13:54:53 -0500 Message-ID: <20230809185453.40916-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809185453.40916-1-mario.limonciello@amd.com> References: <20230809185453.40916-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: CO1PEPF000042A9:EE_|CY8PR12MB7515:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d59cd24-ddcc-41d6-6e19-08db9911730d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hOX3ZvHQ+i/ele5Mpqe7xGQDQotTJeb8OYt352QdUGF9VHIWDFRQJiFaocVYS1o+zVbSuJNXi+rMWHY6t9ssp5hMl0J5Rq6kkQAmxolFc+fpqUA1i9MkOrn7jOA74HDq16ePSVoA3JbwtRvsgSX1Ce3/Bi9PrMhCtv/hIQL547jz8TqenokwBqj975g/hFyv7u0a7iC4yHAEt2pfSMCo0bizQFr8KBpFaMP+1Fb1nX4W1yHkNko+J5r1jNUthppSiQoHg8TLPZfKJYKvf5BxF32CktJWC3m/qVmL2nv8n0PLNQZtloav8OhXFcPbwnrVNFNlFoSe7oZryS1WHwdnmRxficr1p4QHyAjVyAeUFhGigo9fcMyEKFA8uq4yD9s8GgLJl67xgcM3vmt5tYfXdLQBlLyivKKwtdAchKpSzZcc9vdgS+lvvconbM1ZQF0z03AhW22AZhpA9pYf0GgQrNLZlb88EVTADsLnHyqw/uF+Y6ki0wmWB48SokZznXcNLorQtuzz1KNK1mCfcp92ubinSj1zyR1IALXQzMn7VAbtUgIiEUz5F7NPJdcls+aPAXIjwTG5jXoIgKer/83QkFOtT2oHFmPjd0cjBDxeV6LPw1rbOUh2rgNKybhpDKGxstWEVhGqVBa2wFefwm+aqsQRIaEg4v0A2jfpZ92Pc6uucHaNVGKuTXxwTrQh54rnTqd+I0XQqQ8xq3PO0xrhbFdOElFoZlTkO1VWtfLd11l2i+KdnNr7mFpkQ2dr9wJd3qXZBgoLZRDpoPZopyzxKeWrKZdXOGbu8Vzn1h9nwDg= 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)(396003)(136003)(346002)(376002)(39860400002)(1800799006)(186006)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(44832011)(316002)(8676002)(8936002)(5660300002)(40460700003)(2906002)(81166007)(356005)(1076003)(82740400003)(26005)(36860700001)(83380400001)(336012)(47076005)(2616005)(426003)(16526019)(36756003)(41300700001)(40480700001)(966005)(86362001)(7696005)(70206006)(6666004)(70586007)(4326008)(478600001)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2023 19:47:22.5404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d59cd24-ddcc-41d6-6e19-08db9911730d 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7515 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. 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 --- v10->v11: * Fix kernel kernel build robot errors and various sparse warnings related to new handling of pci_power_t. * Use the new helpers introduced in previous patches --- drivers/pci/pci-acpi.c | 12 ++++++++++++ drivers/pci/pci.c | 17 ++++++++++++++++- drivers/pci/pci.h | 5 +++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index b5b65cdfa3b8b..9f418ec87b6a5 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -1081,6 +1081,18 @@ bool acpi_pci_bridge_d3(struct pci_dev *dev) return false; } +/** + * acpi_pci_device_constraint - return any PCI power state constraints + * @dev: PCI device to check + * + * Returns: Any valid constraint specified by platform for a device. + * Otherwise PCI_POWER_ERROR. + */ +pci_power_t acpi_pci_device_constraint(struct pci_dev *dev) +{ + return map_acpi_to_pci(acpi_get_lps0_constraint(&dev->dev)); +} + static void acpi_pci_config_space_access(struct pci_dev *dev, bool enable) { int val = enable ? ACPI_REG_CONNECT : ACPI_REG_DISCONNECT; diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 693f4ca90452b..567443726974b 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 pci_power_t platform_get_constraint(struct pci_dev *dev) +{ + if (pci_use_mid_pm()) + return PCI_POWER_ERROR; + + return acpi_pci_device_constraint(dev); +} + /** * pci_update_current_state - Read power state of given device and cache it * @dev: PCI device to handle. @@ -2685,11 +2693,13 @@ static inline pci_power_t pci_get_wake_pme_state(struct pci_dev *dev) */ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup) { + pci_power_t state; + if (platform_pci_power_manageable(dev)) { /* * Call the platform to find the target state for the device. */ - pci_power_t state = platform_pci_choose_state(dev); + state = platform_pci_choose_state(dev); switch (state) { case PCI_POWER_ERROR: @@ -2715,6 +2725,11 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup) else if (!dev->pm_cap) return PCI_D0; + /* if platform indicates preferred state device constraint, use it */ + state = platform_get_constraint(dev); + if (state != PCI_POWER_ERROR) + return state; + if (wakeup && dev->pme_support) return pci_get_wake_pme_state(dev); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index a4c3974340576..410fca4b88837 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -707,6 +707,7 @@ void pci_set_acpi_fwnode(struct pci_dev *dev); int pci_dev_acpi_reset(struct pci_dev *dev, bool probe); bool acpi_pci_power_manageable(struct pci_dev *dev); bool acpi_pci_bridge_d3(struct pci_dev *dev); +pci_power_t acpi_pci_device_constraint(struct pci_dev *dev); int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state); pci_power_t acpi_pci_get_power_state(struct pci_dev *dev); void acpi_pci_refresh_power_state(struct pci_dev *dev); @@ -731,6 +732,10 @@ static inline bool acpi_pci_bridge_d3(struct pci_dev *dev) { return false; } +static inline pci_power_t acpi_pci_device_constraint(struct pci_dev *dev) +{ + return PCI_POWER_ERROR; +} static inline int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return -ENODEV;