From nobody Thu Apr 9 00:18:12 2026 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 60E90FA3741 for ; Mon, 31 Oct 2022 20:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiJaUnl (ORCPT ); Mon, 31 Oct 2022 16:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiJaUni (ORCPT ); Mon, 31 Oct 2022 16:43:38 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2055.outbound.protection.outlook.com [40.107.100.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1D112AC9; Mon, 31 Oct 2022 13:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mlDmf+Of72l45eKE03GQgAZ2QvWMLcFWCKpt9vfx/X/cmJVQ/QSynKb3jGM/Zg2EQktlUbkCpdvYdj41UnIz136mzc2OcvHHSI+jfXLhEFRALkj+nRsF3y2tw9kN5akYL26wI3w5j35AZjWG3RknWT03BNZbq4fL7uCnnmHOvPswWipsPb0q/+VdxepsJJ1GtXxfvqr+fOViXtgwYSnLs28R1M8jThtbbQfo+GtXVqtCIx3OQPuc/F1aTPCyEOTqdOwtHOi65nC6ROtF4ZxckXADA3TDWo13v/7O5wEcah/Q7Icn8M7BJG0Nv242Pl1Lwfr5r9nUic8B0i8E0iDIJg== 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=dpe+l56ZW2oAZF/ck3Or05d3pEtIhETD+DyOuTJk0vo=; b=Ux1ejWKOGJ6S8AHHYnmkU4WNZ45OzlUHQOl+QozXCPH1Y3KKh6UT8bDxkCdclssnfl7y+/FLegukSiiAkLQ8ceSIuBoHn7CRBW6X6ZFf8s8zzLhls6JYuG76gWc6frVX1fN2lqewj5e1xE8IR9caXpc0EcoArssvJudcSFw31ZqwV9DJf7w9imDLtN81IqjkMO/PBTFZchpKN6Az99gUW0NUqPB/wr64W7Q8xBD5AhmGRLGLHHW3clPCzBc0i/O+If4RGna42BHzjidywD6/H6ohl43sNCY/4lL45rotnW/fSOxyGbPoh2Kw801K712GjtqP2a2Q6J4akDtTFkIqfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dpe+l56ZW2oAZF/ck3Or05d3pEtIhETD+DyOuTJk0vo=; b=DeZ1dPk0SVtbhLCgThkpTEQcjTtnN1I+4qqs/cNhE1LAqvvNP6LMiUecQKw+ZKjblTkb0Mufn8zlnxJRdJ7sa0WicMOoQcidziyT6WCFlCSBZ4Zx309WmjURwKCAPWjGFmLg+2HmXfMsP36uRQdmPI4Ma655jjKOHmDHOiFHsBA= Received: from MW2PR2101CA0016.namprd21.prod.outlook.com (2603:10b6:302:1::29) by BN9PR12MB5066.namprd12.prod.outlook.com (2603:10b6:408:133::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Mon, 31 Oct 2022 20:43:34 +0000 Received: from CO1NAM11FT093.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::9f) by MW2PR2101CA0016.outlook.office365.com (2603:10b6:302:1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.1 via Frontend Transport; Mon, 31 Oct 2022 20:43:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT093.mail.protection.outlook.com (10.13.175.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.21 via Frontend Transport; Mon, 31 Oct 2022 20:43:34 +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.31; Mon, 31 Oct 2022 15:43:33 -0500 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , Pavel Machek , Len Brown CC: Rajneesh Bhardwaj , S-k Shyam-sundar , , , Rajat Jain , "David E Box" , Hans de Goede , "Mario Limonciello" , , Subject: [RFC 1/3] PM: Add a sysfs file to represent whether hardware reached the deepest state Date: Mon, 31 Oct 2022 15:43:17 -0500 Message-ID: <20221031204320.22464-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031204320.22464-1-mario.limonciello@amd.com> References: <20221031204320.22464-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT093:EE_|BN9PR12MB5066:EE_ X-MS-Office365-Filtering-Correlation-Id: 95bd8303-cdb6-4c48-4ad2-08dabb809467 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hzkaB13Ix/jriBV5JPGgHv6APWo/Kf1480n/qu04jshfpzokxeRwHCBkEDVxCS1AJRMZnGsXeOZFchvGvN97p2lu/+/JRXkgbq5uWuJxiwp5W1WV0KquTaxKxbPyYfY8TeENMEOQENhswwtZCg1TCo+YsX9R2CYbnvAC9yU8Clsup03TFoL6SZj0VQvfw9KULN9GFb3Jd9JtY3XfDGOtCv5PvQtbJNTmhhoZ5T76JQzAxA12ksJzikgVmcR4LdSJBMs0i1EzzZGIs8JlUsqO15PN1wvZva5/dN6FhQxd600xfjKpo7S8oOp1A/mRBd9m87EDkVfAPDTOBTeXa5shRoOnisNoubCOlfd+S3BgQE/N+t/ytlOh0kxvgPyU4hsMahpyl6u2Zv7TLS1uq/eVBRO6JrhpsjHJ4X2amVDk5/qKUaGGUJ3P/t0+wKgndiuH38/OwRke/CTuTsUJ2mAoY5wjCshp/v38YL/cCST3ocJbYSpblC4x587/s/hjO4WY1dmi/cRUxP/hpbWgIn8qU/4jxDAkYVysT0UpneRj95duqP+fDMLmEUJM18oocoNwnzhcHBKPrKCKABP4S87dvgmxsVeHAFU8lXAJQQUIn/VYSYXfdI2OS1lCDvFe5MnFSJvtBoe21XU2jxRkhE5rizR4GxUqAvWh3rGY6VtIEZncI9TvUSiydi7esd98L4RGmPi47L5fuRMCRMclEXL/9BwgoByzwDZSVDY+2tldGkG2KNw7yMC3gUJnaUE9zRJ7IynK3lB9NndyFQ5/FsmEO5RJoHryvShN58PJZmcSARSyn6zgO/hy/xu5BmEehx7/ 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:(13230022)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199015)(46966006)(36840700001)(40470700004)(2906002)(8936002)(5660300002)(41300700001)(7416002)(54906003)(356005)(86362001)(110136005)(81166007)(70206006)(4326008)(70586007)(44832011)(8676002)(316002)(2616005)(26005)(47076005)(336012)(40480700001)(186003)(16526019)(6666004)(82310400005)(478600001)(36756003)(7696005)(83380400001)(426003)(1076003)(82740400003)(40460700003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 20:43:34.4633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95bd8303-cdb6-4c48-4ad2-08dabb809467 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: CO1NAM11FT093.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5066 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Both AMD and Intel SoCs have a concept of reporting whether the hardware reached the deepest possible hardware state over s2idle as well as how much time was spent in that state. This information is valuable to both chip designers and system designers as it helps to identify when there are problems with power consumption over an s2idle cycle. To make the information discoverable, create a new sysfs file and a symbol that drivers from supported manufacturers can use to advertise this information. Suggested-by: David E Box Signed-off-by: Mario Limonciello --- Documentation/ABI/testing/sysfs-power | 8 ++++++++ include/linux/suspend.h | 2 ++ kernel/power/main.c | 14 ++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/test= ing/sysfs-power index f99d433ff3117..25c52d7469b9c 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power @@ -413,6 +413,14 @@ Description: The /sys/power/suspend_stats/last_failed_step file contains the last failed step in the suspend/resume path. =20 +What: /sys/power/suspend_stats/last_hw_deepest_state +Date: December 2022 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/last_hw_deepest_state file contains + the amount of time spent in the deepest hardware sleep state. + This is measured in microseconds. + What: /sys/power/sync_on_suspend Date: October 2019 Contact: Jonas Meurer diff --git a/include/linux/suspend.h b/include/linux/suspend.h index cfe19a0289185..30b8a8018299b 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -68,6 +68,7 @@ struct suspend_stats { int last_failed_errno; int errno[REC_FAILED_NUM]; int last_failed_step; + u64 last_hw_deepest_state; enum suspend_stat_step failed_steps[REC_FAILED_NUM]; }; =20 @@ -489,6 +490,7 @@ void restore_processor_state(void); extern int register_pm_notifier(struct notifier_block *nb); extern int unregister_pm_notifier(struct notifier_block *nb); extern void ksys_sync_helper(void); +extern void pm_set_hw_deepest_state(u64 duration); =20 #define pm_notifier(fn, pri) { \ static struct notifier_block fn##_nb =3D \ diff --git a/kernel/power/main.c b/kernel/power/main.c index 31ec4a9b9d704..1bda5d2d26c53 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -54,6 +54,12 @@ void unlock_system_sleep(unsigned int flags) } EXPORT_SYMBOL_GPL(unlock_system_sleep); =20 +void pm_set_hw_deepest_state(u64 duration) +{ + suspend_stats.last_hw_deepest_state =3D duration; +} +EXPORT_SYMBOL_GPL(pm_set_hw_deepest_state); + void ksys_sync_helper(void) { ktime_t start; @@ -377,6 +383,13 @@ static ssize_t last_failed_step_show(struct kobject *k= obj, } static struct kobj_attribute last_failed_step =3D __ATTR_RO(last_failed_st= ep); =20 +static ssize_t last_hw_deepest_state_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%llu\n", suspend_stats.last_hw_deepest_state); +} +static struct kobj_attribute last_hw_deepest_state =3D __ATTR_RO(last_hw_d= eepest_state); + static struct attribute *suspend_attrs[] =3D { &success.attr, &fail.attr, @@ -391,6 +404,7 @@ static struct attribute *suspend_attrs[] =3D { &last_failed_dev.attr, &last_failed_errno.attr, &last_failed_step.attr, + &last_hw_deepest_state.attr, NULL, }; =20 --=20 2.34.1 From nobody Thu Apr 9 00:18:12 2026 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 774C5FA3741 for ; Mon, 31 Oct 2022 20:43:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230118AbiJaUnu (ORCPT ); Mon, 31 Oct 2022 16:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbiJaUnn (ORCPT ); Mon, 31 Oct 2022 16:43:43 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D59F412AF7; Mon, 31 Oct 2022 13:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oTU1F5yQm4VIBb2f0YFWbiHD7Qu0nIVOE7dlpga+v0dZetq5BDBKHiPGJ51AIVSdYjpHnOlpaZCS+sQCsZk75FMI9aRHl9zgRcNVgzRd+4Ql87N0rQMMGZ+NwGYA/m5+Ty+/Zy7A4oWI06NCVJmE8gaH2+8kyBH0V8gSE2IMScKQg+sY/NvCKlgFRuVX29jrtc6d93h28OZlH8x2iMiPiYh3MRpYjRFSMa2esbMZKEjLn1oDjdkPPEB8yjHG/eHPKiQoga/n4vYoWXtX6vHvzzOIURMnI7ricdodt4aa5g3yls2pbsq8aHle/ESypttUoa6TIYhmSejfUxTNLkBdoQ== 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=PCR/5SR/wQEMC/RwoqGf/cOFCD7FBlDMgAX+MAC/AF8=; b=SpHbPCFpz1FVdUQCY0JxH01G7ha9fOA74BjioAhyZGmds+314GQ0VEMRGPSySXOAEVMtY5IxfxPf3IhnY7h2brqqixBZzv5ZvenXuccOPBenk+FG6Rv8mWdvGLlvx0MfOfJ0e36hEaRYNWQXRdzygSHYS5DM9Ij9AAPo4NbMKtQN0bIBjhYEnxpfPlYZfJZv+cXldTXzfeHYeqjhc2JDHlsIVLJwei45DgA/izjKfTGL6N4r+ZXIrEWtEjtHN1/tyOjXtmZEHxeYPo6KxOiJ+WqtXtcjwxLSbLK3V3vo9E3kCLSbchplmfJSv302IdQx3xAGRCtvIFztH0AV08T+ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PCR/5SR/wQEMC/RwoqGf/cOFCD7FBlDMgAX+MAC/AF8=; b=rvpIA6tWP9eawpwVYLMJLCLGJuNSlouJYvI+hWl7CK14EeuJfdAv77g2To7lCM3IIkuqDLiSCkjaAeo90RNv1pH+ExYKKEeMNJdizzM1ZecyVs3fEPs+OwKeeWGx+OYAmv7182tTNWkgo6Lg0hyQ1IuTwUWHfq2dcR7AwDuBSSs= Received: from MW4PR04CA0204.namprd04.prod.outlook.com (2603:10b6:303:86::29) by SA1PR12MB6725.namprd12.prod.outlook.com (2603:10b6:806:254::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15; Mon, 31 Oct 2022 20:43:36 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::74) by MW4PR04CA0204.outlook.office365.com (2603:10b6:303:86::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.18 via Frontend Transport; Mon, 31 Oct 2022 20:43:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.14 via Frontend Transport; Mon, 31 Oct 2022 20:43:35 +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.31; Mon, 31 Oct 2022 15:43:34 -0500 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , Shyam Sundar S K CC: Rajneesh Bhardwaj , , , Rajat Jain , "David E Box" , Hans de Goede , "Mario Limonciello" , Mark Gross , Subject: [RFC 2/3] platform/x86/amd: pmc: Report duration of time in deepest hw state Date: Mon, 31 Oct 2022 15:43:18 -0500 Message-ID: <20221031204320.22464-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031204320.22464-1-mario.limonciello@amd.com> References: <20221031204320.22464-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|SA1PR12MB6725:EE_ X-MS-Office365-Filtering-Correlation-Id: fca68cc3-5fc5-44b5-0563-08dabb809529 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iAsbT+iomMhgOQ63IsU9SJVQ1Eto74NNVJYuW0w078VcSi8hsZNG90KiX6oMNQ+dopI87AUS62FtgW/L1e6L7/mTth0rAljsAO/Rgm9AB6bNnPB2gAzEOja9qoM15KlWVHdbngRrKoBiJGS6izr08q61eej86si3judjFeEQE+/jSQ7uQ5tj5aZnfs8fq2QA0O8uYY2kVUea0m9VENo60amYzA/h0quS4qfrCZ/B1yjbuSmmsP5dfr/WQN5ZT5/a+axLWcD5MW491QXaH1QQtu8M9l9bpfX63QhAjpaaC7a8jQm7EgSUBoicm0VRn60/md2d6HT1psSG9sKQdoEaWwChMhxR4arlPwBYp9Lc7vRP3/iqPrshqwxm2c2R/m79zA/aVxCQzqLcogW4SsDTUn1nJJKf2oAtF7QTXtPVICS1uSfthKRMvf02zG9H9f0GeWhHMpZeFu+uQOSE1TG5KsoNmmpZz8BgziJRr9bR8Nri2P6QnQt5n6Tvv8adwlXZQzQ3VXPQPvkOwZR+TfcwlUZ+QoUF7Z5vmd+IP/7LKSPM6e/7dp8a7ykmU44diWb8A8PDig5CoJkguNUZQmDUN49oH35VwQi/rPaowBDeN1JqZlQAG/69dEaz1TBA2qGX5QBDs0PDkfnvhvG3jKOgkNY1KMe+QC9hR4fwvNuibrvdbMJrRNgcb4F0EFjujdBaMtGG76v2GtejTz7w4u77/OxqWb6sgeJ7gm2Slqm3fs3/1gRxTwrPtZA6CB7thkuPyjnOJ/Ml/2DUeNKFdrtVt2MBz9dQlzoYrJsqqLpevii6GZWpYgdFm0ZivCHrHy01 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:(13230022)(4636009)(396003)(346002)(39860400002)(136003)(376002)(451199015)(36840700001)(40470700004)(46966006)(83380400001)(36860700001)(44832011)(36756003)(336012)(2616005)(8936002)(426003)(47076005)(16526019)(82740400003)(81166007)(356005)(40460700003)(5660300002)(41300700001)(478600001)(6636002)(40480700001)(70586007)(7416002)(70206006)(8676002)(4326008)(86362001)(54906003)(316002)(110136005)(26005)(82310400005)(1076003)(6666004)(186003)(7696005)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 20:43:35.7485 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fca68cc3-5fc5-44b5-0563-08dabb809529 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6725 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" amd_pmc displays a warning when a suspend didn't get to the deepest state and a dynamic debugging message with the duration if it did. Rather than logging to dynamic debugging the duration spent in the deepest state, report this to the standard kernel reporting infrastructure that can be accessed from sysfs. Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 3703b61fb5c00..0f94c919edd43 100644 --- a/drivers/platform/x86/amd/pmc.c +++ b/drivers/platform/x86/amd/pmc.c @@ -373,9 +373,7 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev= *pdev) =20 if (!table.s0i3_last_entry_status) dev_warn(pdev->dev, "Last suspend didn't reach deepest state\n"); - else - dev_dbg(pdev->dev, "Last suspend in deepest state for %lluus\n", - table.timein_s0i3_lastcapture); + pm_set_hw_deepest_state(table.s0i3_last_entry_status ? table.timein_s0i3_= lastcapture : 0); } #endif =20 --=20 2.34.1 From nobody Thu Apr 9 00:18:12 2026 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 5A447ECAAA1 for ; Mon, 31 Oct 2022 20:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbiJaUnr (ORCPT ); Mon, 31 Oct 2022 16:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbiJaUnj (ORCPT ); Mon, 31 Oct 2022 16:43:39 -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 B272213CFA; Mon, 31 Oct 2022 13:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TIvat2APr8i17l5KMr/KsLwZqbWoteXztSa19pLkAmqE6g50+1Lf/Hqd47iw1mv13Ig4JTqbSZBBvEmge/mBbpm5eCB8QS3lzWVPxxjtWijcrs5aTBHOEX3N+WMMxm+hd1/tPUV+TdJkRgQkgv1mJOgfpRfhavFWJq8NgyYhnxhbX+NgRXffluLJfTJDvhCh+x/SekDcKixcYI3hQvnXCP9l1nho86SwALYcHB2O9NUsZ/LLsTkookdvEU7+kjnA2AaPBbb9ke1cVW6yAoVBV02nAhvrTw944fDJeSYWGr8u4qW+ufApYCUUU5SKU4zWQh09Mo1tZJciJ9ptpkA0TQ== 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=R8/CVtqFX12Xvux/sBSLE+MDq3anM+uG3XD6fHopQIg=; b=Z/M5c5x4Jn9++hJraL/wxrKFiJvGE1+1+EFUYmu4KHKs+Yd5agFhYtdlHaX7Ix0Ieg0/LQjHyHiqEf6IER+SvdLoFy4XcgQ7e1AhnErHmZmvFVmjc/TFAK6wY+ZMi9Cw9TMFdjAsf8tAAKszFS5inLbfZss/jOCXe77p61AQwYF/4vz4hk6E0mTufLeXsKnPgRyTzms8SqW6NB/qEJe+7PeS49eju+s+SbtCoJn7dSoyWo9XsHW3vTU0dFiwWTW7N2FGXqy0edjV4srvmfYowujMuME94MIvukJR0F9LmNHOxd5ckMXVs1s1rb65jmonH+t7xUbxixhPh6ZoaaXUSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=chromium.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R8/CVtqFX12Xvux/sBSLE+MDq3anM+uG3XD6fHopQIg=; b=IKfUasDHHQaj3SjPgn0TEtRq7uO0PaUkcxv8Y4uDronrOoSlu2ZqcGtEMkQwxHgmnjuQDN+ivDKLpXm2TBvWlEd4pTsTE9Z2xwK8/fonn9l2puaYlmfLqaVXxmk5LkeqFDyBUp83tzKZYCGvVKiyS03VaMHizLry2bPmXttT4rY= Received: from MW4PR04CA0188.namprd04.prod.outlook.com (2603:10b6:303:86::13) by PH8PR12MB7350.namprd12.prod.outlook.com (2603:10b6:510:216::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.16; Mon, 31 Oct 2022 20:43:36 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::c7) by MW4PR04CA0188.outlook.office365.com (2603:10b6:303:86::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19 via Frontend Transport; Mon, 31 Oct 2022 20:43:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.14 via Frontend Transport; Mon, 31 Oct 2022 20:43:36 +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.31; Mon, 31 Oct 2022 15:43:35 -0500 From: Mario Limonciello To: Sven van Ashbrook , Rafael J Wysocki , Rajneesh Bhardwaj , "David E Box" CC: S-k Shyam-sundar , , , Rajat Jain , "Hans de Goede" , Mario Limonciello , Mark Gross , Subject: [RFC 3/3] platform/x86/intel/pmc: core: Report duration of time in deepest HW state Date: Mon, 31 Oct 2022 15:43:19 -0500 Message-ID: <20221031204320.22464-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031204320.22464-1-mario.limonciello@amd.com> References: <20221031204320.22464-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|PH8PR12MB7350:EE_ X-MS-Office365-Filtering-Correlation-Id: 73edcbcd-38a3-4a0c-61a1-08dabb809588 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 58D0co4Mua9/Nh5rhr6k/gYz5FFDGRrHi7mkwsBHbpZCRO7dwbtUJZ+ZF4fZseARM7NOnFIAaaervW2NFiAkFBALND16r+jWKz5qhoF50Yczryb7Pm7Mr+XXaJB8ODpXBB2u0Ss8n8YJ+cRlZAlANu8UNIUfdRgl7rLe/1khz/0yk00M2xlJoiIvwwQ/hMCyju15J6Lud8ZC7AyMHagExFk7oZR8/ojrCwMCPosbApzPoDqnZEhHt4oBYO0bda94cqQsH56x599GN19gSgQ4T1Fz2xaLSuoltHMLQGKcqvQbBGpTCWAeR7mEUS3ri7Ru4ILirq18ExgiaKOesycOxBKgUjB5fOc7fFQ1CrwYo6MLquRHlOJ59ErAVcmH8/mGFJNyGteAw/DBjr6eRsdEcmRiqtpBVp32N/oYta3CS/Afnyc13kGoLNkA8wlfZIHZ+H+FuUPX4yPdtW7ByBY2fl5222tmtgymMepD8Cw+Jq9LyVsrzjTvH1msW2mQrEsiZq/RbrYP8NfJ/urIBkY7cVob/qU/YRG0B4cBqvUBCQiq8tZy45Dgcs/NokJAdVRlglc1aIt6e6VluTQ6Ok9GTryAZvwGg3sof1c9Osiz2y/OpVjrTdb8KwQKObiTJMWW7Uax7hNvtSnktKqhnwD3Q1lVuRjG1itvRSdCE9uyi8sVsLN41fnTloYw0+NVNUHPhDtrsvQoMv+sYslBvajE6eQglKA5lcc74jL31nP7aL+hcKOZ67RbpaJY9+XZ8MGB+DTNDgNS2wVWOop9CXAiqtfikp+tsqcNdvO5m2NN+m9649sm52nrh0e5S6obTx3x 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:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(478600001)(82740400003)(110136005)(86362001)(54906003)(44832011)(5660300002)(7416002)(70586007)(4326008)(8676002)(83380400001)(40460700003)(6666004)(36860700001)(70206006)(186003)(426003)(8936002)(4744005)(1076003)(36756003)(316002)(16526019)(2616005)(47076005)(81166007)(2906002)(40480700001)(356005)(41300700001)(7696005)(26005)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 20:43:36.3891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73edcbcd-38a3-4a0c-61a1-08dabb809588 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: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7350 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" intel_pmc_core displays a warning when a suspend didn't get to the deepest state. This information is generally useful to userspace as well which may use it to collect further debugging data. Report this to the standard kernel reporting infrastructure that can be accessed from sysfs. Signed-off-by: Mario Limonciello --- drivers/platform/x86/intel/pmc/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index 17ec5825d13d7..9e58228b01f91 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -2116,6 +2116,8 @@ static __maybe_unused int pmc_core_resume(struct devi= ce *dev) if (!pmcdev->check_counters) return 0; =20 + pm_set_hw_deepest_state(pmcdev->s0ix_counter); + if (!pmc_core_is_s0ix_failed(pmcdev)) return 0; =20 --=20 2.34.1