From patchwork Wed Apr 12 19:49:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 82661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp569741vqo; Wed, 12 Apr 2023 12:58:57 -0700 (PDT) X-Google-Smtp-Source: AKy350Z7cf8PDQHkCe9KpKnpE9fY5lXEWc8BTcyXYrg9QG0cgvxBkL10kSxVZvsAeedxw9RmHjM7 X-Received: by 2002:a17:903:3011:b0:1a1:b3bb:cd5b with SMTP id o17-20020a170903301100b001a1b3bbcd5bmr6586352pla.62.1681329537626; Wed, 12 Apr 2023 12:58:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681329537; cv=pass; d=google.com; s=arc-20160816; b=GfxvIJRDtZwXW3/O8eBs186yMsk2VRspqE+4qAtiXmIZDcJSpeRJvjClARmcGtta2b eEKDEsmFlxuTeT9IJzaGtV6V6uY3yiLVX2AojGioMdw5XqfHwcn0eWAwfsoFWF4yufrb g90lC2WHOB9yOX+nHTnq3q4NUJYi2GNVb1XSju4LKQPLRpoo3u6r5CooN8cc5C5PcVG3 +OGWUBGnhU5R6sQ6rgA5nfLrBlDksZUG8ikTi0GDky+8RXzR3aoybcPs8SdFmzuL0sZn xW27VwUx5YfDUPLwjMr6ApQamvqiJv3vhHSrDNMbB967c/Ca96Bduyj2s6KRnfflGGBZ 2ilw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ShWWw2wVhhkH4z6IvzIsoi7Ih8udnCG50Wc55BRZPCw=; b=0ijrz7AY6msx3hqOyU5Hcs6ojltmAb6WdnH4ql6OsuchrVz/9MliJDEsmxyTUCkKU0 aLxpZkac9AxJ2jNLJpub6mA6uKGjFaFB+PZ5Sq+sn7wVSq1YzSNN74TmF+sPpvfHkVC6 YOm8CUH1isCYAHMZfL19bbHVV15jy795ZaaLYD3HgugV1TpL8MvjpsWth6h6rV8rBMxz gmW2Ycx5S5l3sXb+am90E2Gc+nmf+cd5gpsQwXblA8zOMUqCfH+HYyyoxBi1EREDnR7u GprimOwFeCF85O48My3Yv+KmUsV/lNdeyshGmlH3PzlNzx/NnMZfPQ173NBjqwLF552b IlfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqOB5e9A; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a170902ec8900b001947ba0ac92si13994485plg.350.2023.04.12.12.58.43; Wed, 12 Apr 2023 12:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqOB5e9A; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230207AbjDLTuQ (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbjDLTtr (ORCPT ); Wed, 12 Apr 2023 15:49:47 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8132F72A9; Wed, 12 Apr 2023 12:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fg1h/Z5iTSTYA8XIeYs6RUYIRzHAVb1J1xDj95ZVy0eT7MBGshJY7aoDYWijkALoUxwgYmqw2y8pcIQTgPMRHAAPCAFhYg1RgArj1IpuEZxxvDOsqefRl8L8OrkaX+Y9EHUDwnaO+E6ccuBZKhNnFHQdP3nJpgrXWM23Z5prACxsiNM0qJL7c4Or1A/42AlNDjFPILE8svv0UJGqS2AqjKppycRBFHKWBmllTVdNx6I/PUQRsCQ5wzNO5JIl/V+q68Q7ZEXnvLQhocg4hCp6+V0Khg+Q+kPylGxI/BXcR9mjqyyeHS5+0RxMfSYTJMLXs/qzu8yBTGcl9z3hKZqPMg== 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=ShWWw2wVhhkH4z6IvzIsoi7Ih8udnCG50Wc55BRZPCw=; b=jmcvcJpwz09HCx5YKtjAP9W8gCND55bVv/4VOkYQ+r1N6x9m06kOgxHXIqIz1hzhAjDU79OdAUwGo7Qmcmeh3hyTp6EtupVo+wTd1MY9D42Ip+bPCWpuVOrKq8chqDERYw7GmqHpnLH0bYtgPhGEZlbIUsiCnEdvX6VFpxKo0IqYScz221UJGe7Du0ksS8igSmT0GYlKzLYBv4S4McgBQqchrVkmZsQ25J0vPErSHkPQM5cVAMv8a7N3SPUly+K/9h1EVHc5tYxR2mS4WaA7emYKPctJl5XmE5K31jK0bzJbEj2ATvuHlx6b+xFFHCsALeYVOHy3O1ghVrtClXxVIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=ShWWw2wVhhkH4z6IvzIsoi7Ih8udnCG50Wc55BRZPCw=; b=FqOB5e9AvuK7VUYkvJaAWDNnJTrfZSLJ7x37OsyuyBPKutU1hPzgUjHfyCkQtQ6AB4Nz1JrWhnTN3Ix0jVL+AjYVsVtQeeCvgGq5EhD6f/C7KVAlJ47FI+8c/VYYdaotKboreutg4/haF0RXeILwM7VbRD8m8tFxT/woEGzugWw= Received: from DM6PR06CA0045.namprd06.prod.outlook.com (2603:10b6:5:54::22) by DM4PR12MB5913.namprd12.prod.outlook.com (2603:10b6:8:66::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Wed, 12 Apr 2023 19:49:37 +0000 Received: from DM6NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::1d) by DM6PR06CA0045.outlook.office365.com (2603:10b6:5:54::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Wed, 12 Apr 2023 19:49:37 +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 DM6NAM11FT070.mail.protection.outlook.com (10.13.173.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Wed, 12 Apr 2023 19:49:37 +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.34; Wed, 12 Apr 2023 14:49:33 -0500 From: Mario Limonciello To: Box David E , , , , "Rafael J. Wysocki" , Len Brown CC: , , Jain Rajat , , Mario Limonciello , , Subject: [PATCH v8 1/4] PM: Add sysfs files to represent time spent in hardware sleep state Date: Wed, 12 Apr 2023 14:49:13 -0500 Message-ID: <20230412194917.7164-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412194917.7164-1-mario.limonciello@amd.com> References: <20230412194917.7164-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT070:EE_|DM4PR12MB5913:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aec9210-6ccd-473b-0b4e-08db3b8f0c4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Eftf5+JUKxiBMA62Aw/JJvooY8ext03p8JlCnVJy7S3J7MqDG0ARpm6nenN+lrgHlEbQ+T2AUtiICYGfqqzryce69rRxpMQP5L+lVFFNrjQveotxvAie/gMSbui0P1dDa6JzDn79ZFVjwD5EUyt/Nw2ACvvxk4kH4LG3r/j/fFJ9gxrBDibVlgDURUTnihKcJnzPU7HQvodkXXTWhwbDgY8nXyfSL0xgAKzV6wZxLkWjHLqFus+lumhg+cGWZunP+zH1MdR/33WCtEDtnxTdIdaDdBEY2DbWGgl2lrwXTdSyA5sMBFKm6cbe4mlDa50gjazYJ6ra00v42exJzyQePMJdY5y+VKeeu/HfiUAVnYqpZbp6nToL4u3K4I5/NgGSnY6Hin1KS7D14tUGIT4rOIFPmFIYMRme0Zm4qBD03KpKzY8H03PsJAZiMGn0fvXZ7U0LcBqGLu26qte5F8N/3mjCIp9r+pfMw2onp+BkdlXK9FeeZzlNViAlVJi+G8NQPBiqrq43VyDRcj8QyalizPk0C7zimVWKHMtJQ3cz7DCYvGvh0AHhiE9MOmvs8uO3MpIwcwculwcxPvAY03+746XFfSihwdgLL8njUO2DANCkoBmVjYpQBdeIC+AOPjbKILmJcr/G7KxFNKCAKxlFqEKEPSgqopJ3ldhvZmcBp3FHrAisBEMFYzhjgTlWRdpbdAu3IOsNnEV4BtalWOXznLD8gGNe48cHek5KRgUBvNA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(478600001)(7696005)(26005)(110136005)(186003)(16526019)(5660300002)(44832011)(54906003)(1076003)(316002)(2906002)(4326008)(70586007)(70206006)(6666004)(82310400005)(7416002)(8676002)(8936002)(41300700001)(40460700003)(81166007)(356005)(82740400003)(47076005)(83380400001)(40480700001)(36756003)(2616005)(336012)(426003)(86362001)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 19:49:37.5144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1aec9210-6ccd-473b-0b4e-08db3b8f0c4f 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: DM6NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5913 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763001801504423072?= X-GMAIL-MSGID: =?utf-8?q?1763001801504423072?= Userspace can't easily discover how much of a sleep cycle was spent in a hardware sleep state without using kernel tracing and vendor specific sysfs or debugfs files. To make this information more discoverable, introduce 3 new sysfs files: 1) The time spent in a hw sleep state for last cycle. 2) The time spent in a hw sleep state since the kernel booted 3) The maximum time that the hardware can report for a sleep cycle. All of these files will be present only if the system supports s2idle. Signed-off-by: Mario Limonciello --- v7-v8: * Add max_hw_sleep sysfs file * Add function for drivers to set max_hw_sleep * Modify macro to display attributes --- Documentation/ABI/testing/sysfs-power | 29 +++++++++++++ include/linux/suspend.h | 8 ++++ kernel/power/main.c | 59 +++++++++++++++++++++------ 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power index f99d433ff311..a3942b1036e2 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power @@ -413,6 +413,35 @@ Description: The /sys/power/suspend_stats/last_failed_step file contains the last failed step in the suspend/resume path. +What: /sys/power/suspend_stats/last_hw_sleep +Date: June 2023 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/last_hw_sleep file + contains the duration of time spent in a hardware sleep + state in the most recent system suspend-resume cycle. + This number is measured in microseconds. + +What: /sys/power/suspend_stats/total_hw_sleep +Date: June 2023 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/total_hw_sleep file + contains the aggregate of time spent in a hardware sleep + state since the kernel was booted. This number + is measured in microseconds. + +What: /sys/power/suspend_stats/max_hw_sleep +Date: June 2023 +Contact: Mario Limonciello +Description: + The /sys/power/suspend_stats/max_hw_sleep file + contains the maximum amount of time that the hardware can + report for time spent in a hardware sleep state. When sleep + cycles are longer than this time, the values for + 'total_hw_sleep' and 'last_hw_sleep' may not be accurate. + This number 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 cfe19a028918..d0d4598a7b3f 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -68,6 +68,9 @@ struct suspend_stats { int last_failed_errno; int errno[REC_FAILED_NUM]; int last_failed_step; + u64 last_hw_sleep; + u64 total_hw_sleep; + u64 max_hw_sleep; enum suspend_stat_step failed_steps[REC_FAILED_NUM]; }; @@ -489,6 +492,8 @@ 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_report_hw_sleep_time(u64 t); +extern void pm_report_max_hw_sleep(u64 t); #define pm_notifier(fn, pri) { \ static struct notifier_block fn##_nb = \ @@ -526,6 +531,9 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) return 0; } +static inline void pm_report_hw_sleep_time(u64 t) {}; +static inline void pm_report_max_hw_sleep(u64 t) {}; + static inline void ksys_sync_helper(void) {} #define pm_notifier(fn, pri) do { (void)(fn); } while (0) diff --git a/kernel/power/main.c b/kernel/power/main.c index 31ec4a9b9d70..3113ec2f1db4 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -6,6 +6,7 @@ * Copyright (c) 2003 Open Source Development Lab */ +#include #include #include #include @@ -83,6 +84,19 @@ int unregister_pm_notifier(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(unregister_pm_notifier); +void pm_report_hw_sleep_time(u64 t) +{ + suspend_stats.last_hw_sleep = t; + suspend_stats.total_hw_sleep += t; +} +EXPORT_SYMBOL_GPL(pm_report_hw_sleep_time); + +void pm_report_max_hw_sleep(u64 t) +{ + suspend_stats.max_hw_sleep = t; +} +EXPORT_SYMBOL_GPL(pm_report_max_hw_sleep); + int pm_notifier_call_chain_robust(unsigned long val_up, unsigned long val_down) { int ret; @@ -314,24 +328,27 @@ static char *suspend_step_name(enum suspend_stat_step step) } } -#define suspend_attr(_name) \ +#define suspend_attr(_name, format_str) \ static ssize_t _name##_show(struct kobject *kobj, \ struct kobj_attribute *attr, char *buf) \ { \ - return sprintf(buf, "%d\n", suspend_stats._name); \ + return sprintf(buf, format_str, suspend_stats._name); \ } \ static struct kobj_attribute _name = __ATTR_RO(_name) -suspend_attr(success); -suspend_attr(fail); -suspend_attr(failed_freeze); -suspend_attr(failed_prepare); -suspend_attr(failed_suspend); -suspend_attr(failed_suspend_late); -suspend_attr(failed_suspend_noirq); -suspend_attr(failed_resume); -suspend_attr(failed_resume_early); -suspend_attr(failed_resume_noirq); +suspend_attr(success, "%d\n"); +suspend_attr(fail, "%d\n"); +suspend_attr(failed_freeze, "%d\n"); +suspend_attr(failed_prepare, "%d\n"); +suspend_attr(failed_suspend, "%d\n"); +suspend_attr(failed_suspend_late, "%d\n"); +suspend_attr(failed_suspend_noirq, "%d\n"); +suspend_attr(failed_resume, "%d\n"); +suspend_attr(failed_resume_early, "%d\n"); +suspend_attr(failed_resume_noirq, "%d\n"); +suspend_attr(last_hw_sleep, "%llu\n"); +suspend_attr(total_hw_sleep, "%llu\n"); +suspend_attr(max_hw_sleep, "%llu\n"); static ssize_t last_failed_dev_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -391,12 +408,30 @@ static struct attribute *suspend_attrs[] = { &last_failed_dev.attr, &last_failed_errno.attr, &last_failed_step.attr, + &last_hw_sleep.attr, + &total_hw_sleep.attr, + &max_hw_sleep.attr, NULL, }; +static umode_t suspend_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx) +{ + if (attr != &last_hw_sleep.attr && + attr != &total_hw_sleep.attr && + attr != &max_hw_sleep.attr) + return 0444; + +#ifdef CONFIG_ACPI + if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) + return 0444; +#endif + return 0; +} + static const struct attribute_group suspend_attr_group = { .name = "suspend_stats", .attrs = suspend_attrs, + .is_visible = suspend_attr_is_visible, }; #ifdef CONFIG_DEBUG_FS From patchwork Wed Apr 12 19:49:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 82663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp570803vqo; Wed, 12 Apr 2023 13:00:49 -0700 (PDT) X-Google-Smtp-Source: AKy350Z15dfuAobKz/vbLnOvPS9F37pSmCYqWO29k1ssmM6VOdNSq3tpmT52TVN8LMDbls3SmnPq X-Received: by 2002:a17:903:1c7:b0:19c:dbce:dce8 with SMTP id e7-20020a17090301c700b0019cdbcedce8mr102725plh.15.1681329649601; Wed, 12 Apr 2023 13:00:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681329649; cv=pass; d=google.com; s=arc-20160816; b=IqoP/0IKKyVFzFwHAn2IBYeukNa8SSYV5xhUhggGyD1eWrIhQDnQgU/ZZzDKbG/S06 1DqSergC5tTqbCAUcGq95kiyOSOF6UEHELhJqBIVbSjO8MxorA9zdheGcn1K+t2AOBhY GHK1uVhi+7MkCIh1Ut3faeHBwPP1k3MHz2MMeAqpmXggp2vvEPJ+Pp5IP8gUjXd79Xf1 XznqoZe0NuFCkD1ZAesjIR2PzBJTASss/4KT+7syQ32auDXrzoT34Zm+JG1qEvkcRA9m gUzBzcRIUCf0+Xykg7rZagWKuedNFJkJjyl25Kv8vtNb5O2Yel5/ixyU02Rw1eyP+ZY2 AMWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MAqoozhWE/kkT/GmPTdsTtBzAMT4Hd/ynr6EOHD7eUg=; b=ROfMqgTD1QHe/z+OXp2d688qnthrdNdguF+LKOC79aYBKJyVd71nE7tjR/Whfy+dxe 92VnWeVtun0/KC3nKGc8tO7A7OqSreyJttlyfJogNhtKc4LJdmoYsAC+QP+/pSIUGriY kdFVrmg5ONrk2J6eSkDAHvZe5U4tuaihEXuvCiH4BKRdJDFyx+wN97SNM7lBzJzcahkF 1EdPP4PmmlXh7L9qXSQV+6S7XqR7fIl+Uhplpdeis0UAsgomvZosZxlPG4ik7/vYvJDy /X7ge/4xvQp3W0bYB2ERqSzXCChx8ltZhaX8vL7+11JakkqaBVxDlJ/1FfeRnnOsXBQa ZAbg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UrvN3vv8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p14-20020a170902a40e00b00192d6fb649dsi15928175plq.242.2023.04.12.13.00.36; Wed, 12 Apr 2023 13:00:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UrvN3vv8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbjDLTuK (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjDLTtq (ORCPT ); Wed, 12 Apr 2023 15:49:46 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2075.outbound.protection.outlook.com [40.107.243.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 388BB7D9B; Wed, 12 Apr 2023 12:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aE0efWOvAkwJxR5D87R4N6oikOzaktzxlVBoWvMnaREG6IhtDdnCJGnXVbpwVO1uidJq1OncTADSxl3J3pklDNlKGEPZXciu2kFJ9xU5Hx8hUOtmtBQakN76zW/YmtrU2BfyXDi6smiBqiG1xdimjieB9efOmUP3fqyFxI/QNOFPonspSsRbYiyxYfhiVUbq4B2GPBaudsrBFvZRbDby2apNv60XoJYMS06G+2zRGrcjV2H4EHsZNtaBecO5gJmRK3qUF7DJjPYc4W2DhRXgyRM8ASOhO+t3EtdIq0OsqwZKQqFPiCNkBVWmPZWHKEfAKbmp1n8hFW57yjgm1hCHcQ== 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=MAqoozhWE/kkT/GmPTdsTtBzAMT4Hd/ynr6EOHD7eUg=; b=AXrkV4WllOrlSGHRLFZgovHJgcd1fdTrravHK2RTLS8ebJZKbiGIkbLgMtAdFOW0/SoYcUuL2A96kkq0SOxR8NFmk2nBNEeZEgcgvHsaBR/xZSAtLlrQKz0GaW/Av1susKl31cI5RzVzL8oyid27G3n5W00ZdvQfC7zgfyyDmD19ijBcK3AGXb2v+3ySbllhTqqB108ktUIVYf0GmiFUw5Zk6wPxfQut+RXQOZFIu8lkROunBtpbcewmnp1XoUou/ZMRrcTOSphbd4ZedFSWHY7k3RvISqSFblk1NJ4d51VD6+CARbN95a8Xt4vtfgORoytKU5VZZHnkguX1Pu6/aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=MAqoozhWE/kkT/GmPTdsTtBzAMT4Hd/ynr6EOHD7eUg=; b=UrvN3vv8ZGeZ4RjulZpLK3vnZalCHPnJ1qDYGK+NbqpvfU3wNWxwgDDJZG7mF4oXKjxlcoU/L6DyPi9tzQ7ty0wMhiC1mZ8vsQQ04NrB+XEhqhtQYmFEsyLf98/lJJNE+LsAM5zV3cxnSqjjk+z/8B1FBXmTF4ywkF58FyJ4ruo= Received: from DM6PR06CA0052.namprd06.prod.outlook.com (2603:10b6:5:54::29) by BL0PR12MB4931.namprd12.prod.outlook.com (2603:10b6:208:17e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Wed, 12 Apr 2023 19:49:38 +0000 Received: from DM6NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::f5) by DM6PR06CA0052.outlook.office365.com (2603:10b6:5:54::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Wed, 12 Apr 2023 19:49:38 +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 DM6NAM11FT070.mail.protection.outlook.com (10.13.173.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Wed, 12 Apr 2023 19:49:38 +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.34; Wed, 12 Apr 2023 14:49:35 -0500 From: Mario Limonciello To: Box David E , , , , Shyam Sundar S K CC: , Jain Rajat , , Mario Limonciello , "Mark Gross" , , Subject: [PATCH v8 2/4] platform/x86/amd: pmc: Report duration of time in hw sleep state Date: Wed, 12 Apr 2023 14:49:14 -0500 Message-ID: <20230412194917.7164-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412194917.7164-1-mario.limonciello@amd.com> References: <20230412194917.7164-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT070:EE_|BL0PR12MB4931:EE_ X-MS-Office365-Filtering-Correlation-Id: 6be2e253-c8ee-4597-de6f-08db3b8f0ca4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IhxlkEBjf2xoMf3DNl9DGf46ncGoFQkqlJtLWiKtIQMtmuL8D0B1B6soXJN8YOBabNiHSv5mwol/0wbi/iiVxW9Dii7aSvGKM5Cwie6FCj273pkzJL5FhzkfzsZ5nwtc+JyYh9hhbqBo2aNJ4FAvuLJrX2vMLIGm0vNDDk3VI/thfoUxiMZyZVEUYlFFKAMoxF4MAZgQ86JAkULD77DK6sXEqAJMjqWjyEhNYbt68UVxdJx+EA+9/8sKziruNzmRUKbuiOXiXn8HQ+s7VVisCwz2aNIWxqItBgU35bNlgGGirDXKXf3X6x+lii36huDAyUWio+SjkRASZZjk3NloLTzpCwZ1XxnOkEYfbV9QBk7pPWk0kVkdWG/MXj8PV6h9qB3TSaF+9oXVqAdGYUYHOHZxyzqGJCH6cG61lG+Uir+btkLGGeC/tdX2cmEqCndbpvmokogjSb1Ae0DG3Bz17Ea6SPoT3Hlxpv8JFgc6/Sp8UjJ9OpD5ESViXEfORu2ZmPLasy1jnWRGlENwJwVn8qJORtOqIEhaQKYK2nV0W5sXHiqzgxxzQTG7NHSEMCWbt8f20xA7f+qqKgjtbCc3hoXtBvIE4HVP6CiSmRWjFT3HYr2xM3lTzrZzk096OWaDBVz93nyxnEYuKxKwY0P+5T3/GPBH4yq+IqHE+FOUgOv1SoCFenr8BYcsbEb9QjAMGdt2bgMP0V7J+FnvSNNc5xHtUkWN/6S2M1Q/+ZwPJGM= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(346002)(396003)(451199021)(40470700004)(46966006)(36840700001)(40460700003)(316002)(41300700001)(26005)(1076003)(81166007)(6666004)(7696005)(186003)(86362001)(47076005)(16526019)(2616005)(356005)(82310400005)(36860700001)(82740400003)(36756003)(426003)(336012)(83380400001)(40480700001)(110136005)(4326008)(54906003)(6636002)(70586007)(70206006)(8676002)(8936002)(5660300002)(2906002)(7416002)(44832011)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 19:49:38.0769 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6be2e253-c8ee-4597-de6f-08db3b8f0ca4 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: DM6NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4931 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763001918240346774?= X-GMAIL-MSGID: =?utf-8?q?1763001918240346774?= 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 so that userspace software can query after the suspend cycle is done. Signed-off-by: Mario Limonciello --- v7->v8: * Report max hw sleep time as well. --- drivers/platform/x86/amd/pmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 2edaae04a691..e610457136e6 100644 --- a/drivers/platform/x86/amd/pmc.c +++ b/drivers/platform/x86/amd/pmc.c @@ -393,9 +393,8 @@ static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) 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_report_hw_sleep_time(table.s0i3_last_entry_status ? + table.timein_s0i3_lastcapture : 0); } static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) @@ -1015,6 +1014,7 @@ static int amd_pmc_probe(struct platform_device *pdev) } amd_pmc_dbgfs_register(dev); + pm_report_max_hw_sleep(U64_MAX); return 0; err_pci_dev_put: From patchwork Wed Apr 12 19:49:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 82666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp572732vqo; Wed, 12 Apr 2023 13:03:31 -0700 (PDT) X-Google-Smtp-Source: AKy350ZoAQvl4a+ZNgpwk6IPdGQQ8WbONOAdy3DG82FEHetk3dHW5fFCiVzYwC5JdEr2A1LvLf2V X-Received: by 2002:a17:90b:3144:b0:247:10fe:a799 with SMTP id ip4-20020a17090b314400b0024710fea799mr821638pjb.47.1681329810862; Wed, 12 Apr 2023 13:03:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681329810; cv=pass; d=google.com; s=arc-20160816; b=wayACeWO+Qke5N6yyF9U9PAXtz1J9Sx4RYozfURBRi683SDKjDmBoWkWKNIfrJNStT Hwa/EbjLPCsmXIi+Z+kYF16MphrPPotF+ifDLpyX6gN1J0fzqRW6RsjekomlMqqtmdFH lwHd5EFR/LsYOvN0wYP59GDHBUYh7ouoCQ3NBDwRWeJBvum36z1lOgLTpGg1GP/fqb1L 9YI246bsgHCKRMqSXC6Aq2CmifeBpHG2jDh+E/lnGAdb5MfEboHNZeAkNZ87vj+QrGYQ YWOg3sr7kWxvi9/kzc3VLIaDOGInDkNzZ/2o92Z8Qp0jWKNFdIqCc6wIwPzUurexOI3+ l73g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6uyuYrzpFUD9AAiawcudYbjDPhPlJBKpXwXniY+Li4s=; b=aJwcoao25rdJEu0amB4991KjQ9oxCTy0w5XqVRngXUjqUsYqAwJoDCnfykHLBfezyB Iebv8X7R0yYsBN2b+eDTwBp6hJUUu5GgD12gxfTcrzPAc9lL6ruBTyAh8KJ8OBB1BR/J roVJIXSP24QAi2+A404xUfDQVQ+LQDoLsLCqlFebsujqyADl6Z5CNgwsBm+GqQ2rdYHi kEi6q18TmsNqPf/YNLpRYiUo+P+3Xa6EgphoZg0OgIp+IFenJEuV7LeoPWSNb00NtYso WnNMvArpJW6nu1qHGb7VvcSkiCXB1TIrEcn8dS2MbXOTGZNk9oOdWiDBiOwe3MJKAlSc Fynw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ONJMgcKw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r193-20020a632bca000000b005139e210d10si17678066pgr.587.2023.04.12.13.03.12; Wed, 12 Apr 2023 13:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ONJMgcKw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbjDLTuZ (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjDLTts (ORCPT ); Wed, 12 Apr 2023 15:49:48 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6D47DB4; Wed, 12 Apr 2023 12:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxWzJviypQ7Y48r+W+VsSFtcyfM7j/v6+zktV8MXxyLLeV27IvdZbMDqvZPvsXiojME2USxyRnCuiMXSRlnpPcVsjtgNA2zJ6CPtNHvtTWQv4w/U7OX1KZnJ7oJxiCZ+JYLEIBPYS34mcChI5mtjqSdGygwniscD3ihpsNM1/PHWT9DdHtIgWGzhBuuAIXQPWcaSblgMvG3VpfXuBR88DXw2CUwK1vpXUc55VEVa41dOdPVNnNGJ1fPtEnpcOyLw0mdSWnCHmthDeWPjDnVtHdmiWiNeaAyRRI/6qMiQsxFuQkgqhVqAFiJm4ckAyjlrZlhtAo80V59xbq+N28sKYw== 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=6uyuYrzpFUD9AAiawcudYbjDPhPlJBKpXwXniY+Li4s=; b=oK3l62FR9GboylsE7YWSIfKl1IUTSk5EOKxQxhQrcpV6n1hf7DG/vmQ8Le//47Wwu+v05SUUnQ0wPhW62ukRPzRk4zMkxT6XRedIECi7T4fnTJuBCM0wp+OMYFRQjWsEGa+i/O+n/yhUTBpn2Vc3qvlAfRdYvQxkPR7Pqz2KVpEAlcsuFsXYRVDJy6FByUoAwpMTJ82R5O/2GzyCelqGKiHx9WttKa9DlqRfcjdzEcLKS7jZJUxtj4IA3VJloiuSYbjjtZWP5TH336Aij495nSJ0QPYOVxYlH57TcUoHRxj8RIiwITLEiakGScyEBq/gmQIVczRkXCfwPdfPhaoeMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=6uyuYrzpFUD9AAiawcudYbjDPhPlJBKpXwXniY+Li4s=; b=ONJMgcKwsMeg9OjMDEA1S/ikMVnZJumz7bQY9I+NihINTwLe/jnoqjSUOIP1CoTQXyzQXHlIYQE7iZCv3dPHXWGIL0kM2wZ7nTPMhUW0Dw4NxTL3tGhogB+ZSODuGCstcPBjTh6wO7EXrw6EGWWNWTvHxDblvdQyGm/tosxvHhE= Received: from DM6PR06CA0064.namprd06.prod.outlook.com (2603:10b6:5:54::41) by PH7PR12MB6954.namprd12.prod.outlook.com (2603:10b6:510:1b7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.35; Wed, 12 Apr 2023 19:49:38 +0000 Received: from DM6NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::fe) by DM6PR06CA0064.outlook.office365.com (2603:10b6:5:54::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Wed, 12 Apr 2023 19:49:38 +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 DM6NAM11FT070.mail.protection.outlook.com (10.13.173.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Wed, 12 Apr 2023 19:49:38 +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.34; Wed, 12 Apr 2023 14:49:36 -0500 From: Mario Limonciello To: Box David E , , , , Rajneesh Bhardwaj CC: , , Jain Rajat , , Mario Limonciello , "David E . Box" , Mark Gross , , Subject: [PATCH v8 3/4] platform/x86/intel/pmc: core: Always capture counters on suspend Date: Wed, 12 Apr 2023 14:49:15 -0500 Message-ID: <20230412194917.7164-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412194917.7164-1-mario.limonciello@amd.com> References: <20230412194917.7164-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT070:EE_|PH7PR12MB6954:EE_ X-MS-Office365-Filtering-Correlation-Id: 96436eb1-9ae9-41ff-da91-08db3b8f0ce2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s1j8+D8a39sAenBe3VSIQdV96MyQxwm29BxkE85OESQb10JN9c/WZIjr/dhaed+EavCAKpiffFITHnOrKWo4PTH9aEnHXuDbRUYTEey9+WDtT0NyJmWPr9dW2mUux2KZKDv9mD+R8E8Ou10gNqZ/KCN3/RfXzUSlyCV5zcdWL3aQRcl9e8J4Y+al5vW0qmowgZLD0YLrLDhvs+Zby4zVUgzszpCacFro9AfrfyoSeaybtqLmlVuTPBx4fB+qcLpC7RcsQA9ObrEyyevmtwT3aqFjgeiwV84uSaj/4FymBXm5W0njZUlpv+xaWu+W1kyGCGEdKklO06G82Tun0x51dyKlv5Fwa6kHk9kqEVjgKCCecXuJxpRP55HknF3W2qw03AOSd6qEHiJOxioGooIBOc6dFtI/rOoL2IfPLjXZozMPcZDGEg30vY2ho1Wx0r+3yVtXypb+Rt4AKxx88loL/dxiJWu8DJAlNNDi/lyF1q8x8IOsVDNK6L+P2oKYRjC2uA9T30p2awX+Qj7AEb8Y9pPM6KAr8+lRUAyhC+jvXIo18eb/3+3NvYHTlWqQLUD9IRX4nc8IX/SvPBS1rNb5wLu9vvPPr5EYF8j5mIq1qwg1mzeGADle6YaDn9USgrvB9KqmYyAkoDHGSxYyZlpG3AlrVSZz4wUdq5YqtmKreL0Yv1d0ot6So34hU4r3CL9z++SNaN87QgTEVCF6mmbqg7ynoFbYm2XWzOSWr4h4PDU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(44832011)(40460700003)(7416002)(82310400005)(15650500001)(36756003)(2906002)(5660300002)(8936002)(8676002)(40480700001)(86362001)(110136005)(6666004)(7696005)(26005)(1076003)(83380400001)(36860700001)(54906003)(478600001)(47076005)(2616005)(426003)(336012)(16526019)(82740400003)(186003)(70206006)(70586007)(81166007)(41300700001)(356005)(4326008)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 19:49:38.4831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96436eb1-9ae9-41ff-da91-08db3b8f0ce2 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: DM6NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6954 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763002087551589802?= X-GMAIL-MSGID: =?utf-8?q?1763002087551589802?= Currently counters are only captured during suspend when the warn_on_s0ix_failures module parameter is set. In order to relay this counter information to the kernel reporting infrastructure adjust it so that the counters are always captured. warn_on_s0ix_failures will be utilized solely for messaging by the driver instead. Reviewed-by: David E. Box Signed-off-by: Mario Limonciello --- v5->v6: * Pick up tag v4->v5: * Squash patches together * Add extra pm_suspend_via_firmware() check for resume routine too --- drivers/platform/x86/intel/pmc/core.c | 13 +++++-------- drivers/platform/x86/intel/pmc/core.h | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index b9591969e0fa..925c5d676a43 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1179,12 +1179,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) { struct pmc_dev *pmcdev = dev_get_drvdata(dev); - pmcdev->check_counters = false; - - /* No warnings on S0ix failures */ - if (!warn_on_s0ix_failures) - return 0; - /* Check if the syspend will actually use S0ix */ if (pm_suspend_via_firmware()) return 0; @@ -1197,7 +1191,6 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) if (pmc_core_dev_state_get(pmcdev, &pmcdev->s0ix_counter)) return -EIO; - pmcdev->check_counters = true; return 0; } @@ -1233,12 +1226,16 @@ static __maybe_unused int pmc_core_resume(struct device *dev) const struct pmc_bit_map **maps = pmcdev->map->lpm_sts; int offset = pmcdev->map->lpm_status_offset; - if (!pmcdev->check_counters) + /* Check if the syspend used S0ix */ + if (pm_suspend_via_firmware()) return 0; if (!pmc_core_is_s0ix_failed(pmcdev)) return 0; + if (!warn_on_s0ix_failures) + return 0; + if (pmc_core_is_pc10_failed(pmcdev)) { /* S0ix failed because of PC10 entry failure */ dev_info(dev, "CPU did not enter PC10!!! (PC10 cnt=0x%llx)\n", diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 810204d758ab..51d73efceaf3 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -319,7 +319,6 @@ struct pmc_reg_map { * @pmc_xram_read_bit: flag to indicate whether PMC XRAM shadow registers * used to read MPHY PG and PLL status are available * @mutex_lock: mutex to complete one transcation - * @check_counters: On resume, check if counters are getting incremented * @pc10_counter: PC10 residency counter * @s0ix_counter: S0ix residency (step adjusted) * @num_lpm_modes: Count of enabled modes @@ -338,7 +337,6 @@ struct pmc_dev { int pmc_xram_read_bit; struct mutex lock; /* generic mutex lock for PMC Core */ - bool check_counters; /* Check for counter increments on resume */ u64 pc10_counter; u64 s0ix_counter; int num_lpm_modes; From patchwork Wed Apr 12 19:49:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 82664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp571688vqo; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) X-Google-Smtp-Source: AKy350bk2c7wHTCLdjPmW813ArdHEnN2kpP9AJuHBTMz46n8axv0j5beT31xuSSGjZffukB7ttAV X-Received: by 2002:a05:6a00:14cc:b0:627:ea2c:ad9c with SMTP id w12-20020a056a0014cc00b00627ea2cad9cmr172723pfu.9.1681329725658; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681329725; cv=pass; d=google.com; s=arc-20160816; b=OpVfbXsItS1UF1OhsVPLrOwKCgRPoxCSLrnSvGfFXH0/9ROzjmWaUuTow97Bn7V9eC LCUgUt1/g0g3qTM1LciuXOIKUMpN3/NZU6/HX4+ehbpc2hPQlzseGJ5KDSdjLQtxeBzp uFqKbwNuaPQtp7f1OaC3WcynZbONq3YJHjirw+EF3iqL8Uvw/WnyJURisDgrXiHd2q+Y DllmUky/AuNiNil+20hrOge0mIcm2rLI6K6bkFzfUjdLGeAe0bNdQEr3/nYvGI7syImw Ogiw25JWiNad41DZpoa1DyHZR1th7v5PPFBUygTfYQhkxcY86ESdqveBG/o7K2c2Dp+l 3hdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=gyEDnrtueQS8+MjMS5a46KgP4MZ20PZU99j651zoffctTYfbAfdV4yGaVZFnH6HIxM m7LJ+OTNqf+grSUpz01sUupGp0vwTVwAZi0xu5GNEHyJdhu7e5qh9D7Qa2tyGfC2et/S Wbbx5Vr/1gs3pcCbUT67yDzGWhgHMG3cXo+fjtFpXVHxdRGbTCgByNQLm/tev07pwIzN KRVixULDei8T2u/aB9+PqC1c1ExKxVToHU3UQKMd6elbGi8LUzEz2K5zJyrUPDX8zcdR C76TuJeEaFl1ewoVs7e0mZAzDfvU9DbxM3TBW8/oRbTIEfkrtqK+qesQrAv9pK3XJ+ol yLNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="frrmy33/"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w79-20020a627b52000000b0063517dd1b47si11364991pfc.128.2023.04.12.13.01.52; Wed, 12 Apr 2023 13:02:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="frrmy33/"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjDLTuS (ORCPT + 99 others); Wed, 12 Apr 2023 15:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbjDLTtr (ORCPT ); Wed, 12 Apr 2023 15:49:47 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2047.outbound.protection.outlook.com [40.107.212.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079F17A80; Wed, 12 Apr 2023 12:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4oLoyt2UJuFINE6kDcpyJTpWDJy0rwhIx1JRZunDerfSoYKk/l80JVMMj6aVW/bx+i9goX2BjpnjN15Ya1DdwuGWfuRG/pVEfGI5HqXAbHkdObeIvYXJb/Ez/qnXpKcZpLeepeW30fpNeoqRbh7AMCMWs/QXgZorLVEfTg61+KvQO+A3hq5KqrKR204N7752LICrAAUS1LZK1LmaNfjdRDpEQmtSip33QBTjAdFxKy89Sv/diJYPDS8pI4MkiFqJODcw6NKsqk/9R/ZjBTp8F50re6OelD2HzYKW0smxA7Hx6iXdqQri6e/3O+2SXd+7SOe4bqTjBi42UIsI0Snlw== 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=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=PL6lgA/epwI+F+Bpr/JRRsgeaOoBAu6YeVuFfVK5d3QQjr0Dt2BKhExOCuSOVab2PSqDRWQ9O2FfRutda3pIc8Tj/6xY92GXfe0g9BAmeS2aOkbQw2D/I+9GGIO+2q2Ye2zIU1pRdoSXBjFemqYM9dfBczwxYNY6/CZ72H2jLS9Z5yn+3seu2VOlmOo7Ri/BX5i9I59NHJiuL1e6D3pVMpuJRjAxy+hzRtLCCsGH9VZMWHBsAi/zt5yHRd2ZA6YZWPpDmysAVPXQ6U10+dOpxmSYzmwv6zRwzLyjWHsN6LfvsaMbpzdiAlDwAKEiigRyGlLfGnkFuulJavJek4RbLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.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=fCQus717f+zD9JKyXeRkEq1zVYd+Ada2Q2y6ruMT/bM=; b=frrmy33/ySyssOSk7hUZkk7Ge3eHXY6Bg1VuGVBIu9coc1nx7A0viGl368CBvsI5HP27i3UeZcJuS705Hh/a+2CgwUTrqXmLvOolUqBSav2yiYY2EBv7vJsF6Ga6BUrjdxdEKM4HxFwZW451c1wSlE1pTw1pOYIcgt9TR9Y5zoQ= Received: from DM6PR06CA0064.namprd06.prod.outlook.com (2603:10b6:5:54::41) by SA1PR12MB6728.namprd12.prod.outlook.com (2603:10b6:806:257::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.37; Wed, 12 Apr 2023 19:49:39 +0000 Received: from DM6NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::fe) by DM6PR06CA0064.outlook.office365.com (2603:10b6:5:54::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Wed, 12 Apr 2023 19:49:39 +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 DM6NAM11FT070.mail.protection.outlook.com (10.13.173.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Wed, 12 Apr 2023 19:49:39 +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.34; Wed, 12 Apr 2023 14:49:37 -0500 From: Mario Limonciello To: Box David E , , , , Rajneesh Bhardwaj CC: , , Jain Rajat , , Mario Limonciello , Mark Gross , , Subject: [PATCH v8 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Date: Wed, 12 Apr 2023 14:49:16 -0500 Message-ID: <20230412194917.7164-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412194917.7164-1-mario.limonciello@amd.com> References: <20230412194917.7164-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT070:EE_|SA1PR12MB6728:EE_ X-MS-Office365-Filtering-Correlation-Id: fdaa4028-c203-4f7f-3513-08db3b8f0d61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A6e6vmHmhVjIOtQWlj2HwOOzIe+7faWuATD+cK30c2digTrLKROlstuX3SNxX/2CY+6iR7IhMSzF7VZSBqgzW00Pac6ckzBayGy8WSytFyAg1fU0kb6ck1XwSUKH4j2Im6BU+Lx79SLsFn/fhPHx+JrXZV09cTHpoiEXcHqepXHwKTLbdIWNwXlzHgSdbL3Buhq2imHzfObFBoGZPZxuZclgU5rI4vR2XJD1+3K7Jq6VoLBgJ/oN09aKLTvaJDDiFIMCwogUg+DZ9idlByTrq4tuE2P79EF7rTvXytenrXY+IA6ohAWds4DS6jtirpqe87D+e0tqGgx8gxudNeBXUxi4Fh7xbgiDNwEauYSB9YPenJV+NRhQ/BYA7li49Aei+zdZjIFlbGFYNX4Auo8gsJORBJe/0c5PVNJFF97Y+hkYjMaTmiOD3UnQhwhK2F9jEOB56qEZhtnyWqtpH2nNmX+qy0SjayA6j4UMKBhd8qXswK1ziqZ+YH4t+OTzz4AdPnUOVABEyGW9cprM4NWYFNhIlaLfYLpLwIl0XKITr1U8WX/D5LXQZBTQEUtjIXLRufr7AzzHFpFLfpS8DnEphCB8F+kYzL1XSeZ5BEeyoqTKooOPoKE8r+mdUWcGycsSR5j9rzS37eYZT517kpjdksnxjJRUZDUhIc/gEi7s9zrSZYIXiiVJVuACkwWi5tazKWR2rFbMmPM95Gm5jiqYJWYWMZElEeUonPSM90gVpS0= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199021)(46966006)(36840700001)(40470700004)(40460700003)(8676002)(70206006)(41300700001)(54906003)(70586007)(7696005)(478600001)(4326008)(110136005)(316002)(36756003)(86362001)(83380400001)(426003)(47076005)(336012)(1076003)(26005)(6666004)(2616005)(5660300002)(2906002)(8936002)(44832011)(7416002)(82310400005)(40480700001)(356005)(82740400003)(81166007)(16526019)(186003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 19:49:39.3112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdaa4028-c203-4f7f-3513-08db3b8f0d61 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: DM6NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6728 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763001998522853830?= X-GMAIL-MSGID: =?utf-8?q?1763001998522853830?= intel_pmc_core displays a warning when the module parameter `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep state. Report this to the standard kernel reporting infrastructure so that userspace software can query after the suspend cycle is done. Signed-off-by: Mario Limonciello --- v7->v8: * Report max sleep as well --- drivers/platform/x86/intel/pmc/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 925c5d676a43..f9677104353d 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1153,6 +1153,7 @@ static int pmc_core_probe(struct platform_device *pdev) pmc_core_do_dmi_quirks(pmcdev); pmc_core_dbgfs_register(pmcdev); + pm_report_max_hw_sleep(((1UL << 32) - 1) * pmc_core_adjust_slp_s0_step(pmcdev, 1)); device_initialized = true; dev_info(&pdev->dev, " initialized\n"); @@ -1214,6 +1215,8 @@ static inline bool pmc_core_is_s0ix_failed(struct pmc_dev *pmcdev) if (pmc_core_dev_state_get(pmcdev, &s0ix_counter)) return false; + pm_report_hw_sleep_time((u32)(s0ix_counter - pmcdev->s0ix_counter)); + if (s0ix_counter == pmcdev->s0ix_counter) return true;