From patchwork Thu Mar 10 19:17:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 550942 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 CF807C433FE for ; Thu, 10 Mar 2022 19:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343513AbiCJTSi (ORCPT ); Thu, 10 Mar 2022 14:18:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343501AbiCJTSe (ORCPT ); Thu, 10 Mar 2022 14:18:34 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2064.outbound.protection.outlook.com [40.107.243.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467A6391; Thu, 10 Mar 2022 11:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yu7+rsRgyVwj8BeK2mTD40ZuQ/TLcMlVaj0ZajsD86cjuU206WrmKGe6Rq64uKDKISwpSmcf1fbrsOl1f4G7BYmgqiYH2N/knpONfvT9kXrptqFa/XzdxszVXrb/LyyFTxDFtedld3WBX9fQ/JODn2C9s/MF5JCDT9NEehbAqeGW9ktJSpd0c1LpetAlXc4eoHT7fdPKPS6Sayd3iJ7jt0uVoT4ewMesUef4JG+klATxfFQsSZgkTQWBQC3wEEZgpbQwg6uTLiS5fFvTH8ifrqG97H/xQOH8jhqg5RxqYklsR0SiSZURT/Bb3JBmOE+cNTl/uYKZ0H5RhbgCjeioCw== 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=9UVPXHj1MbkdL9mkUZ8PKoQD87dvYue0soenZ1PHc2M=; b=WhsS5nyvKUmzgwxuZJWPQMMo0rgLTidTmSHSsFQDuyFFVN/IIRNIBMRos3zGWG/Tf0MXRfYfrZC1O7ggeQYWBukLd26w6chb3HJGOL0I8MvFKoxZJSsgR5qeWSJpOyndShsDiEMpWJaHGlEO5O9H1Zy/tJIZbBWFUV+HD1RoSUnVvn+2IPMRKngsBfXDr0xPeDM0L6xs52cpMu2T7c+tSB9tpLZ54UnGH7p+DudgzAbWAf8chzSTK3y15K1EKKYoXnfEAK9Qbu1WuGyVKxRBEaCJihuDE6yayQalVbRDQe6dGJtRKaJ2HZH7tIOaGo8MNQEHWvWg/jrViDpKR8SavQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9UVPXHj1MbkdL9mkUZ8PKoQD87dvYue0soenZ1PHc2M=; b=m0ujLMWp044/gWitlkpeRnfWrhh+jfba+VK+Ajwmk8kfvTBKgLHjck6acC1pW1PbEqS+pxiQW+i+23xRhL2kp+lzktROHcYecscWp8npM6EvuVsQ/79W73eXwnW5UoWrg8wLRIT6wb9yiebiVxvNAX7gYDcQqS9duYgbieFZrIw= Received: from MWHPR14CA0033.namprd14.prod.outlook.com (2603:10b6:300:12b::19) by MWHPR12MB1438.namprd12.prod.outlook.com (2603:10b6:300:14::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:17:25 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::ab) by MWHPR14CA0033.outlook.office365.com (2603:10b6:300:12b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:25 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:25 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 13:17:23 -0600 From: Mario Limonciello To: Hans de Goede , Mark Gross , "Rafael J . Wysocki" CC: "open list:X86 PLATFORM DRIVERS" , , Shyam Sundar S K , Goswami Sanket , Mario Limonciello Subject: [PATCH v2 1/5] ACPI / x86: Add support for LPS0 callback handler Date: Thu, 10 Mar 2022 13:17:20 -0600 Message-ID: <20220310191724.1440-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 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-Office365-Filtering-Correlation-Id: 3e68dcb9-72cb-4613-cf76-08da02ca9c3c X-MS-TrafficTypeDiagnostic: MWHPR12MB1438:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7/vvkC3kssRCsSUIWtEWtZZpFfX/41bft1gZPtQyLJ654delyGmcb7TJ3zccigXAV/mYQ2ZFpqa4KWOgaW0C1yQ6i+GtfnYqVGzKV35WEUQv9i10lfb3sflEYJSpKFz3KGCasFl6G4oji9WKG/01oSgFybQ5oIwD61mV98EERLwcshugnS/srvIHVBYWiiYC9XGXcuAOv78FgomwrMt2/5qGPGGnwybxIB6f7E523ozAgz00feVDuN59zcz8TS8qMIiZ7X8Td0hQN/35MoaILPILXl2li639DoWGo8zGpWpou3sErML3anWmcVAFMKbS6eFNznMHwDwQFFr9e+/AhWcrIsxeKKtmS/CmP+p4WDHmBjpjcChrdb79/Bc5aJsh9bG9gMAQaH0Iy7rw46ipF7dnRR7ETIVGPzIZHT5OJLqDLtDvQfIja3Y6rggs1FB/yzVcDzKPqs+rCOgrf/KRGJOAReNf3YyTrUhWIHjh1HxXeCGnU0SK48u9u6iH3MGW62hfBgZLm1FV582/o8mi6O9ghIhUTP8oRb0IBOYlvr+slS7FzdTvQLuFOv1Oo/SAHNEY0iWFt2LMcsxR/UwwN3mG2ysFutuMEajWCJ8QTOXPBl+YFYsUTYqR2cfCaNcmSvOY45Vu/n0UMSbpve8nrrXEayiuTa/HV642IvAYjXr4XilQjbPCeZCRU8D68XXsPG8Z3vn3fX73Lj6ktO58hQ== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(83380400001)(8676002)(4326008)(70586007)(70206006)(7696005)(356005)(81166007)(316002)(82310400004)(86362001)(508600001)(36860700001)(45080400002)(36756003)(40460700003)(110136005)(54906003)(47076005)(2906002)(44832011)(5660300002)(8936002)(16526019)(426003)(336012)(1076003)(26005)(186003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:17:25.2351 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e68dcb9-72cb-4613-cf76-08da02ca9c3c 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1438 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currenty the latest thing run during a suspend to idle attempt is the LPS0 `prepare_late` callback and the earliest thing is the `resume_early` callback. There is a desire for the `amd-pmc` driver to suspend later in the suspend process (ideally the very last thing), so create a callback that it or any other driver can hook into to do this. Signed-off-by: Mario Limonciello --- changes from v1->v2: * Change register/unregister arguments to be struct drivers/acpi/x86/s2idle.c | 65 ++++++++++++++++++++++++++++++++++++++- include/linux/acpi.h | 11 ++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index abc06e7f89d8..7418443580d4 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -86,6 +86,9 @@ struct lpi_device_constraint_amd { int min_dstate; }; +static LIST_HEAD(lps0_callback_handler_head); +static DEFINE_MUTEX(lps0_callback_handler_mutex); + static struct lpi_constraints *lpi_constraints_table; static int lpi_constraints_table_size; static int rev_id; @@ -444,6 +447,9 @@ static struct acpi_scan_handler lps0_handler = { int acpi_s2idle_prepare_late(void) { + struct lps0_callback_handler *handler; + int rc = 0; + if (!lps0_device_handle || sleep_no_lps0) return 0; @@ -474,14 +480,31 @@ int acpi_s2idle_prepare_late(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); } - return 0; + + mutex_lock(&lps0_callback_handler_mutex); + list_for_each_entry(handler, &lps0_callback_handler_head, list_node) { + rc = handler->prepare_late_callback(handler->context); + if (rc) + goto out; + } +out: + mutex_unlock(&lps0_callback_handler_mutex); + + return rc; } void acpi_s2idle_restore_early(void) { + struct lps0_callback_handler *handler; + if (!lps0_device_handle || sleep_no_lps0) return; + mutex_lock(&lps0_callback_handler_mutex); + list_for_each_entry(handler, &lps0_callback_handler_head, list_node) + handler->restore_early_callback(handler->context); + mutex_unlock(&lps0_callback_handler_mutex); + /* Modern standby exit */ if (lps0_dsm_func_mask_microsoft > 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, @@ -524,4 +547,44 @@ void acpi_s2idle_setup(void) s2idle_set_ops(&acpi_s2idle_ops_lps0); } +int acpi_register_lps0_callbacks(struct lps0_callback_handler *arg) +{ + struct lps0_callback_handler *handler; + + if (!lps0_device_handle || sleep_no_lps0) + return -ENODEV; + + handler = kmalloc(sizeof(*handler), GFP_KERNEL); + if (!handler) + return -ENOMEM; + handler->prepare_late_callback = arg->prepare_late_callback; + handler->restore_early_callback = arg->restore_early_callback; + handler->context = arg->context; + + mutex_lock(&lps0_callback_handler_mutex); + list_add(&handler->list_node, &lps0_callback_handler_head); + mutex_unlock(&lps0_callback_handler_mutex); + + return 0; +} +EXPORT_SYMBOL_GPL(acpi_register_lps0_callbacks); + +void acpi_unregister_lps0_callbacks(struct lps0_callback_handler *arg) +{ + struct lps0_callback_handler *handler; + + mutex_lock(&lps0_callback_handler_mutex); + list_for_each_entry(handler, &lps0_callback_handler_head, list_node) { + if (handler->prepare_late_callback == arg->prepare_late_callback && + handler->restore_early_callback == arg->restore_early_callback && + handler->context == arg->context) { + list_del(&handler->list_node); + kfree(handler); + break; + } + } + mutex_unlock(&lps0_callback_handler_mutex); +} +EXPORT_SYMBOL_GPL(acpi_unregister_lps0_callbacks); + #endif /* CONFIG_SUSPEND */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6274758648e3..df105f5e03e5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1023,7 +1023,16 @@ 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 +struct lps0_callback_handler { + struct list_head list_node; + int (*prepare_late_callback)(void *context); + void (*restore_early_callback)(void *context); + void *context; +}; +int acpi_register_lps0_callbacks(struct lps0_callback_handler *arg); +void acpi_unregister_lps0_callbacks(struct lps0_callback_handler *arg); +#endif /* CONFIG_X86 */ #ifndef CONFIG_IA64 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); #else From patchwork Thu Mar 10 19:17:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 550174 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 232F3C433FE for ; Thu, 10 Mar 2022 19:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343509AbiCJTSf (ORCPT ); Thu, 10 Mar 2022 14:18:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239336AbiCJTSe (ORCPT ); Thu, 10 Mar 2022 14:18:34 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2046.outbound.protection.outlook.com [40.107.95.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27552BA; Thu, 10 Mar 2022 11:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hEuf4mSyHN8/HZ+qU8MjN9C1QqNee/4CDhsjhr2K2XYDDx+K1vSrWXI/c3L9JGEBVdIinkTw3XmGw76I3D6mdjL7bJPrandBpaN0o+j9vBYrUAlRsSGFPRMhGlkfXEVuwJ125GhLsreEhrbAR3vWR5T70WDiaO8pM2QH20W5qqfunDVsnJlKNp3/YNx92k1XDXRfNiTA+WeHMN1D2pKaLO3b/X2P3CPNQr6UDUfRTPTc9xoIsxH3weIdokW2L3D9pA0hJ8mepWydeqPDJESOMIXG6EIZ0JdxEWtJpuO0b5RqX0oU+k4trS6xpii76tKRj9p1hsMMRMRlCvQFHfMoOg== 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=0jRRPkonHidepZmgfkaTFkoBgoAmRLDfAZgQBeG0+J8=; b=T3zL5Bmzm0/UkvdpoSXOjC8eH5uzi/XAAa+M6wSlvxA3wmt4vgzZKpnjC4C+7zMoUnCgAmjG1rg3RGgyViB4FCF6/hq3Xv18+j3yWylt0YQcble5OgLLJ/TDNVl6IPakVBBBBP6TM32aVVeqf3piEI2cY8kd5d+FbxNzPdvM3l2tLoXbN8IweHB5k/395F1aoGJH1pwoJ+NbLl1FTmiubBUmzRmiO/FkewN0AbdZhDsA5CHC1pNH2/z+PZ6PmVzZDCeeSNAga9H+12s6eagweA8HfTTHrAuIl6+CJjQr2i+ILet26cbqM1pII7IGZepQpJ1GBCtCAYJ11OxYMCiOLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0jRRPkonHidepZmgfkaTFkoBgoAmRLDfAZgQBeG0+J8=; b=RtHLA5ytRZ1W+sDJfHV9Yo1FRkpBTuXaoN95Pf6eSE8ZeUftDLBo+GpnE5Yd4ylG8fwpGn4Brey6ubi7ERjdpa5Uyx3vpfksm846cyGaYHBWjzl4KCDuDCRufOecMEa0tlifU7uj1bj1urVTjQMzFMh88j5JEFKSuqxzjVG97zo= Received: from MWHPR14CA0046.namprd14.prod.outlook.com (2603:10b6:300:12b::32) by MWHPR1201MB0013.namprd12.prod.outlook.com (2603:10b6:300:e0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.17; Thu, 10 Mar 2022 19:17:26 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::2b) by MWHPR14CA0046.outlook.office365.com (2603:10b6:300:12b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:26 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:26 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 13:17:24 -0600 From: Mario Limonciello To: Hans de Goede , Mark Gross , "Rafael J . Wysocki" CC: "open list:X86 PLATFORM DRIVERS" , , Shyam Sundar S K , Goswami Sanket , Mario Limonciello Subject: [PATCH v2 2/5] ACPI / x86: Pass the constraints checking result to LPS0 callback Date: Thu, 10 Mar 2022 13:17:21 -0600 Message-ID: <20220310191724.1440-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310191724.1440-1-mario.limonciello@amd.com> References: <20220310191724.1440-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-Office365-Filtering-Correlation-Id: e1942461-0e63-4a08-2a07-08da02ca9cbb X-MS-TrafficTypeDiagnostic: MWHPR1201MB0013:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UrT3MlZ4p3t+yUA/bpY6E0b8Pxq7BvRqkXbRcomLg6NqDwtJw7p9MUO7r1xrLgLqiqQG19hwd4C6VrLdrL/EvNdASyJGFOhbXIlEmbIl8T6dByS8ec5KLTszLNuEX7iT9wo7JljhaM7EDtgy+a5e2IDM5tB+G2teS7V0COK9BenjsOPXF1ogCZ0l6rk+9R6nidcGkU0ixcHC+LLr5ukc4sqaoKswBu1Q0XURKRqGmvSnNK+w7KzYzOyN6n2SEt84yA1v9dscsQOk1Ra+1Q83WjuGQGfkA4GfqIrvmNctOm0mRAAu2u9daO+yLWhCc81+tQnPrKLcXn12NxF7fIZlaYzsGIFeRr3Vc5YgdRWjS82n4sAGn5M/9FzRltCRbhu5f8k/DXZXe13QcPg7nq2TgsLCirBtITuT5fmJ+HWTLFzkkuqIbIhQNZuF0gtwD9XxNXUtkHVnSIuquR9uDaFFurUBLF5zvupp+5Dr77uRBPpJicdddtgqmLqXVbp5nVfcvFDyqICZHzuk3R9nTvnKyEmgZ2gg5jX4e/XiKwtFbWD0HIVzoiTCCG0gE4cN+owXb4mWJkuQTYLM1tHJue/KN6wqiPM1zhhVoMxxxTTtNbFrSuEdUSiattOxXYc7XgcI1Tt17scz2Tw57dD7Cr2Qvh9iecEoNQZ06QAphjg/KhJQelBQezMhXx/7XYKsT3Sy0dwTnekkiqUy/+lq81Sc6Q== 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(36860700001)(44832011)(7696005)(81166007)(86362001)(83380400001)(8936002)(54906003)(508600001)(356005)(8676002)(82310400004)(5660300002)(70586007)(4326008)(70206006)(2906002)(1076003)(40460700003)(16526019)(426003)(336012)(6666004)(2616005)(186003)(316002)(26005)(36756003)(110136005)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:17:26.0632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1942461-0e63-4a08-2a07-08da02ca9cbb 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0013 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org If constraints checking has been enabled by the LPS0 code, it may also be useful for drivers using the callback to make a decision what to do. For example this may in the future allow a failing constraints check preventing another driver from notifying firmware that all required devices have entered the deepest state. Signed-off-by: Mario Limonciello --- Changes from v1->v2: * rebase on top of changes in first patch drivers/acpi/x86/s2idle.c | 11 +++++++---- include/linux/acpi.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 7418443580d4..808018bbab90 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -290,7 +290,7 @@ static void lpi_device_get_constraints(void) ACPI_FREE(out_obj); } -static void lpi_check_constraints(void) +static void lpi_check_constraints(bool *met) { int i; @@ -312,11 +312,13 @@ static void lpi_check_constraints(void) continue; } - if (adev->power.state < lpi_constraints_table[i].min_dstate) + if (adev->power.state < lpi_constraints_table[i].min_dstate) { acpi_handle_info(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(adev->power.state)); + *met = false; + } } } @@ -448,13 +450,14 @@ static struct acpi_scan_handler lps0_handler = { int acpi_s2idle_prepare_late(void) { struct lps0_callback_handler *handler; + bool constraints_met = true; int rc = 0; if (!lps0_device_handle || sleep_no_lps0) return 0; if (pm_debug_messages_on) - lpi_check_constraints(); + lpi_check_constraints(&constraints_met); /* Screen off */ if (lps0_dsm_func_mask > 0) @@ -483,7 +486,7 @@ int acpi_s2idle_prepare_late(void) mutex_lock(&lps0_callback_handler_mutex); list_for_each_entry(handler, &lps0_callback_handler_head, list_node) { - rc = handler->prepare_late_callback(handler->context); + rc = handler->prepare_late_callback(handler->context, constraints_met); if (rc) goto out; } diff --git a/include/linux/acpi.h b/include/linux/acpi.h index df105f5e03e5..4906db854554 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1026,7 +1026,7 @@ acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, #ifdef CONFIG_X86 struct lps0_callback_handler { struct list_head list_node; - int (*prepare_late_callback)(void *context); + int (*prepare_late_callback)(void *context, bool constraints); void (*restore_early_callback)(void *context); void *context; }; From patchwork Thu Mar 10 19:17:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 550943 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 71F6AC4332F for ; Thu, 10 Mar 2022 19:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343506AbiCJTSg (ORCPT ); Thu, 10 Mar 2022 14:18:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343503AbiCJTSe (ORCPT ); Thu, 10 Mar 2022 14:18:34 -0500 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 90F1F394; Thu, 10 Mar 2022 11:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cq9RtItqo2u/p2s8THNR//SXwQGKKbYXmROtksaBum145Qm+OA2pPzqgjFx4hJClEcvfYsSUzSNheQcjqup9/9NcO5ux2ITMseTDanzM0W/gib95pEX4wu/WBqo3hvzQRiTfCkAY3wtFa0CssI6D6krpCAh5stxJ8Cl8CEhP+8BWf/PYwDF1CqkVtAQZdvF2jE6JbzigmbsfH+JTaXjwcRHeDVZFu2KMRtcHI+q9+/xNBkg2ZVZx9SR7z2o2siqbGGCrZ0Syp8zdgpC4GvoWLE8pAGiU7ev3mnT5duLjd2TYSD6+N5aLIG2L/1+9fkCihwRW5i23A0bx+jROQlPQqg== 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=qICJ6p/yDX/mZ3paBS3atf3sqcokoK95hDIGa4eeC2U=; b=ogQB3AYGtU+o+oDM90LgSIQvnzEsLbd8BX374BhON/Dip3iEicoJzfK3JP6MZBqOE2OBJU/CbOdsrURJCcKL6plbKzPD+d+P9MM/Dko4ksS4TCePehcVeOm7r54gNs7+hUBVBYYJP4cQ5DV1xsxKcDrVebYoRd8Ie+p2Klmeh0MPcMzZkoWMBHHfcXsHowl10nMjkTAyXpUmx9GhLdmoeE5uzFCS1MbVRlqK/syuM6NTtdWTOlrx/QD6g3MKUGiB3SbDWB3ogtV/SWhmrHWo8nDrQvj3/WQLDnrXQSFBZXjddJHLvnIqJmjlFhgRemcCJ4LitL1+EFTncZrrE+/KuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qICJ6p/yDX/mZ3paBS3atf3sqcokoK95hDIGa4eeC2U=; b=zVPqf+lWiL/9p1EoYThgIljxcLkQxt0p8ZGJM0YkR820+yO9pGkBA2Etgk2e6obsWChRt6AEKmR1+LW7AkdE8ooG6ZIQuS4w7OQ0iflTPI7kHVqXZRggh6wSk41kf1t4YGGidvmbt5Ptf0Bbhp134uJpaHYQxyF+Lzc/Hl8rePU= Received: from MWHPR14CA0030.namprd14.prod.outlook.com (2603:10b6:300:12b::16) by DM6PR12MB5006.namprd12.prod.outlook.com (2603:10b6:5:1b8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 19:17:27 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::c6) by MWHPR14CA0030.outlook.office365.com (2603:10b6:300:12b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Thu, 10 Mar 2022 19:17:27 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:26 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 13:17:24 -0600 From: Mario Limonciello To: Hans de Goede , Mark Gross , "Rafael J . Wysocki" CC: "open list:X86 PLATFORM DRIVERS" , , Shyam Sundar S K , Goswami Sanket , Mario Limonciello , "David E . Box" Subject: [PATCH v2 3/5] ACPI / x86: Check LPI constraints by default Date: Thu, 10 Mar 2022 13:17:22 -0600 Message-ID: <20220310191724.1440-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310191724.1440-1-mario.limonciello@amd.com> References: <20220310191724.1440-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-Office365-Filtering-Correlation-Id: 38761008-462d-4219-0f28-08da02ca9d43 X-MS-TrafficTypeDiagnostic: DM6PR12MB5006:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tsgtV3r+8xKi8nXvdrAevIL5jduMfnkM5veYeoEaorxvavouElSmbCsiotlQl8+3+Dh1vQXtXDB9cCXmhT+jNdPMknowSCWYvT1qIxdpNUkhp2nClSIa28JnvIU+83hdjaBgPYRy0UqPOKXFW9L0Og+qLX+KNAqcagbxyIAn1rM1QeveJ19vNYfn3y1Tb8m3HL7d7z1PgnH4eeYtAtCK8pKdP8a7PQRwHddzwHUG9pfAzskAQuvwvq4nzapfETwIWgBCxZ7FVpZ/8giMSaaQb0Gra0hMcnqwe2MwlJIz5XdMINoRLs2AWqc9h9bfDuWu1XXuPlD7+lQDbIkt0SxK8tTpBQK6FCwW/eUmsKCtAhFgHXP4hH5aqk8HIpBOKjAaOH8U6vq/Wu16S1/ZV9dgHc4MjN8aXZM5jU6WLjk6lUC2kdxd6UIkAHni/b8hge5ivjKG8cFAIbSt5WMckK+GXcjN9tXEXAXrOs1B71XRBnW7ypfQGl0NX4HtHg8r3v4tLJxb5m+Vsn3KW1pPlMrDZM+MUA8i3oBPXmY+LgrKjU5CJAuBdwWCPwYVM9+LDF8/wnEQk6GghPZ/+PP7sCsaYSMHi10o649/skQ3vyYhUKhERg8pxO43KADV6NhaZnJSVVzqr+tMwN5+Ctbi4p010JXLMicm/VU2x49zGVQP5C3KcREb67n1fddomqUHbENfHeEKqwsSjCDSIzlsyd3p4A== 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(81166007)(356005)(1076003)(83380400001)(508600001)(86362001)(36860700001)(47076005)(7696005)(16526019)(426003)(186003)(26005)(4326008)(70206006)(8676002)(70586007)(2616005)(82310400004)(36756003)(44832011)(5660300002)(8936002)(2906002)(40460700003)(110136005)(54906003)(336012)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:17:26.9538 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38761008-462d-4219-0f28-08da02ca9d43 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5006 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently LPI constraints are only checked when `pm_debug_messages` has been set. They are mostly used as a debugging tactic. As the results of constraint checking will be passed to consumers of the LPS0 callback, ensure that constraints are checked by default so this value can be trusted. Suggested-by: David E. Box Signed-off-by: Mario Limonciello --- changes from v1->v2: * New patch drivers/acpi/x86/s2idle.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 808018bbab90..3236bd66f499 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -307,16 +307,19 @@ static void lpi_check_constraints(bool *met) acpi_power_state_string(adev->power.state)); if (!adev->flags.power_manageable) { - acpi_handle_info(handle, "LPI: Device not power manageable\n"); + if (pm_debug_messages_on) + acpi_handle_info(handle, "LPI: Device not power manageable\n"); lpi_constraints_table[i].handle = NULL; continue; } if (adev->power.state < lpi_constraints_table[i].min_dstate) { - acpi_handle_info(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(adev->power.state)); + if (pm_debug_messages_on) { + acpi_handle_info(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(adev->power.state)); + } *met = false; } } @@ -456,8 +459,7 @@ int acpi_s2idle_prepare_late(void) if (!lps0_device_handle || sleep_no_lps0) return 0; - if (pm_debug_messages_on) - lpi_check_constraints(&constraints_met); + lpi_check_constraints(&constraints_met); /* Screen off */ if (lps0_dsm_func_mask > 0) From patchwork Thu Mar 10 19:17:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 550173 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 F1087C4321E for ; Thu, 10 Mar 2022 19:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343503AbiCJTSg (ORCPT ); Thu, 10 Mar 2022 14:18:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241175AbiCJTSe (ORCPT ); Thu, 10 Mar 2022 14:18:34 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2058.outbound.protection.outlook.com [40.107.237.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A30395; Thu, 10 Mar 2022 11:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9hXCjevnAuiTP4YJ6Xe4KNWh/gKcdyON0LnSPnjdVK2cY3AhLVukgvuT2Sx0Z7d5QHDcnY+RDuXjwg8ji7z+fAe/E8Dicwqn5Wk1/zaxKaPjLFE9rxXtJX85crtn66fJM9EzSdfzelUY0H4gpDHYpX/xRK9VEOfP5HqEHOUrA5CCoptDbGI9abmdE0rmXVXXOUHhu9wJmZWfMe+pFaHomvZwhS1ptRsniSDCuSGZJashqROXQau4eTXLc5W+038N8GaEDeM2zH2e79s52A2fp9JdCONxt43ZOrTx0yJi2MdqHPdI0VCeP0vpvIVeUMOo41dTHV6JUTXTdn0gxqZwg== 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=VsaQyPXbbvSezoBQ2ZpwNaclrSlh0XZv66sl17ttm3I=; b=T4QsUxT3KbCwr0f+e0+NuqBXJQv6NKQALhQEG8/yxTxaWg3PhwXVjzqAaqATP8RtL5/eMvJaCj0w2GQEORxgwfsmHgg+w3Vu1sv+gzX+pDwUIY4vCGvQHyFnQFW5FX2gnpGtMZTHQQVJeJqkpHsiGdZj5TaHh1BEkv8OfpIGbiX7KnskPSIwLOWpmjxhq6enDNOm05kztA8d845t6IS4vYDJDTA3z0Hax2UScQ8gmRKJGN66RS/vlq7Ga/IiTFUMoUA90SxWB+zVfI4vmyMgl2/1zw9PQDVa8rEu0YtvafMYeTsXAc+Lvacm+C7/YvgUuk4IjSvoaU0GIy9GPAP3og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VsaQyPXbbvSezoBQ2ZpwNaclrSlh0XZv66sl17ttm3I=; b=a2xORd9HsMdPSL+qRYJoTMGd7Ho8ThsDWlS2ZL5kDqEdRvC6D8hJ6pVlf6pJQf98alaPs2uQ3QjkgdU0fGvwgXKS1RLnazJ5enIXkP3dDtkMV0j7Kg8CXElnsGi74v05wmGW9tjW9msvmCK+w1silvIgegiLZz+MQiyRNZlrdxk= Received: from MWHPR14CA0036.namprd14.prod.outlook.com (2603:10b6:300:12b::22) by BY5PR12MB4918.namprd12.prod.outlook.com (2603:10b6:a03:1df::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Thu, 10 Mar 2022 19:17:28 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::42) by MWHPR14CA0036.outlook.office365.com (2603:10b6:300:12b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15 via Frontend Transport; Thu, 10 Mar 2022 19:17:28 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:28 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 13:17:25 -0600 From: Mario Limonciello To: Hans de Goede , Mark Gross , "Rafael J . Wysocki" CC: "open list:X86 PLATFORM DRIVERS" , , Shyam Sundar S K , Goswami Sanket , Mario Limonciello Subject: [PATCH v2 4/5] platform/x86: amd-pmc: Move to later in the suspend process Date: Thu, 10 Mar 2022 13:17:23 -0600 Message-ID: <20220310191724.1440-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310191724.1440-1-mario.limonciello@amd.com> References: <20220310191724.1440-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-Office365-Filtering-Correlation-Id: 0a928f38-aa40-4406-cca4-08da02ca9de2 X-MS-TrafficTypeDiagnostic: BY5PR12MB4918:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: go85hYyn2dX/P8wTfTFUptumlF+g71PjJOB8ez5WVi8xkv976kZ3MDtESyEVozYpqL0HXnTrJWzz3RHHaFOb1bhbMuSLz0RUw/yiqLvNBwRol55YOTFrKbK0cOy+E4e+NcoywTQ5Jio+3Luk6YKJj8/KvqGhzwm/an/P69zXxpvf/cUBSEAZbfdenr0fMGmiwkFX1G9iWfhVlxSk4Nbjig/dRYWxe++54sukCIoyZ8CmssGi0RtjpwOk8SuUNqFdtZ+btkzBVeHHFCBGDaX+SMjjc4zXyX6OuS6zJOpHn4+6gwN70cZtSa5IzGEm97DEeYk5pXleCy8XYf2Av8QroBLsT8DjE+fUSDnhiQUZZ/znwSzbkqzAkcIHX+zG34YgnTOU5WFkt/X7HpqaX78GGo7MCmQBnYgGpW7QUwfilnMf7GlHSnKg/ouQ6G4NlJf5GEhbBrZ7FZugkmfSE0OYQiQ2o+hghroyOtcNEJXtPwmImDPwC0HhbKHwoq+qzAD2lff0tPCPBodhmRvm9YItCr/byZWMW9C2XmQVzby5U+GhS5EY6dFIQA3YKObaCVBcvmXvott7Mq2AgKZ4KYZ8bvNU00bPwpI1ptIIKqm2PKifbomFIL6LZpHsMjzWoGcU+HhQiDNBgtDOkaEjtyEHw5a1yoZ1sxsZxNCDayzkQA/rTZ3kzPk4PDaZxeXnqtxK4Zd7KM5MX1ej6reIUuwfaQ== 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(2906002)(426003)(336012)(40460700003)(86362001)(81166007)(16526019)(26005)(186003)(316002)(54906003)(110136005)(2616005)(82310400004)(1076003)(36860700001)(44832011)(356005)(83380400001)(70586007)(8676002)(70206006)(4326008)(508600001)(47076005)(15650500001)(36756003)(5660300002)(8936002)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:17:28.0007 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a928f38-aa40-4406-cca4-08da02ca9de2 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4918 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The `OS_HINT` message is supposed to indicate that everything else that is supposed to go into the deepest state has done so. This assumption is invalid as: 1) The CPUs will still go in and out of the deepest state 2) Other devices may still run their `noirq` suspend routines 3) The LPS0 ACPI device will still run To more closely mirror how this works on other operating systems, move the `amd-pmc` suspend to the very last thing before the s2idle loop via an lps0 callback. Fixes: 8d89835b0467 ("PM: suspend: Do not pause cpuidle in the suspend-to-idle path") Signed-off-by: Mario Limonciello --- changes from v1->v2: * adjust for changes in previous patches * display a debugging message for constraints drivers/platform/x86/amd-pmc.c | 42 +++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c index 971aaabaa9c8..752a99d759d2 100644 --- a/drivers/platform/x86/amd-pmc.c +++ b/drivers/platform/x86/amd-pmc.c @@ -639,13 +639,16 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) return rc; } -static int __maybe_unused amd_pmc_suspend(struct device *dev) +static int amd_pmc_suspend(void *context, bool constraints) { - struct amd_pmc_dev *pdev = dev_get_drvdata(dev); + struct amd_pmc_dev *pdev = dev_get_drvdata((struct device *)context); int rc; u8 msg; u32 arg = 1; + /* for enabling constraints checking in the future */ + dev_dbg(pdev->dev, "LPI constraints were%smet.\n", constraints ? " " : " not "); + /* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0); amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0); @@ -658,7 +661,7 @@ static int __maybe_unused amd_pmc_suspend(struct device *dev) } /* Dump the IdleMask before we send hint to SMU */ - amd_pmc_idlemask_read(pdev, dev, NULL); + amd_pmc_idlemask_read(pdev, pdev->dev, NULL); msg = amd_pmc_get_os_hint(pdev); rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, 0); if (rc) { @@ -681,28 +684,28 @@ static int __maybe_unused amd_pmc_suspend(struct device *dev) return rc; } -static int __maybe_unused amd_pmc_resume(struct device *dev) +static void amd_pmc_resume(void *context) { - struct amd_pmc_dev *pdev = dev_get_drvdata(dev); + struct amd_pmc_dev *pdev = dev_get_drvdata((struct device *)context); int rc; u8 msg; msg = amd_pmc_get_os_hint(pdev); rc = amd_pmc_send_cmd(pdev, 0, NULL, msg, 0); if (rc) - dev_err(pdev->dev, "resume failed\n"); + dev_err(pdev->dev, "resume failed: %d\n", rc); /* Let SMU know that we are looking for stats */ amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_DUMP_DATA, 0); /* Dump the IdleMask to see the blockers */ - amd_pmc_idlemask_read(pdev, dev, NULL); + amd_pmc_idlemask_read(pdev, pdev->dev, NULL); /* Write data incremented by 1 to distinguish in stb_read */ if (enable_stb) rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF + 1); if (rc) - dev_err(pdev->dev, "error writing to STB\n"); + dev_err(pdev->dev, "error writing to STB: %d\n", rc); /* Restore the QoS request back to defaults if it was set */ if (pdev->cpu_id == AMD_CPU_ID_CZN) @@ -711,15 +714,8 @@ static int __maybe_unused amd_pmc_resume(struct device *dev) /* Notify on failed entry */ amd_pmc_validate_deepest(pdev); - - return rc; } -static const struct dev_pm_ops amd_pmc_pm_ops = { - .suspend_noirq = amd_pmc_suspend, - .resume_noirq = amd_pmc_resume, -}; - static const struct pci_device_id pmc_pci_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_CZN) }, @@ -805,6 +801,11 @@ static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf) static int amd_pmc_probe(struct platform_device *pdev) { struct amd_pmc_dev *dev = &pmc; + struct lps0_callback_handler lps0_handler = { + .prepare_late_callback = amd_pmc_suspend, + .restore_early_callback = amd_pmc_resume, + .context = &pdev->dev, + }; struct pci_dev *rdev; u32 base_addr_lo, base_addr_hi; u64 base_addr, fch_phys_addr; @@ -884,6 +885,10 @@ static int amd_pmc_probe(struct platform_device *pdev) amd_pmc_get_smu_version(dev); platform_set_drvdata(pdev, dev); + err = acpi_register_lps0_callbacks(&lps0_handler); + if (err) + goto err_pci_dev_put; + amd_pmc_dbgfs_register(dev); cpu_latency_qos_add_request(&dev->amd_pmc_pm_qos_req, PM_QOS_DEFAULT_VALUE); return 0; @@ -896,7 +901,13 @@ static int amd_pmc_probe(struct platform_device *pdev) static int amd_pmc_remove(struct platform_device *pdev) { struct amd_pmc_dev *dev = platform_get_drvdata(pdev); + struct lps0_callback_handler lps0_handler = { + .prepare_late_callback = amd_pmc_suspend, + .restore_early_callback = amd_pmc_resume, + .context = &pdev->dev, + }; + acpi_unregister_lps0_callbacks(&lps0_handler); amd_pmc_dbgfs_unregister(dev); pci_dev_put(dev->rdev); mutex_destroy(&dev->lock); @@ -917,7 +928,6 @@ static struct platform_driver amd_pmc_driver = { .driver = { .name = "amd_pmc", .acpi_match_table = amd_pmc_acpi_ids, - .pm = &amd_pmc_pm_ops, }, .probe = amd_pmc_probe, .remove = amd_pmc_remove, From patchwork Thu Mar 10 19:17:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 550172 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 9153AC4332F for ; Thu, 10 Mar 2022 19:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343515AbiCJTSi (ORCPT ); Thu, 10 Mar 2022 14:18:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343505AbiCJTSe (ORCPT ); Thu, 10 Mar 2022 14:18:34 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2044.outbound.protection.outlook.com [40.107.94.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1681CF0; Thu, 10 Mar 2022 11:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AuOuOtqPhrTz7lgBWFIi/oNhv6ElyKPy9EYrnAO5pB69Buns5/8ANrGDNZJe/DveiY2Sh9Np+pq+SpqOIJHtHccxMibBNsn39bVMgsARt98TiUGrTLsaz6TqQtEo0qiiLYXSuxxDmGtxSx1kcIdiVJbx0n1OICcdEsYahq0kFlmsuOQRxdifTI+C6+TDXn6h6Z1Noo5g+agBfaBhVt+awIN3P+cTMryNkpR8FgHfUgZ1YSjFg7KhsZ1HGgX7KXmXzfkSLncdfK88wuNat5a3vsl2lxVcoZu0jAps5JEHDXftKDtTKIo6X5pQVBOdCjxJeU6I5ZPKeBakDF+cscXo/Q== 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=rq+gvviXlEKDwtsks3/N2f1EW+E5fajs29F53LmLNcA=; b=jUOwgUTgcOfJ2cVvOoxsefJ53gqA4NJCxxrp+JvKUhf7cVf1/E6OUqtJmQzFgvt3qm+J/MN25MNJKlsbYwszo2swK/d1DmdgRmLsKnse3V2SZOMdj/HVtrvTqaz9o/g3KTGPf6NEglXmbsUjI50qsqtwSboGwIZNrIo1vyahR+f5lm7Gut9pgVt16Vetp0NyWPJzHqPYXI8T0VD3TuxqBjE0w/Ut/MlB7U+cRt7FkfkkdXr4/hwfshxkL2JhJB17b33tnfWx5J4WJQAKEW1s5Q0JCd5pmB4PXQBViTZC04V9ouTWO66Ywzy+AgErKzeCiUxbLT62RofEMd0k8zDZ+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rq+gvviXlEKDwtsks3/N2f1EW+E5fajs29F53LmLNcA=; b=I0+uwgnroc2R04rTlpF3MjOYZ9RpUTzXuQldiDrmEtJdZ7u0CXdAvhNvEIRPBtLttfcdbH8lVsaj6hyhVfBt6U/t6vynBsme5JfcrWHVejgp+2Gb9zIrhngKU5Y/58Q0K52mdKUXRRFjVyA2budAF+LWFYs4sAFgtnmLmhmSzPs= Received: from MWHPR14CA0034.namprd14.prod.outlook.com (2603:10b6:300:12b::20) by MW2PR12MB2411.namprd12.prod.outlook.com (2603:10b6:907:10::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Thu, 10 Mar 2022 19:17:29 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:300:12b:cafe::38) by MWHPR14CA0034.outlook.office365.com (2603:10b6:300:12b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:29 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 19:17:28 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 10 Mar 2022 13:17:26 -0600 From: Mario Limonciello To: Hans de Goede , Mark Gross , "Rafael J . Wysocki" CC: "open list:X86 PLATFORM DRIVERS" , , Shyam Sundar S K , Goswami Sanket , Mario Limonciello Subject: [PATCH v2 5/5] platform/x86: amd-pmc: Drop CPU QoS workaround Date: Thu, 10 Mar 2022 13:17:24 -0600 Message-ID: <20220310191724.1440-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220310191724.1440-1-mario.limonciello@amd.com> References: <20220310191724.1440-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-Office365-Filtering-Correlation-Id: 7953e83e-da5c-4d83-774f-08da02ca9e6f X-MS-TrafficTypeDiagnostic: MW2PR12MB2411:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nbd+qxilCNwyHgFykzw8t1cFdNI+11Q0kLGIThMGQt5alo053zkWiY/hqtNv9SCCdf0hWWAtptV0QKT6KOZDMbGG2zPyJvYV/f5I9Ba6mZg+Rs3gylUf84F5lv0urbK5TRF2yK6L1ODwXm6GlqTaYTwbc1DYO0vDIUzn9TvqW7QLevDmoPd8x/8SZ5qWF91n1/Bl1QFKaI+Uoe0jsIYf/1syVLMYsQLPj+KIujGyM0IFY6ctOrZ0hAYWy3oVJ14eL8IfaBFTpneimKx+RR9Fkiq/zRKUuj60AZWJeh9wZWXiDFLek5U1ErmAyhy5msscZowQtN1Rh4HV5hq/pOLhPrEJn/icKf5U6RPnTWHfkOe4CX9o0AdB+4euVXGIHlcEUiBlMAQMZtIKSN+JLdApqwvR1eKp/bO+74d0+87v3stu1gUMPtXoBXXrad45Wf5yAu5E19q8A/f6qlRFojtOF6ibsqiBsYB8wfu20dlQE39nIe96fiJThK/9J+BxIKBLva9BkbMHTDV17PNm/EGmKB4dUFqx1Y736A8aw5JxE0fOZRb74WaWYJaDp/5v1D+4rffR+G2nl49EGEfwBUkYnmPGj6KvJSMhY1kddjsr8HjV47MnJ4jLGQnsOcjZvtFxoeqCoA1RZsMJdsJ80qLc0yGgaDTbYth+SwbOMlroMFbr2rlHNZs4qVDbWtgGDX8FRR5P7jIWxKKw4h53ODaMmw== 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8676002)(4326008)(70586007)(70206006)(5660300002)(8936002)(110136005)(54906003)(2616005)(40460700003)(44832011)(2906002)(36756003)(186003)(26005)(7696005)(1076003)(47076005)(16526019)(36860700001)(426003)(82310400004)(316002)(86362001)(508600001)(336012)(83380400001)(81166007)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 19:17:28.9226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7953e83e-da5c-4d83-774f-08da02ca9e6f 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: CO1NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2411 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org A workaround was previously introduced as part of commit 646f429ec2de ("platform/x86: amd-pmc: Set QOS during suspend on CZN w/ timer wakeup") to prevent CPUs from going into the deepest state during the execution of the `noirq` stage of `amd_pmc`. As `amd_pmc` has been pushed to the last step for suspend on AMD platforms, this workaround is no longer necessary. Signed-off-by: Mario Limonciello --- changes from v1->v2: * No changes drivers/platform/x86/amd-pmc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c index 752a99d759d2..b3c6b5cc83c1 100644 --- a/drivers/platform/x86/amd-pmc.c +++ b/drivers/platform/x86/amd-pmc.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -96,9 +95,6 @@ #define PMC_MSG_DELAY_MIN_US 50 #define RESPONSE_REGISTER_LOOP_MAX 20000 -/* QoS request for letting CPUs in idle states, but not the deepest */ -#define AMD_PMC_MAX_IDLE_STATE_LATENCY 3 - #define SOC_SUBSYSTEM_IP_MAX 12 #define DELAY_MIN_US 2000 #define DELAY_MAX_US 3000 @@ -153,7 +149,6 @@ struct amd_pmc_dev { struct device *dev; struct pci_dev *rdev; struct mutex lock; /* generic mutex lock */ - struct pm_qos_request amd_pmc_pm_qos_req; #if IS_ENABLED(CONFIG_DEBUG_FS) struct dentry *dbgfs_dir; #endif /* CONFIG_DEBUG_FS */ @@ -628,14 +623,6 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) rc = rtc_alarm_irq_enable(rtc_device, 0); dev_dbg(pdev->dev, "wakeup timer programmed for %lld seconds\n", duration); - /* - * Prevent CPUs from getting into deep idle states while sending OS_HINT - * which is otherwise generally safe to send when at least one of the CPUs - * is not in deep idle states. - */ - cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, AMD_PMC_MAX_IDLE_STATE_LATENCY); - wake_up_all_idle_cpus(); - return rc; } @@ -678,9 +665,6 @@ static int amd_pmc_suspend(void *context, bool constraints) return 0; fail: - if (pdev->cpu_id == AMD_CPU_ID_CZN) - cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, - PM_QOS_DEFAULT_VALUE); return rc; } @@ -707,11 +691,6 @@ static void amd_pmc_resume(void *context) if (rc) dev_err(pdev->dev, "error writing to STB: %d\n", rc); - /* Restore the QoS request back to defaults if it was set */ - if (pdev->cpu_id == AMD_CPU_ID_CZN) - cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, - PM_QOS_DEFAULT_VALUE); - /* Notify on failed entry */ amd_pmc_validate_deepest(pdev); } @@ -890,7 +869,6 @@ static int amd_pmc_probe(struct platform_device *pdev) goto err_pci_dev_put; amd_pmc_dbgfs_register(dev); - cpu_latency_qos_add_request(&dev->amd_pmc_pm_qos_req, PM_QOS_DEFAULT_VALUE); return 0; err_pci_dev_put: