From patchwork Thu Mar 17 14:14:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 552278 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 63684C43219 for ; Thu, 17 Mar 2022 14:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234863AbiCQOQf (ORCPT ); Thu, 17 Mar 2022 10:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234870AbiCQOQd (ORCPT ); Thu, 17 Mar 2022 10:16:33 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52AE41FF20F; Thu, 17 Mar 2022 07:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bksMLw3LCyRGvXEQqIZ+jcTAsS7SeyjsTflh7BxP7j1YIZZgakbHO1Jgn/QLaVgaDdEDLF7vCgk9lg6rMzbw9OzSYUgAcXWvy70rP4JqwDH0oPNg0mu3KT5+2XfsEihuwNUJO0HADq4+IQxhfPAhdpokynVfGMhiSLqoQHU5TvvzuzZL3ECDJZFFPJ9HYcmhYOanOIZkB36QLCiIEieaCNnYVrZXvyJmHyde+55v8tYd59OkJRCtrKOssgmU8eXmnYaVze6ib1Od//NcEeYqLqXH//aPeRt6hYh9//qkV7yw8EHhpv4t0GabIbb5EuWqX4PRW3glwZfbCeB6q863QA== 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=7M1gV9LyFfFREVAC03lv8Ez2TmM1MkdTR2uk/mA5ePY=; b=L1deEq7pnFaFoURakZU/G4h06dDu0X26TfpetxOJuDWYRm6i0G/5zDN/Bctp8JBh4UmQkqzTXiWs4aXpSiv1f1TSdLEEr2Jjn3zTYU3ElvKatnnrc7P0smgbg7DQwwpUATDzrBhXor9B7HlUH+5JbofkYVmTtLAQ8abQ34ns+uT6sNsG3nGqBdTv7aynkeAEVfkSPh1+/4Q3ZZhq5RO7LEhZIeTFuHfkGl4LytgmvOexnBbz977T//lBXWqf1rvneXGeuetW90qQiBfWIhlEfaYMFdKQ+CvBQ4XeS+XibMh4BIWWUzj6N+9QUI/0KnH4Zff30HLJPE9coi9Ms4VMqw== 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=7M1gV9LyFfFREVAC03lv8Ez2TmM1MkdTR2uk/mA5ePY=; b=2Sq1UoVP4E0QE7FxkH7yBE4k6T0dDdvnuD+u7kOALDMIhzVVkFHl8sfRTggAC+Au/03S0yMhpyFQNEU9sjJ/vMFOXkXKviTOGgSjTAU3olbbHCg5ToVeqvyZxE/t/AI4ZfuP0cbDBV+w/Wjim1Hghpw8tuNoVIR2MURHPGc/kLg= Received: from BN8PR04CA0046.namprd04.prod.outlook.com (2603:10b6:408:d4::20) by BY5PR12MB4856.namprd12.prod.outlook.com (2603:10b6:a03:1d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Thu, 17 Mar 2022 14:15:05 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::1a) by BN8PR04CA0046.outlook.office365.com (2603:10b6:408:d4::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, 17 Mar 2022 14:15:05 +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 BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5081.14 via Frontend Transport; Thu, 17 Mar 2022 14:15:05 +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, 17 Mar 2022 09:15:03 -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 v5 1/4] ACPI / x86: Add support for LPS0 callback handler Date: Thu, 17 Mar 2022 09:14:42 -0500 Message-ID: <20220317141445.6498-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: c380edf7-26e8-4b38-1cb5-08da082088cf X-MS-TrafficTypeDiagnostic: BY5PR12MB4856: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: M94LIrEtwXTuQ0pahOEVN897a9dZ+rvo4V9ea/mR/2i7wUpi8Rf2J1NWbBgO24MG9EFJaaubn8hZcG7Chh8+94oASnMqG/d1hgWOn13lwgToKYJ8Yr5ec/dv3i3nbpFLsqtdvntsLqQQpyLni0SyYZjvhONEiPiMdMW2t5eio/IBKfPv0rdAMWPswRuU5Qipxe25rgTmQsM0cq2KVMsABMr9a7InyY+fPpE+LXEzD3V/Bimu0vyBejimllr+wpLbqM0cv7xIH8v4v9jeAnbYCxUMWEDeySKomwYp4hZaDZlp+7pXSabDFbi6NmPr0MsZbyfSBVVMqNQmMymMBEZG2I9tErhxW+w5QBRAW/sN4+7iUYHwfwG+wdC/IWtPgKR8tMn7V1WOcadjEplMGhpMGcH4197facv9/eAeFgnZ61OE/I1JRCxbYOpazRS65p8MKxeaQc0zWTodkI8VHMNGRMpNuZ65Ee/lm/yTwf5yuFKtqL+uK1+U4Nc1MO1I2+KZN6PZTs3+Uy1xR7z5uI8LSriFRluc3XNL40Opq+xq781VAx0GT7JpC/DpHlUo1N7x+Tl8jOjoJrq8oWwMVtEa4bGg0DsBIlohz9LQOo4QDW0YT0lKmLZmDK9clWhO3RWR8XfKKSHcpS5N2X03lE/r6a9rAkYDpkGdp8EgwSFv+H213APgvoU2xOTRPkCZErlrc4JvDE3TmNNmz5ow5ZqB1A== 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)(1076003)(336012)(426003)(54906003)(16526019)(186003)(26005)(316002)(7696005)(36756003)(6666004)(508600001)(45080400002)(2906002)(44832011)(4326008)(82310400004)(36860700001)(86362001)(2616005)(110136005)(8676002)(70586007)(70206006)(83380400001)(40460700003)(356005)(81166007)(5660300002)(47076005)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 14:15:05.2971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c380edf7-26e8-4b38-1cb5-08da082088cf 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: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4856 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 v4->v5: * fix a check for handler->prepare Reported by Dan Carpenter changes from v3->v4: * drop use of mutex, use lock_system_sleep instead * don't pass argument of context, driver will maintain this internally * don't allow failing prepare stage * don't allow unregistering if sleep_no_lps0 is set 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 | 40 +++++++++++++++++++++++++++++++++++++++ include/linux/acpi.h | 10 +++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index abc06e7f89d8..031b20a547f9 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -86,6 +86,8 @@ struct lpi_device_constraint_amd { int min_dstate; }; +static LIST_HEAD(lps0_s2idle_devops_head); + static struct lpi_constraints *lpi_constraints_table; static int lpi_constraints_table_size; static int rev_id; @@ -444,6 +446,8 @@ static struct acpi_scan_handler lps0_handler = { int acpi_s2idle_prepare_late(void) { + struct acpi_s2idle_dev_ops *handler; + if (!lps0_device_handle || sleep_no_lps0) return 0; @@ -474,14 +478,26 @@ int acpi_s2idle_prepare_late(void) acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY, lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft); } + + list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) { + if (handler->prepare) + handler->prepare(); + } + return 0; } void acpi_s2idle_restore_early(void) { + struct acpi_s2idle_dev_ops *handler; + if (!lps0_device_handle || sleep_no_lps0) return; + list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) + if (handler->restore) + handler->restore(); + /* Modern standby exit */ if (lps0_dsm_func_mask_microsoft > 0) acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT, @@ -524,4 +540,28 @@ void acpi_s2idle_setup(void) s2idle_set_ops(&acpi_s2idle_ops_lps0); } +int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg) +{ + if (!lps0_device_handle || sleep_no_lps0) + return -ENODEV; + + lock_system_sleep(); + list_add(&arg->list_node, &lps0_s2idle_devops_head); + unlock_system_sleep(); + + return 0; +} +EXPORT_SYMBOL_GPL(acpi_register_lps0_dev); + +void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg) +{ + if (!lps0_device_handle || sleep_no_lps0) + return; + + lock_system_sleep(); + list_del(&arg->list_node); + unlock_system_sleep(); +} +EXPORT_SYMBOL_GPL(acpi_unregister_lps0_dev); + #endif /* CONFIG_SUSPEND */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6274758648e3..47c16cdc8e0e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1023,7 +1023,15 @@ 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 acpi_s2idle_dev_ops { + struct list_head list_node; + void (*prepare)(void); + void (*restore)(void); +}; +int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg); +void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg); +#endif /* CONFIG_X86 */ #ifndef CONFIG_IA64 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); #else From patchwork Thu Mar 17 14:14:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 552279 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 720EEC433EF for ; Thu, 17 Mar 2022 14:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234824AbiCQOQd (ORCPT ); Thu, 17 Mar 2022 10:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234848AbiCQOQ1 (ORCPT ); Thu, 17 Mar 2022 10:16:27 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2059.outbound.protection.outlook.com [40.107.95.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9648ECB17; Thu, 17 Mar 2022 07:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eiXYAullecjtspQLDlDeFLALK0/rzHFs/E7bO4C/vGG9DEnYDFive76CzwjSjTVSanKtSaOqf9MCJh2NrHXYqdbCYP4np2Iou7DAuW7oWo/7BkIOliEBGI0o2bQhiQ/HyyHBWS4bPccG/trbmahxy91RHJhm9rqxvszQ1uaOHDFz5Zrz16CbzBjfQT1LrnOtJ8P4DVxZiIyq0fCcofQgsu1LTy2M8bjhQrkSVD+NmiBoqexkvSMVwtZBm06UHujxcvpCWkwmhC5FsxLaJKij7asdEL95YmPGcz6GQYirVzqygF9Krh1NBFYMsLdcIMXZsDMEpk6ScQp7zAKQraAZmA== 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=ccntNUft3rxRS8sqHb7obrLny0Zd4Tn96eaN9I0Y7Rw=; b=JwXK1rsyZ3k3nqoT6+MZTHzHGIFYI+dPwDieFIYp2OvbRPrbTuL/JLPcu/yacW1q26H0GfvYzk9mIlu9vGXCDhjz7v0CSPJ07IiDjV3rryT0jZAiA54MxTclk2MqQd8QExIagQVevGrN1X88/Zivc4xa8Jai0wQt38hKtRNjPkbzYZCFA9lnEV6uazxmyUvjDu5Dw7Jmfy3gkEFuG1sEJvEt6gdDlQI7Fd2mut1cUDv2uxpl+45y0nyo08+N6punhUtvAz3oAn6nE9wVDZ+y8ZdQzIxzYqdZYFy+toLwgwZk/Zi9JS4bwU0nodIJvasFcngepyMJ4rzg+RO5mbHKkw== 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=ccntNUft3rxRS8sqHb7obrLny0Zd4Tn96eaN9I0Y7Rw=; b=m50cmO41XHX7nxXh+rpt1LrPY6bpNbcKnd4YkEOYqqXn7U5YlaxAra3mvTh8X+EVPxUx98wQFkfzMQzpMigqc1rc0mcvQrFj5dVz5WvwFYatErRBzYl94kn2EzLfEvcRBx6bDLkls+hL815rNphvpmuykKma9tTqu+SGEjIn/wQ= Received: from BN8PR04CA0040.namprd04.prod.outlook.com (2603:10b6:408:d4::14) by MN2PR12MB3104.namprd12.prod.outlook.com (2603:10b6:208:cc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Thu, 17 Mar 2022 14:15:08 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::ac) by BN8PR04CA0040.outlook.office365.com (2603:10b6:408:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14 via Frontend Transport; Thu, 17 Mar 2022 14:15:07 +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 BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5081.14 via Frontend Transport; Thu, 17 Mar 2022 14:15:07 +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, 17 Mar 2022 09:15:05 -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 v5 3/4] platform/x86: amd-pmc: Output error codes in messages Date: Thu, 17 Mar 2022 09:14:44 -0500 Message-ID: <20220317141445.6498-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317141445.6498-1-mario.limonciello@amd.com> References: <20220317141445.6498-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: 801993bd-e654-47d8-f952-08da082089d2 X-MS-TrafficTypeDiagnostic: MN2PR12MB3104: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: 5H6kTKtajuNra4/JsoT26b/QUq7GK4vynXFQcoBtc9LT2zO5hH9g7+psVfRRVWoLH8DfKIqP+fpv9nSIkh4vCj0Ix/r0JYb56NLMcMZM9eSpsOMl8uZ8Nn9f2qB85FPoY3DLL/mPkEBCxrwacgV4t52tpmlSIgmbrg5hliZ7vt3LFkpOJjXgacmpCAg/gCdpzJNIE2MZvc1/8NoeFlBvVd1m0K6IPf1l+NeqLJ8/VPqOkjngcAKQg4xkLMo34/6xApthK1V7pXXIA/Dp07pD8LizKD7V9wnySVU6WJbYybTYhpIQG+l0TcJ+W6/YMmbz9HaDeyaKLjOE6wEHLXMmdNwp7IFkgX1bNJUaZTOaVkJoWrpqMChToTxLkyqMTpT4Cs8pHv49NEkBI7/uIg2H/JsEVeSnoVRQ1JkaM7qnl+8kW0zSJ0C/ZkNRqwQUmuOtbnz8najfv+mo9yu+rPC7GiDLkmdq1Tst3ciUC8oJnMC+BBRzVXqg6BDWxJrGwNQOOo/x0DZxqBM3SjwOYdIdbjR3xGcQ6FHd2ELe33Ljulc9VrKto6n26heyTt2PwD0Gz+pkwLGCYbKS8cOK9rr/TkP6HMrqkzVyBkeuRGBNSL0l2ayVMBmE+GlaqR1LnLjwIraoReXr2wXOUssbf/mtSWlV+j4NrvRfgfI0lERwdgqA4XWemzyAZVTtYjoUUCyeADoQdx9SdxOex+jjBV5sVw== 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)(86362001)(8936002)(70206006)(70586007)(186003)(44832011)(8676002)(4326008)(2616005)(110136005)(2906002)(54906003)(36756003)(26005)(16526019)(5660300002)(82310400004)(1076003)(508600001)(40460700003)(316002)(83380400001)(15650500001)(36860700001)(7696005)(47076005)(336012)(6666004)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 14:15:07.0002 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 801993bd-e654-47d8-f952-08da082089d2 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: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3104 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The return type for the s2idle callbacks is 'void', so any errors that occur will no longer be displayed. Output these error codes in the messages in case of any failures. Signed-off-by: Mario Limonciello --- changes from v4->v5: * split from previous patch drivers/platform/x86/amd-pmc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c index 2736ab587f2a..f36cf125b284 100644 --- a/drivers/platform/x86/amd-pmc.c +++ b/drivers/platform/x86/amd-pmc.c @@ -653,8 +653,10 @@ static void amd_pmc_s2idle_prepare(void) /* Activate CZN specific RTC functionality */ if (pdev->cpu_id == AMD_CPU_ID_CZN) { rc = amd_pmc_verify_czn_rtc(pdev, &arg); - if (rc) + if (rc) { + dev_err(pdev->dev, "failed to set RTC: %d\n", rc); goto fail; + } } /* Dump the IdleMask before we send hint to SMU */ @@ -662,14 +664,14 @@ static void amd_pmc_s2idle_prepare(void) msg = amd_pmc_get_os_hint(pdev); rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, 0); if (rc) { - dev_err(pdev->dev, "suspend failed\n"); + dev_err(pdev->dev, "suspend failed: %d\n", rc); goto fail; } if (enable_stb) rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF); if (rc) { - dev_err(pdev->dev, "error writing to STB\n"); + dev_err(pdev->dev, "error writing to STB: %d\n", rc); goto fail; } return; @@ -688,7 +690,7 @@ static void amd_pmc_s2idle_restore(void) 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); @@ -700,7 +702,7 @@ static void amd_pmc_s2idle_restore(void) 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)