From patchwork Mon Mar 14 05:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 551114 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 5F5D8C433FE for ; Mon, 14 Mar 2022 05:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236049AbiCNFFK (ORCPT ); Mon, 14 Mar 2022 01:05:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235947AbiCNFFI (ORCPT ); Mon, 14 Mar 2022 01:05:08 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2088.outbound.protection.outlook.com [40.107.243.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9094192BE; Sun, 13 Mar 2022 22:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqIE+xicd8NV7uCvernlFiaaxV4cHk9F0+Tp9lRhhyh19dOf++wkqf1yId1kZiw0+/bf7+VgLGp6EyLA7nzkgIRjqI0nzpi6Khs/USxcCLygCY4BaxompSxBfOIt4zkWC7Y6LvUyJs+sg7y644VyO5o6meeF+E7J4IMBo0U505ipJIv6Pdt9ZMG3jDyMQm2Hhq7OChlh/84UoqZA2mMv6YZOFBg4Ii02FQ8sbdPWlE96/eJ/oiA5qAj0JlLmjfQHcUbggwfymPdMYToHFBQt6ks3roTwG66WTAg1FfHK/Xel8hB7XVwTx0I9s5i0awrFJkGXFTn5vkYLdLTfrlWVug== 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=keGXAkxIhkzNmyhoEHRQISMmI4hpLQ04cLXIxEoTJ8M=; b=b9ZsnVx139w5oz90BctCl/Xsoh5t0hFOUFRuGFJ5WLOF09z1rE9ERZ7g2W9SQtG9k9E+SbXT0OX9/YdbTj8eSA9eOBjtGnK58O5vPwrevI1OQFEw1BobA94EbwzXqYhtynH93vlpeFt8rvZKRSELPiNbApBx/KupsVEA2gGoUKaHv0AHglmmqZyrRPC3eK4fkXab7UVEUA0Uqy0Cmf4jdo2cmBnYSVaWRjpNDsv0vDVdJzUEo+lgh/WzalgOxsriSaW0OynaGTr6X4F9eYyVloZ7aH2+o4CSforZu7k1L80pE2XD47yWT/AtH0SBHzPDGbatxHQH4oYEO1W+PbNUQA== 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=keGXAkxIhkzNmyhoEHRQISMmI4hpLQ04cLXIxEoTJ8M=; b=zz7TpWSW6L8iex3XQ7QP1mKEWsExVuR8CLogU+s+7CaKaNH8jjry+2CnYkr8Qn97C1LvnW7C0ToCdSvl8Spj+irBjgVylVlu1YSvS8qVP21bUWNtI0bTJe2OGyBMOnzAFk2f6QDuIqALH55c86pGyoxUsTGDLuksy51C7bwt1+A= Received: from DM5PR18CA0074.namprd18.prod.outlook.com (2603:10b6:3:3::12) by DM6PR12MB4864.namprd12.prod.outlook.com (2603:10b6:5:209::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Mon, 14 Mar 2022 05:03:55 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::a5) by DM5PR18CA0074.outlook.office365.com (2603:10b6:3:3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.28 via Frontend Transport; Mon, 14 Mar 2022 05:03:54 +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 DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:54 +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; Mon, 14 Mar 2022 00:03:52 -0500 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 v3 1/5] ACPI / x86: Add support for LPS0 callback handler Date: Mon, 14 Mar 2022 00:03:35 -0500 Message-ID: <20220314050340.1176-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: 4084c863-811f-4987-224a-08da057809ce X-MS-TrafficTypeDiagnostic: DM6PR12MB4864: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: w8HesGZe7+eMWEiYWuBrKlAk5KWIRlc8m6cQXMYSyJhE/WH/8a3BAEIJFSJS8mOguRbpHCmXxUQlSXKgCaWeon/I6gxMFhqYA4JdjLyJQjLGNGiSVJ9YGr2Ioz/cPpNtBxQf1aTZH0aTS+9fuCloR9rHE0kBOpCXKTNAYwsVNqbAY6i5cnYGZru/GncfmguemNFZHwGYz50RVOGXFgutLbMBCK/UMP0/mQ1K/oPCwLjPvtAeA8CpOfT2REOtpzatSl2G6x/RnkMN7fyUb4QrbDhfCidh1fOMAY4nkjUyLHIDStOW/T81gvH+KoTW/xgIT+JzdVfYoIYnR/PQnDQMmOWKWPWcGqZBNsgx5z7FpNlfFPo76Qwtk+OqoEy/8j+8d00EGvLn+Ei1uqVtZP+Fs+9Rtlg2praJAuM/z+A4FWKZ4EfVkg2S60HthWt9kRSbMn6kNrSVzvJtmdCuOFC+lreZzykir7M7srR7BNRHeXLymwS8y+uiGbyoimEwohK61AnKNiETY/F5CwWGtv6IYt+CNZQrcFalgAWO9AP6WotwMMQvj6homkFuFxE4dpa1bg5q++LgA6uj3jo8E3ATNxekUKP3Ntzt7SYkbopt8CVNe2huhvp7Xpx0uqG8ZF3Y1jAfkDyLfn9gdc1rjV2F39+GQS3+bhv/qPYU8B4VU7CKO5Qsn+Y3JKYCZbLofX+tH55eJ1PLC0coR/DVny0BTg== 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)(2616005)(8936002)(6666004)(356005)(45080400002)(1076003)(70206006)(70586007)(508600001)(7696005)(16526019)(26005)(5660300002)(81166007)(186003)(44832011)(426003)(110136005)(54906003)(36756003)(336012)(82310400004)(2906002)(83380400001)(316002)(40460700003)(8676002)(47076005)(4326008)(86362001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 05:03:54.3971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4084c863-811f-4987-224a-08da057809ce 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: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4864 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 Reviewed-by: David E. Box --- changes from v2->v3: * Check that callbacks exist before calling changes from v1->v2: * Change register/unregister arguments to be struct drivers/acpi/x86/s2idle.c | 68 ++++++++++++++++++++++++++++++++++++++- include/linux/acpi.h | 11 ++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index abc06e7f89d8..69008c4a86ea 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,34 @@ 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) { + if (handler->prepare_late_callback) { + 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) + if (handler->restore_early_callback) + 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 +550,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 Mon Mar 14 05:03:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 551113 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 043F5C433EF for ; Mon, 14 Mar 2022 05:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231548AbiCNFFX (ORCPT ); Mon, 14 Mar 2022 01:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236071AbiCNFFL (ORCPT ); Mon, 14 Mar 2022 01:05:11 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D36831FCF9; Sun, 13 Mar 2022 22:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGjmufnPVbQH0VIyFbKCrWnA0E8e5oAbD/GZTywbmT9AAYfzPjblyBTZ+qOi48wBHBBlrcjGjE//CKBUuuWnh1/NGd8jV15p3UeZqopkXl1mefSVtw9oxy/vHKY1wbSTf5XOG5JZdAB+T3S2cEMokJfLf7RZZfEaweR348DjxhAyJ97IQ30l+HVVlHR0uOe2BNwBOIKiIhu0d+VVbErhUzse6yKCeTEr3cWOsR/y2V+BJB/mNoRbCFufNjS1Zv5QbS1WJvUEueJ+1i0GSPw8jn4fZwI/nRXEZqORTcaYJI9jZsf97NDQWFs4l/5AgvTKKJCSdWaezdxCw+SntmVDIw== 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=a0PmCxo5s1WmeS6fNhQqbGqYI4krHJuKe8IKZYdY3lw=; b=RjrXCjMdg9nFvgA+A8//V1I6I8HUn4LKDQ2Y9UC2e5xflchImriOe+NLp0QblnL6v4pwBHwyiShz3dh5G7ju/V0DviWfhMBMPcQAkMdPmhWTbjvGIEF+ScnHst6gqcN7dc9jxiF+8Va7+xOonHU5tNIBzMYuhYHVm8s5W1+40uSJyayc4QgSuuy5o7oPKYYT+IFrmggbKJFdzbITZB+TtVIN69OoH358wCslyyT+yVNzjY8SS5XnVaT46o9DgewlutttkE4e/vqCQlWPKcC1u2+aFjCjNJLoi2UI+Ao7OeugwlI+BkK9EeEhQf/r2VwTydFDlYi0gajrLy27iH8DfQ== 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=a0PmCxo5s1WmeS6fNhQqbGqYI4krHJuKe8IKZYdY3lw=; b=AsIvsfXvSAi7gjIwdg4zH9Aan5xCVPXUggWlprPxwoEwFotdO9XpjKr/d5Yazd/Fp7vuNj/ZnobJg4Vny9uRPxsQky9kL+OzCERXkkY2VLE62NGyvZs5DlysHECE8kjA0IK3mKjOgD44qrigZFl7nV2Ii7V1Ga5AK2rQ9FrwOwM= Received: from DM5PR18CA0087.namprd18.prod.outlook.com (2603:10b6:3:3::25) by BL0PR12MB4674.namprd12.prod.outlook.com (2603:10b6:207:38::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.24; Mon, 14 Mar 2022 05:03:55 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::cc) by DM5PR18CA0087.outlook.office365.com (2603:10b6:3:3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.28 via Frontend Transport; Mon, 14 Mar 2022 05:03:55 +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 DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:55 +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; Mon, 14 Mar 2022 00:03:54 -0500 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 v3 2/5] ACPI / x86: Pass the constraints checking result to LPS0 callback Date: Mon, 14 Mar 2022 00:03:36 -0500 Message-ID: <20220314050340.1176-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220314050340.1176-1-mario.limonciello@amd.com> References: <20220314050340.1176-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: 28a601a3-dbff-4746-a354-08da05780a53 X-MS-TrafficTypeDiagnostic: BL0PR12MB4674: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: KAncFr9DM4umKGkl8dfbqrziYe78s0oCco9rWWpjeOe8+La+NHE0UcQIS0cfUqqj5hFDLBYTw3pqUg3zZggr+LvpoaOBU5ZT2hxBoq65AuM2OLDR4q3sslYPf/eVrKzfwa047zIC/1TaoV8k7ZmXhfA4TwU1uEVmRrSrMI4c1NY7PtrS6CgHbkgpHRxBhktieWzgSuYtOcQR6KXQeZ6zDqMrUQTTXQyxAWlCp7ol1X4gyJXuFafI/E+vCTl8dZZNzNQA0r/0/KVY8ihfxeW+Ow6zFSh4plm+li3GBjK8Vdw7ohAJlKu0Kq8qz1dWLbgbS/gq2HdY382Z96qc2sh2nyqru0MrWGL3I5XSDbdzDBrpwnngYhRNY5asSenwai2SXr7jSDQsLAvKx085HgQ/haSzgfzBgJRUSEBz91hn3jp7eFydOnIAAYXyOXkEKicWMDa9embcb4KaDKkdZRVj695S+s9r444ettirMF5iiVYsrNtuQKDKI/1N+PcQok2zp8hPI7UgSkUSfmEChyHf/RjpCFqPBteznybkNaWaDbrYsRZ3g4HkviZ3f4aKdWfnhO9OAahig1cXN4gGYo2ae5c4AV5umnUP17zCruni0OWwWVq7WuzBKJqRlzDw+XpVV9AWlQh9w2xW8AviAvyJ+zjBGX7fcwg7ihSTmBTAExtB+lRupu9kGYQ+ARZXk1AFiOgTRWKuuU0aClVZcZsQUw== 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)(426003)(336012)(36860700001)(4326008)(16526019)(70586007)(70206006)(54906003)(110136005)(47076005)(8676002)(2906002)(316002)(82310400004)(86362001)(83380400001)(44832011)(6666004)(186003)(508600001)(5660300002)(356005)(36756003)(8936002)(81166007)(2616005)(1076003)(26005)(7696005)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 05:03:55.2720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28a601a3-dbff-4746-a354-08da05780a53 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: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4674 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 v2->v3: * rebase on top of changes in first patch 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 69008c4a86ea..646faa117c70 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) @@ -484,7 +487,7 @@ int acpi_s2idle_prepare_late(void) mutex_lock(&lps0_callback_handler_mutex); list_for_each_entry(handler, &lps0_callback_handler_head, list_node) { if (handler->prepare_late_callback) { - 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 Mon Mar 14 05:03:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 551907 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 12D4AC433F5 for ; Mon, 14 Mar 2022 05:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235976AbiCNFFJ (ORCPT ); Mon, 14 Mar 2022 01:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbiCNFFI (ORCPT ); Mon, 14 Mar 2022 01:05:08 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2077.outbound.protection.outlook.com [40.107.237.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A277C186C7; Sun, 13 Mar 2022 22:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DTdwguk6rEtNBGAXkA6JXxw86EPfvYTa0c57Fj2lZpyrvabZR7hRlBP5/v2AfTOrg5UmAn6lR7pdkvb47uce1kuoA0EBYa+90zBmpidQLWdhpy5DQBodi6bUEPXI/36PdVNkVp1HRXwvvtttSNkOllxp2BNuwbF4GIZuAwWQ0iv5t3I609Ztq57CNAEkznjf8svjlx0GmumIqkX9avoNk7He/MCS5H8YkJGmg5ybPPDduNkFh8tHD8DShoUB5S8UWrdji8/0M634Rf/lyVjumdXcIGtHlFkfNkjX4MxYFUBdYJdQ1Wy+57QHr+V2QnmHgAsrdnkIOdbZvASDCCPctA== 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=2EEwbJtm85JwU+uDBFJr1xPlI+JYWu52Zzp13D1ABwU=; b=B1vWaqMYXbr+MjeDrxUxpKD27EcgLMBHkoKwkh0pcRlwV1PsA20PBjWg71fMgoYHZmxpNVis9PsNKrUO2gUk/cgHsXjG+vGD/YAHf3YVJrc2NR7wDut7efY+BhunDbsZFyEYCB+9BPmtJQQi6oNntlL+Ofxi04sJamquccc2QuvesXckEBcfb8IfodEeA2b1xjAeKVw4I5/tCATKI6CFgesQySv2n4nBA66KaCI1ymo2DIy2m8WYNIMdLkyPoHGSCqYB1wfH++TKX9xQFd53a995KqrScK3D+EcbgcsYIlpsMO1AB9jXtD5ixdSmlGMVChdhOiE62AuqZbzrhHS96A== 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=2EEwbJtm85JwU+uDBFJr1xPlI+JYWu52Zzp13D1ABwU=; b=Bz6njrxkTE1fcXnu2gscfpF7Pb01YVYCwMDX6WxX5bLH5WLVWOhy1qRmm3I7jsZ+tGmVk5ZlJnsRQoUj2SleBPG5FLEUu+hN4B4Gs4g6/0Vo8CDzq6pTzKRAS8P10Yr5Hyq45Dfe607mnXVzK37zjNBuB/TtBTh7fgQ1tjOWYKk= Received: from DM6PR11CA0024.namprd11.prod.outlook.com (2603:10b6:5:190::37) by MWHPR12MB1615.namprd12.prod.outlook.com (2603:10b6:301:10::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.24; Mon, 14 Mar 2022 05:03:57 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::c9) by DM6PR11CA0024.outlook.office365.com (2603:10b6:5:190::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:57 +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 DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:56 +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; Mon, 14 Mar 2022 00:03:55 -0500 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 v3 3/5] ACPI / x86: Check LPI constraints by default Date: Mon, 14 Mar 2022 00:03:37 -0500 Message-ID: <20220314050340.1176-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220314050340.1176-1-mario.limonciello@amd.com> References: <20220314050340.1176-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: 50e7f0e9-94f2-4699-be46-08da05780b36 X-MS-TrafficTypeDiagnostic: MWHPR12MB1615: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: bKH1nCyElxa4FYU95Nn3HSF0Ro+Me3uLxELjY3VSg8IXcSHBC1OQ1E/MKjIc2PRjI1BweLGid1NlzUY9RJeMUBiB/claH9+o6TqESltLT1uYKITbb0Nvdx415F7JAUPypHIWVNUQl1mc8rrjTGhoQCCNJmIp314mVsWTIxzisyzAE4qvlBv2chL5rjH39n4sfeEe1DFV0xZ40LrDN40LwJO7eqzcfnf9ouTQWozBZuc+ZhaOOEg3AV6R5380TvncGdJg6FUaWDk10ylc/Gh3pyDzSgzZ+XiitX54QdYhoWeDRjVNwCi8MxJs8REGgGBm/3LEwraHSJBG4wgWNlr5LcTwpWOyJMlM/Q/ma0RZ4TJpIRl6SrMoh9eJ3K4L4PjHISY1b3lJ9AnabN+O2T8d7Lahy1pU/QMkSJG67Ewpmn8zwqfkaGz0BHVqQ+jN3Vl8g0UMzeTPeynwK3MH1w+mJPz4+ScV/0maXccbB1rOnPC0l15aYbz9DyYUefKvjk+OJWZ1vHcnLvOepKlsr1qlDvuaybKlT3T8eABB99jhaDIsRGUcz5LHnnL182ysVI0PefRSBEWAeXjtAXWIVPKG4uAP2SiQqDnpqzTTweYFxkyUxoQHvUibTbIXF/sSfTmqV2jfpgNQvoDYrXUhgX2k/2yD7ZY8LYU/DbOqYEvXpThd0eB4KlqXsiyznfWegmCbM2ehzEo73vp2DmzC1X2JFA== 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)(36840700001)(40470700004)(46966006)(316002)(36756003)(4326008)(2906002)(54906003)(110136005)(70586007)(70206006)(8676002)(6666004)(7696005)(8936002)(5660300002)(508600001)(44832011)(47076005)(356005)(83380400001)(81166007)(2616005)(186003)(426003)(1076003)(16526019)(26005)(336012)(36860700001)(40460700003)(82310400004)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 05:03:56.7604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50e7f0e9-94f2-4699-be46-08da05780b36 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: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1615 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 v2->v3: * no changes 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 646faa117c70..2a15e61406a3 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 Mon Mar 14 05:03:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 551906 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 C8036C43217 for ; Mon, 14 Mar 2022 05:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236079AbiCNFFL (ORCPT ); Mon, 14 Mar 2022 01:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbiCNFFK (ORCPT ); Mon, 14 Mar 2022 01:05:10 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2076.outbound.protection.outlook.com [40.107.237.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDA21AF1F; Sun, 13 Mar 2022 22:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZftCgXv0r8zoy9HUIWNg3G4TCjYzkZI/xdChAtgec0MAcP0plo1MkeTbA1xbEtSGfsdVe1d+Sm3DrkCSDOvhbU+O3LZKeV8DLLlNIztfywLxoZI2iff02IqSh1CuifANY9eoC9boE5PIyTZnRX4Cj0vn5PCoEO3UoSvp5bf6PelMqekSAhPp/ogfyb/oY5F8VOi68mD4JBd6V+LOFUFXo1O2W+GOV02QrX7B58EXZA52QAmM/Exy7L09+cX+b6CFyEEqZDag50OkqBQVJyIudg/5v/h/ag6FNJ0iHPNYAeCUDqTU2eRXG8xdfJO4eSvhoJqTF4/GnSTkBqAXdtWaZg== 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=CQ2j7lNsdwJuNrfGw8p6BimaJef8ofP94J4kuhzmYxw=; b=WbN/Ki1KtaeM5A4LIhnDlP6r5fv9Md9pQQ36iylOCyuUJcJj9rDUzDUjx+/S+HYgLHMehNUa7h4x06Vs/l4kfGNcnfyBfr0+p2AGNAbAJLrmoQ1jtQiK6CqKV6CKwzC14tjmO+vb1qtagW9eqtNkmutSWU+lXRVyAsjQg6hDhVlK+in60QWycw9FeNw0USKDvl97UWL8eGchmld/2TL+Md4hZRSbMwVl+EQwTVCWgZJW03dbGDLBZgHyYMeDX6GROTnWf+OTo3y1YW8EEuBjo76CAdP648jn28ujuZRf8TF0vULoacvalIJN++zQCFEnWH8uD2Pla5/0ikq6tTackg== 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=CQ2j7lNsdwJuNrfGw8p6BimaJef8ofP94J4kuhzmYxw=; b=s1gT129RydtKeFIT34bSK2G5v6F2uGKNGPYxwwHi1cINpfYS/tZHH2+uMSKrYMMd5u1BeyjtlFn2pcpfRMqtyKFGtxL1Oje1yCaGDsa8+f8vZO8eA7KWeRKGg3SM3xB14j3YDvOrSC8TVpFdWVxaxrSV1/EJS1pkbSIelErt8uc= Received: from DM6PR11CA0027.namprd11.prod.outlook.com (2603:10b6:5:190::40) by CH2PR12MB3895.namprd12.prod.outlook.com (2603:10b6:610:2a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26; Mon, 14 Mar 2022 05:03:58 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::95) by DM6PR11CA0027.outlook.office365.com (2603:10b6:5:190::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26 via Frontend Transport; Mon, 14 Mar 2022 05:03:58 +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 DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:57 +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; Mon, 14 Mar 2022 00:03:56 -0500 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 v3 4/5] platform/x86: amd-pmc: Move to later in the suspend process Date: Mon, 14 Mar 2022 00:03:38 -0500 Message-ID: <20220314050340.1176-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220314050340.1176-1-mario.limonciello@amd.com> References: <20220314050340.1176-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: d4fb2665-9415-43ac-78cf-08da05780bd6 X-MS-TrafficTypeDiagnostic: CH2PR12MB3895: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: 9UcwCu8TLZSz1PbkmK5MfrmNI/LGaEHtHBRNeG7InPiJzWkB3WlGfIf2C9nV7t7vJ2K9ZLoQJsJ1zk9BwTvKr7fXADKdbuzlCOmQg8cn/eaaX+dE80afwpFrGXPTvqSfQJGuqm066QSPHwQ6CmTQJji+RdWuHrB78HdPYja8Zu6iiw/RUZlc9heQnSM+bhU1/NhMqGUKU23CWWAo+D8RG1i9dchgVjiCFSS9Yui4l6AaaaK/LzIUA/vKTwg/XiSXWIThtb3Z/7zEbrfYCs2khYZK0cWZ/sJHgfXq32wtJRRMcEl+p6hu+xPK61OYIsgBWaAhlEA9N7EvkYXdN2s2WPl9ysUSduTblgfKgE1OGtfhcXNM/ZQA7R8Pnr6vDY9EvE4MSis7t2Kj2fVmZAOf3wsWb0BDqZQkU4STZW5TOOQtOCHoSgh40rxRySCYy7dPweqm8fTRucJO+DmfgVoGM5lv2o+NbXMkWEd+s5k89LKlOG2cPmK5Z0BND0lW5RIZzXG3fuD1E3qJZZDkrV/bVJL/tFGRmXsVIh20MpwzcAE/nL96QTVPMB3QyzBN99fal68mjpfnpJQcpqIX4OaItgFL8IEVCHjOzOVXm/zUj+UNd9BrvHBayn/ZEV9GmUvdVIgmySgb9dlHq5WemR0OtcUX8uSZtvIEzuqgQe0m7LSmUIfmdcMJk5VoW9P6IZiKoeypOsQ7gJPBhixctacQWw== 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)(36756003)(4326008)(40460700003)(70206006)(70586007)(7696005)(336012)(426003)(6666004)(508600001)(8676002)(47076005)(36860700001)(8936002)(356005)(15650500001)(81166007)(5660300002)(16526019)(316002)(82310400004)(54906003)(83380400001)(2616005)(110136005)(2906002)(186003)(26005)(1076003)(86362001)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 05:03:57.8072 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4fb2665-9415-43ac-78cf-08da05780bd6 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: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3895 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 v2->v3: * no changes 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 Mon Mar 14 05:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 551905 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 21771C4332F for ; Mon, 14 Mar 2022 05:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236097AbiCNFFY (ORCPT ); Mon, 14 Mar 2022 01:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236072AbiCNFFL (ORCPT ); Mon, 14 Mar 2022 01:05:11 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4856920188; Sun, 13 Mar 2022 22:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RD0TBPPp2TBu/KGArjYzOZ9ujMSvp5OTc7MtIL/ATUmjZAo9jGsuM5kT4a0VwbKWZYG7cBEkhzxrLv+QIIBgzL8gR6TP+JsjgkM6tbrWFAyKuT1I8R9UCaIh0wIGe9a/3bMTc7IravdjBn5K0ffB6UyZFyMA22NdX8KDU9ZYAMAyHFCvirv2/7AyX3XEmGUpb3DPGgyBS+UFXJl+gPtD6H58aXEjAS1CSLegv4A2ipDnCqFGPd0lcnG8BErTE1RWcraxLJ3p5njzDG2JRLCEQAtnTRJ6AZ8N+8mJcfA0drVIThw2YRUTwUCAv0YT8/ifc3nhj+Kk2QDiwrENrEiHWw== 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=h5TVyr//jUEN5D7p9K4Qe1d7lgRffNBF4GaGYWGSJio=; b=BhJ4lkdpJGiDfWacy1S/+4Yvytms2Ak8F/Xhb7AbIGSiuC1OLc50UFR3SdsGmBCvgBqMW9+0pqpJUPVHsYjk6WlSm1RieD1D4ee7U3UxkZMy+DcyNCIVf7rQHBELLnsrfFTnAw1FyMW3lIyQu9fbmEARqjLKWOBV7M1+TpBNoehp/Luj7S6x8embCo0G1s3ahTMXRKpLw6mPE/3KXmch539g5vjlt+Uic9iok4NiSgGbUC818CTdIgr18wvoUIGIemz//7Qs9D6cLMJYwWpOr4/k3MonQulv4Wqa6DOMpwkI961I3WRNKuAgSpZ3AXsTv1sN4TX/tceknopooN9Ccg== 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=h5TVyr//jUEN5D7p9K4Qe1d7lgRffNBF4GaGYWGSJio=; b=IW3bCj3NLv9rpI/RwYnoj6FjRbXolhjPWpoqzlBJZv6Jk1n2/2C4kP8CjqowYDo7aP5HG4G930Sjn98Mw0DnX2Lge0qjScN9Lxbxtx5gDwgipxPF5ZR2P3K3fvD919boZXb73ZDTpZw3bulfz+jMXHxGiEVmXQBxtKNGqbmjJRQ= Received: from DM6PR11CA0017.namprd11.prod.outlook.com (2603:10b6:5:190::30) by MN2PR12MB3902.namprd12.prod.outlook.com (2603:10b6:208:169::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.24; Mon, 14 Mar 2022 05:03:59 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::e9) by DM6PR11CA0017.outlook.office365.com (2603:10b6:5:190::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26 via Frontend Transport; Mon, 14 Mar 2022 05:03:59 +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 DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 05:03:59 +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; Mon, 14 Mar 2022 00:03:57 -0500 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 v3 5/5] platform/x86: amd-pmc: Drop CPU QoS workaround Date: Mon, 14 Mar 2022 00:03:39 -0500 Message-ID: <20220314050340.1176-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220314050340.1176-1-mario.limonciello@amd.com> References: <20220314050340.1176-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: 45dc098f-b4b7-47ee-dedf-08da05780cb1 X-MS-TrafficTypeDiagnostic: MN2PR12MB3902: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: +GnzFR2d/FiLKAbcwpDto1Of8w+/5A7oFEBG5KaLMQurOZR/u5UI5NzPPnK/XDVY+4x/Y/LyBRKvpjOZ54cxWHr77NGb6XeNw3VnYXL0HJHfA16GE4JQLjUtUB0RyiCc7nO3VI7UkCjeFBt/4zIYAoY/XE7cYJco7ZUUjDCoGdNyy9sXjHNU25czjnY1tFIbJFEjR7MU8V6U27cZwSPuH9MmxUz0F9ODzvmz1ncJX0o/iHLuQKXiAD1ZDW18kN4wDnpoWvANfB8GW1IK/pdQrKyI8sYchbxCS/gGS9bHgp2BwBuScoc5re4ra2mm+596ljtNWMCOs3+UTMmd1AS6pt4al6h37g3Ic/+v1aOGk21z6eR1k7h+WTleU7Y7YPFuj9xqle6suxA1omlK5RiU0iD1Fq9ypUTGGcoY7bvpIcffw1IB/26v9d2jaGHAZbeNbjftIjDD5fu3NVGx3KrD9/evKeNFzM4pW6hwDktTso21lybzG7M2MZhJ/ei5tf0F2vbtr8mP3v1h0KLcroydDvF4gXoEZdgKce/cdpOIqFDbXhuAIl26WVtRVb3M0/1lkRFyY3HGvgRw4UrMbl6vsLEX0topjvTtJ9aaiOJnDOSB9upZQMCD4BkWN3JN30dFt6KH5T3rIGFr2py8dK3D8eJ2jiHq6yn21NkuopSmvDnHB4xZ6ctY4ffz8ljAicv50MCICNMe8vlI01BRYWiAsg== 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)(36840700001)(40470700004)(46966006)(4326008)(8676002)(356005)(81166007)(40460700003)(336012)(186003)(83380400001)(16526019)(86362001)(2616005)(7696005)(426003)(1076003)(6666004)(26005)(47076005)(70206006)(70586007)(36756003)(36860700001)(508600001)(82310400004)(316002)(54906003)(110136005)(8936002)(44832011)(2906002)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 05:03:59.2450 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45dc098f-b4b7-47ee-dedf-08da05780cb1 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: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3902 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 v2->v3: * No changes 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: