From patchwork Fri Apr 14 01:23:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 83166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp60331vqo; Thu, 13 Apr 2023 18:35:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+qsE3ATR5c4z4oOxKFtC3jixyq+MwS4pOoH/PB+D0VbBjWyE4iOgkwpfAb19IFAN1jKut X-Received: by 2002:a17:90a:2f66:b0:246:96a2:b619 with SMTP id s93-20020a17090a2f6600b0024696a2b619mr4028843pjd.9.1681436130449; Thu, 13 Apr 2023 18:35:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681436130; cv=pass; d=google.com; s=arc-20160816; b=vJoR+b5Nv9GtFJmBxCcgxyQkuqMVzo+dvwJBkGxJ9tqAPI0bszTdyv+psUHaFneUfh 4vo1xEHv4aufh/LPaRWe2+RVudHUhrf5j0MBDqpP11vDMYyyzFX8yzo04nEElKN5eCVK 3adc8v+TlnBHJPsOj8+GwCidpcIJM3hI/WFA2Qnul0I/FbSvbD1pKrVpn/Ka63VOhSX8 drDylnXAzbvOa+oQ8f5MfQfI+grYFX9nYUG6Uk1CgMw3WAewuSn6sHzhumxl0D1XDjsr bOknz49k4/oc3lUoB3WxbvGXB+TmMwXLDOcGdWpkhH/zf/IgWwL9wlqiXU5mrpegyx2M RdyQ== 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=UkXc8hVOJZNjwGVhyEtJEknqxaESR1kLupXd4ckaIJJRjSHaQDgv+UFHuoyXU+8J9R fPMhqX+g7QAne5q26yUApujU7wOq/PbgJSFr9pc6OtWtCNmFXGALjrkHThcE5C1oLlaZ jj2ntyFRrRNNk7smKbJrb6Oak5QQW8OupUCOzbYnwf8JAjIpzmyHR+yLkAMULoq7IZf0 r3lceggQJDmmq81+E8BtarheY24XR3luLYRkBkEVTO8EiZ2HwO7zz/GITUrXVY8KP5zk uWl9gOAoiaAarZ51PW9VUt2quBCTpfjeTYgMzejf+x0jpYfwyccS7hVmLQGCc/y+wynA MILA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JYaMY72V; 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 q78-20020a632a51000000b0051b25fd77absi3298784pgq.887.2023.04.13.18.35.15; Thu, 13 Apr 2023 18:35: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=JYaMY72V; 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 S229949AbjDNBYj (ORCPT + 99 others); Thu, 13 Apr 2023 21:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjDNBYb (ORCPT ); Thu, 13 Apr 2023 21:24:31 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2064.outbound.protection.outlook.com [40.107.243.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBD9110C9; Thu, 13 Apr 2023 18:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fRfVnT375pEzDJbdT1sNJ/JZdy2qEdx/v0XEJ/Em0cYzcQNYKKKXlOWBo46TmZ0an43D0Sl7ROUqCr91mvu2VC+H8p9tlg6DCQOdntblYhGO80zK9ol7e1p4TEGTp9ZTp1bIM/rtjiJgapy9ixE6KSfI6Ar0p/EHz94PoTjWYpCpFHm9kCfgJzOLML7aSZjQ2HKqDgBZY/bvwLC3viaj+noAxaA8xGrHGXz7rWsiqoNRpofTWzjMHhZvfWF66sJUo/8ROrjASQnDmeUGbCKBIGM45RkDDxVcSk713Vip2OMdEHre46ZxzXr9kDFLSzg7HLI+AvQCAWvYfzMhxdLNzQ== 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=mLuiLxppwb8B1K6fM5aKfOY1Mv2OWxpFKEmaUUh1lGF6MBInrRo3OSsOCyksQt36mad/V5AabK+iEaDEoF7N4NYvBvR/ed8WmaxBF6iLkuoSPk58hAT5dNqNeiV6gjWiAaSkKZIGLRWypu9mtI/i8em7vgqQnL0nT41d+PKMsIDAQiJB8s4keYpMIpuk0bWKQvRO+mu/XZl8xSL8CZEw9DwQoezMZlItdNI2C2uFS5gmfx5YFtcqrvP13EvkKNMuD7CfeWVsLs9WNgtMckhd8GHAXWnLuOF73X5/0CP9unB7SZs4tXpujrtyme4/x3vIHjl5heV32gGFlDX25JpLvA== 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=JYaMY72VxhKItestMbyzjyu5Cp/+UuyeGplFk0UoIc6tjwJP0AguC5VuKlTFHtJcRyCZDwNl3VTw5DEOJzwXgIWHvhNaLYIm8ScCm8f3A4bUxqzbGPLjft7etl7Jd4JP/leOPTOzttikP1b4hFQ70IogxD6ixlRKeE1ZF4RR7EQ= Received: from DS7PR03CA0111.namprd03.prod.outlook.com (2603:10b6:5:3b7::26) by BY5PR12MB4870.namprd12.prod.outlook.com (2603:10b6:a03:1de::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Fri, 14 Apr 2023 01:24:25 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::ab) by DS7PR03CA0111.outlook.office365.com (2603:10b6:5:3b7::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.33 via Frontend Transport; Fri, 14 Apr 2023 01:24:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.36 via Frontend Transport; Fri, 14 Apr 2023 01:24:25 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 13 Apr 2023 20:24:20 -0500 From: Mario Limonciello To: Box David E , , , , "Rafael J. Wysocki" , Len Brown CC: , , Jain Rajat , , Mario Limonciello , , Subject: [PATCH v9 1/4] PM: Add sysfs files to represent time spent in hardware sleep state Date: Thu, 13 Apr 2023 20:23:42 -0500 Message-ID: <20230414012346.1946-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414012346.1946-1-mario.limonciello@amd.com> References: <20230414012346.1946-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: DM6NAM11FT019:EE_|BY5PR12MB4870:EE_ X-MS-Office365-Filtering-Correlation-Id: d7e0ab2c-58f5-43e1-2034-08db3c86fbe6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TwWmoXMB1zPWSnACm2qg3N70sQXMQcisbG2P/zb6jhIbITnIQXo4RaGWimsszr/Wc3UbGGl7Tj/qc8frGdvgrlmhuiPUn3JMBa/liwSybWnJdukTZEk5EnmCrPy5faxw5Scw9k39XVb21F42YjuLLhauE/IJWfUZajRQu6KaXF6+TbYRdgQ0WRANqlccolpCELNUAdS0e36qy2QkIbf6GxG2Ct7iqnlgEtNMYZeph+IT2pf74ioEyFGHDJaVNxd/i+vU8yJyoLZsKQqorYK4JeUqoajmMqUtSL9JpyzrQGC0rxkvdD66NDbvO38w2rcfRcSOybVFlVXU8PbH73NkRPP5zZklpqwbWe/6arS5Jd0UTAYoeGnc/kX/p4A6owiZLMxf+0KtW6TzXQBQG+00QBXDA0omyYcCrs8WBSFDQcwvwmjAYGWfiW84WlOPw2LBjGNv/NQGVkVrpklEZPmTbPrMalNm3/ZUn8dFGdFuL7HLEZlTdfYpe6xknprngGaDtIBXxuVK1ng8izSw8R36qpxGulCr6C1qrqm0z/5GiCI4bBs4QhqNZi7hd/A9Kt+pybw7No/3IQ0fa8QV0jzlwdhK/jWXGd/TXiBZ22RCLj7UH8PTcSrnjElQKOz33cMmdON3QiZ0SiMnIc6SakUsNbOqt06IVJgpEDgNQK3OZXp32g+Z+rX8CIfRUuPCIpLGunCbEEEIIAF741viga+VClDP7COfTfWgN1ilK52p+XA= 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)(39860400002)(376002)(346002)(136003)(451199021)(36840700001)(46966006)(40470700004)(8936002)(82310400005)(36756003)(5660300002)(44832011)(7416002)(40460700003)(356005)(4326008)(81166007)(82740400003)(40480700001)(41300700001)(2906002)(86362001)(26005)(1076003)(6666004)(36860700001)(7696005)(8676002)(336012)(426003)(83380400001)(47076005)(186003)(16526019)(2616005)(54906003)(110136005)(316002)(70206006)(70586007)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 01:24:25.1722 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7e0ab2c-58f5-43e1-2034-08db3c86fbe6 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: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4870 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 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?1763113571958723433?= X-GMAIL-MSGID: =?utf-8?q?1763113571958723433?= 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 Fri Apr 14 01:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 83168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp60901vqo; Thu, 13 Apr 2023 18:37:03 -0700 (PDT) X-Google-Smtp-Source: AKy350ZlkzXCirTUHB24oeCFfDFslm70i8xEWgib2ts7lmPy08bFqFMzY0oF3f6Efr2H7KALo0XG X-Received: by 2002:a05:6a00:15d4:b0:63b:6774:8f1d with SMTP id o20-20020a056a0015d400b0063b67748f1dmr738124pfu.31.1681436222746; Thu, 13 Apr 2023 18:37:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681436222; cv=pass; d=google.com; s=arc-20160816; b=fNzYRgDKRBGIAIJoToAXts4ftB5qvoARUbQkAx8b1EYO8Vc/Dq9DCfFfAiepDNvI1u 70r8MWSkc1KFkwNZSGJYiZRVS1dZHKiU4QWpicT3hRSyUGatpKoeNl5O7qiCZK1oaDPg wy521mErFqTI1uvMb7VoAhPOchfbgG4BwVcGArOxH63o4chmJv68ogSxZiYmfFNTxmUH fQlwjfOjVTATq7uQ2PldkHRSv11H+S62cdSeIFHQILwuHboIrUIZNIo4uV5eDDzqv8Pi 2YsU+XsY17FEGBlXmgM92op+w0Bmn9K2LDwc2QnyX3AS13N9ZS6u2OUY4ucbdO2YLsw2 BNDg== 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=mcFMwMhDcC9D3RZAej8I3sDpONun3VIHgOILn6LYEtHQcw602hYxg+1xHKT73x5c+4 j736ARAzsWBJ6vBjBhUJndqZfUU+k6UCShg19htnp6Rt6Lau5u0tyam/cdCwUi++ddvv +4qn8yfFLUSA/8GdtdrupbHW/AJx9JaTyfvdX45nF8Y/26FwshC6qTTnFdNsoD+G+dTY YWfErxKvgStnoHh9fEKxdtO0Q5rJGnwZdUgtDEDTETJo7s/+5TPmhk8BKCSjE7Y2/iE6 6+2K8KDDMUlYN36YTmMJSM5wwRPxSg6+IelzmqIL11LOOlY2fvGraHg6j6WT4SPviXUI vnSA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QUFcjJvT; 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 z20-20020aa79494000000b0062a3e63c747si2925413pfk.197.2023.04.13.18.36.47; Thu, 13 Apr 2023 18:37:02 -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=QUFcjJvT; 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 S229790AbjDNBYc (ORCPT + 99 others); Thu, 13 Apr 2023 21:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjDNBY3 (ORCPT ); Thu, 13 Apr 2023 21:24:29 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2084.outbound.protection.outlook.com [40.107.237.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B11AF7; Thu, 13 Apr 2023 18:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SWNDt2gh6+hvIFP2+2BF7dT1OzPs5zRlVSSC+GMkqoEvjASd9bjUdmJD1ldb0YcxeBqAjAYHY82IVknMqZhmYe8y7zIRbqvZc9hSpaP2YaQoZ3CTsbNaRPZCVk2JY/qCuU5XoCeOG4ew3n4Oo0G18i4QOy8DhLb+q0hgmc6EBhgb9cqxWSKiju3OPLF7hY3tJCyvpdB/NwWLj3rxEPjaMKkKB2G5xvfyA84UMkl/k+B3oYciwOqN1a1W7gzIwvX2Gf5cTCadKs9oDMTGZfcuirDNhHm22CZmlFGL+gTDhqic+9k8y5inKJfI1UxqZgWTb+/AO6/D/1AVvCOfu3YQqw== 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=CWZ3PW+SyqiajzR6HkFBQBbv9UGsHdsayozyuXkeSlrvmynhmtWxr7aU83yoSmyGXR8P/e7uRsupUJFfnXrh/U+EEHV5nJTUNkRSQhOOG1nkqgw7bdz7gq4oGy0ETXcOaJBY19PLjsDXyMBSZfj0dtbH+iOBJARsplgoaaobDBLUdRFPPbPozCFW6qLSEdXwPWmfqZn51hVmzPFm9rZFZcYDMNyRnS6KEebEpLrndIZ6VJaukCVwm304Z+3QNeMYPLRAJPw7Xe0H4SlXtY4rhTxpIntvUqnPt+Ti930P7R9O9YY5sFNm/eIyMcbxDOBftgz3Su6a701u1tZkZoLEjg== 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=QUFcjJvTBRdcAPqEBychE90Zfpzp0T7+T4biEUS6wnOfh6pABCGmCX8Z/SppFcq8z+0OZ8tEeZsvnut/on8XnfTq1Jto2mv+q96QXzjK8gvVFh6VOCiJu1ZZp0ZsSoA4AkQXe/l2Tlk/c+9TwWzv495E9z0jO7MFAKUcsSCQw8A= Received: from DS7PR03CA0119.namprd03.prod.outlook.com (2603:10b6:5:3b7::34) by CH3PR12MB9027.namprd12.prod.outlook.com (2603:10b6:610:120::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Fri, 14 Apr 2023 01:24:26 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::3e) by DS7PR03CA0119.outlook.office365.com (2603:10b6:5:3b7::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Fri, 14 Apr 2023 01:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.36 via Frontend Transport; Fri, 14 Apr 2023 01:24:25 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 13 Apr 2023 20:24:21 -0500 From: Mario Limonciello To: Box David E , , , , Shyam Sundar S K CC: , Jain Rajat , , Mario Limonciello , "Mark Gross" , , Subject: [PATCH v9 2/4] platform/x86/amd: pmc: Report duration of time in hw sleep state Date: Thu, 13 Apr 2023 20:23:43 -0500 Message-ID: <20230414012346.1946-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414012346.1946-1-mario.limonciello@amd.com> References: <20230414012346.1946-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: DM6NAM11FT019:EE_|CH3PR12MB9027:EE_ X-MS-Office365-Filtering-Correlation-Id: 681d6fae-0a1b-4a0f-8ef9-08db3c86fc58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Svv/iEMFIpd6r/QJlaO/S4DL5iCQBMpjxOHk/Us2J0CcYBmN0/ZYGNatkXUEGFsoR+p1dDODN0gKA0uL4s8yTN1k+1G7jfg9ZPPGBa803tWw7QecNV0RTnQhYcvcRMIM4zTqiyPF1vcQXKopxefg9nlXOqtwHELoADuUsBaG0rArINoa2Y0LKwjyraMe+WXNfgPoTl1ywesRWtW99+NNbjiTWMXTv60vKqz5s5AbT3UQ3kLYEgfmu3dFyqxCKIo8hl7lyQkgcCW9rcMcProLPnJD7ea93bPQlTf6jXg9ZTHwQUEKJrf93kkvE08oJvJPtCgOWaRpRnvje6yXndK2TkjIi9QZVr9eoInZPDPpMlWHBMxOvQ7nKwdIZ3GmnJ67rPx/JQshxkNZTTUzBR/b/mB/TOTDgapUTIEpX5i4ci9SobhlSrtfgoy6s3DAjwyLjenDeElpH+Gzss9vuxBICiB9CA6iJyaIzFyqO3NLh8eRGIRTzM7zFOHm8N4LHE7Sepc6fRRPO9Y/3+KH5KflrZ3T1XmNEr3zQREe+Q90vr9JF+z3M73AQgHpyzJ5C6+yYDmcqRIbLdKTVIM54QNqbZGy+wZEutIH8xi63Ab8HznIyUWMr95UmLYHxfkR0C8/gE/z1LYiVf0fxJJSj6lblCdoLZd16K7wIAXYS8me1R6EL5HUCmUlE0Ax4L8Qf7XpDer7M6MhDPIGnuaSI+ZoXYOycdvxqkvWBUFFKkHGHQM= 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)(346002)(136003)(39860400002)(376002)(396003)(451199021)(46966006)(40470700004)(36840700001)(8936002)(186003)(16526019)(1076003)(26005)(40480700001)(7416002)(6666004)(5660300002)(44832011)(40460700003)(82310400005)(86362001)(426003)(336012)(478600001)(36860700001)(316002)(83380400001)(54906003)(41300700001)(6636002)(110136005)(356005)(47076005)(2906002)(2616005)(7696005)(70206006)(36756003)(70586007)(82740400003)(81166007)(8676002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 01:24:25.9222 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 681d6fae-0a1b-4a0f-8ef9-08db3c86fc58 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: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9027 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 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?1763113668421457743?= X-GMAIL-MSGID: =?utf-8?q?1763113668421457743?= 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 Fri Apr 14 01:23:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 83165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp57512vqo; Thu, 13 Apr 2023 18:27:32 -0700 (PDT) X-Google-Smtp-Source: AKy350ZkV4gEmUSo7ul9CEMdIb13gPvcomQ5c+0rcK2h7qfW2PLIzwUillvGwfTExj/pftj15d4j X-Received: by 2002:a05:6a20:60c8:b0:d9:250:665c with SMTP id q8-20020a056a2060c800b000d90250665cmr3615640pza.15.1681435652194; Thu, 13 Apr 2023 18:27:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681435652; cv=pass; d=google.com; s=arc-20160816; b=Wce8VDpGgzAe4cYA13RrR0eummPKWM6zqwnlb+9TwrXqF4I8Ujj0GlQagA5k7Ipm9o GaLEBwNlv1KOUn5RszZ/TEvCuRixfvCNMw6pFF3ATyMrzjt6QoYlJiXUnyYlXQzev4Jk YfJUkN6NKy4tyt5e9Y7asTGi+L9JUNum/RzEgT33wtDz7LMbS/bBYWugwnCidFhhSrDM XkXKa1S/1xRB/uef/jsjcEeaEGAvOWAHnYmic4yeq0dwuLeNioU5pLpi/QCmuzugrJSJ 3vmtKraxozfr3bp2U/xZI9lzwK2uORciYMtkoYGOqY+dWjprrLgQI0mRinK0L5n6ZLv3 1p+g== 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=hmVJj+9yNvbfQcotH+5n4pIh8T2MiAyaXedc56H1+X4m51RffVDzQq/k5fpWmRKzWK JyJ9BT9WbKzMovoXCUgnRtrmWbjjW8B8M82pTJJidJAomOeEwM9DsGimngmlWfEujMDR KOuUqGe/ZLSXnt2jG2f8NkvmKrxF7JC/leRs3KywYZgLZ1VWhwP+T1RIiI3ES2MLryHG koB9e7t3OoLPto+mwaUe2RuBIFKAfShkaao5Oa8oOJhAygvCTcpIMSO1l4pD4NcD+uCn 3HeVBgRikHxS0p33np6k2wgRgCioQVuTgbXpwrT6c12h+43t4OamE1aYIpcC3JxD4DAR ASHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=sPCG3ThX; 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 x191-20020a6386c8000000b0050bfa82c245si3376045pgd.855.2023.04.13.18.27.19; Thu, 13 Apr 2023 18:27:32 -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=sPCG3ThX; 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 S229907AbjDNBYg (ORCPT + 99 others); Thu, 13 Apr 2023 21:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjDNBYb (ORCPT ); Thu, 13 Apr 2023 21:24:31 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28E1E69; Thu, 13 Apr 2023 18:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpoxlqB7DTLLYqyx6Mf0DrGdahCkbTGhriyeyBwzHyKKKEF+iqLmTwX/M5YDKxqwwXW79iVWWHBgpzbsTQ5vAI6YxewixQYUGnYaulHsDnFqZHv9hZ4yg9b4g0ZOj5aVzXNmE3r/KtjrrbpWxHCF81/VBJdEaeFMG3okf48mM+4YsY9KX04NEUQq5ii32R4HhdI9Ddf2YnUcEdr+xD/uovIfZXEatui30jeQjy/nkuVNsjI+usVDEPKV+9Qe+WIGira5wvFCZ19igXbV0zL1WOxwUAqWthX44mk1tLSgF5E2P1nQSwuts34X1cKdTwc5EtGNJeX6pb8DmvEaCurSVg== 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=aLxyqIs1SlaMOqnty4CS7CXYFxAuirc6bSeypO0Mh70GdrApheGvKRCw5eHLCQoaDa12WyaKLK/2IdA1QQKTZdJTgtH31TyUcJ9nSPl6a5OWjn7grGSekOlFg/Wle7mT5PeMdXvJNGiUwbaz8n1LcbG1ezM+qF6GuPOwZfHzelBbnuUAgElHF0FHpaJeNhJUyxLuL6jNaCRrzEC+BBdE8QMFrCF6myz3N2ZmLt4kJfetzp2VYay7wQtXSY3m3Df+cUyBO+o4B5rWOi1HBuqk9VuQU2+cS8j86U7sHZRxtdWctUS5WFxAPrCKYxGky7rACeruQnTZ1KL+3Yy6bOcSWA== 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=sPCG3ThX+0vOyxfSewCrhsJWBWaa/EAM2xJpNUcOQ3eVcZwWQDi7YSh8YhZ8KqrlRjyd4NKcSIQD4BLJasRM9QDek9fJazUIazRp2/I3mj5PPbGF5YX5QjtP8Gi7iiO33ohsvGYM3Q6HQ1OswvqF9CaXv822qPrqm97NhKY1H0A= Received: from DM6PR02CA0080.namprd02.prod.outlook.com (2603:10b6:5:1f4::21) by PH8PR12MB6817.namprd12.prod.outlook.com (2603:10b6:510:1c8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Fri, 14 Apr 2023 01:24:27 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::3) by DM6PR02CA0080.outlook.office365.com (2603:10b6:5:1f4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.31 via Frontend Transport; Fri, 14 Apr 2023 01:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.33 via Frontend Transport; Fri, 14 Apr 2023 01:24:26 +0000 Received: from AUS-LX-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 13 Apr 2023 20:24:23 -0500 From: Mario Limonciello To: Box David E , , , , Rajneesh Bhardwaj CC: , , Jain Rajat , , Mario Limonciello , "David E . Box" , Mark Gross , , Subject: [PATCH v9 3/4] platform/x86/intel/pmc: core: Always capture counters on suspend Date: Thu, 13 Apr 2023 20:23:44 -0500 Message-ID: <20230414012346.1946-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414012346.1946-1-mario.limonciello@amd.com> References: <20230414012346.1946-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: DM6NAM11FT050:EE_|PH8PR12MB6817:EE_ X-MS-Office365-Filtering-Correlation-Id: e6f8e632-ff93-49f9-b085-08db3c86fc80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OoZfYjm9cncJ90fyvrkTNsH6zgqwW8MxIxmoyXLSUvc2r8HJn2+6alJcptXOG0Mqsrakabsb33LVYkUHiABHzMJ3n5rgFiMF9KR39DInL0CvxufXP4bnm50XR0fjlyiTqrDL2UHgdTnBj9VKYJyk0LAQhCdDbt1O46YIQCeYcJA3QMGGHMOSYTxU7/Htn/izgXnVYAalzpZt9tufVTrjmv8Ji6feqieVKYXjorFxNZNb2ec4gwW/Ox1yxz0Bvsc1kiy5sedKYz2KruZCY1rPyT7HKYLgH9YimOdOpE6EYR3Or64ncKBwnt7MVYMHHIrKOJEiOTKx76GMhhAbY4sw241HENxkt32Jl21GrAxSEwnxAid6Ct/7ecOgny3FtRt7nvrpzR7WxVA5syU3nMnETxLDMkCm2lo/8AY31xCan4e+FAu8frrhB0yYJuYdKWjPXt6R4JUcJriWlzOWoCxKpKXxnRpua7it4R5JFwiQH2lIL03jsxkEq1Bc+FreO8GAP/+AiDSnBU95xUjZa7lHWoomxnKn4eJWdWeU9JyrMv+N96B38SldOOroM4w+JK01oYrL/eoYt6mqaxs7z9AY8GXvpwFcCv9E8eoRmI+shrkzDh9LeNDuTC5BuMr3BwomTRKFgLGURA4+ylsdFJsXGDyNY6Cv6SYmhbA5xEY3drUd6Q2Cjolbk9uL0HvMB+wFjxXzSlDRNF2VA2aFfg1LLQl4MKydzkqZB8eJ9U5JQw4= 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)(346002)(396003)(136003)(39860400002)(376002)(451199021)(40470700004)(36840700001)(46966006)(336012)(426003)(26005)(1076003)(40480700001)(70586007)(70206006)(36756003)(2906002)(6666004)(83380400001)(82310400005)(47076005)(7696005)(2616005)(186003)(16526019)(36860700001)(4326008)(15650500001)(40460700003)(110136005)(44832011)(54906003)(7416002)(86362001)(5660300002)(8936002)(8676002)(81166007)(316002)(356005)(478600001)(41300700001)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 01:24:26.1539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e6f8e632-ff93-49f9-b085-08db3c86fc80 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: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6817 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 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?1763113070562674922?= X-GMAIL-MSGID: =?utf-8?q?1763113070562674922?= 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 Fri Apr 14 01:23:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 83169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp60957vqo; Thu, 13 Apr 2023 18:37:13 -0700 (PDT) X-Google-Smtp-Source: AKy350YKv+q+TGd2YKS0+sC9xsYTqhjNnoY2Y25vkb1MiyqOk9eDfneueGXxnYpViCe+KWHL6Fbf X-Received: by 2002:a05:6a20:430a:b0:ec:8bf4:5115 with SMTP id h10-20020a056a20430a00b000ec8bf45115mr3102886pzk.24.1681436233468; Thu, 13 Apr 2023 18:37:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681436233; cv=pass; d=google.com; s=arc-20160816; b=EPv5nElkW+sLmyE8FpQzkmsh5OMs/usK0UjhHBADGYTbdlRrcok+Gfow6kW/ZWjYYU 4xf6R0sCRWCXrIfSEhnPRAmvQDZ7CC77SsEzW0pnXC2J3G23Dr2Vqu/RPRDl9SFPrc3Z f81oRctN4Gy/h2CceV1jzYGuTBTc+6j5pa7hJuYwDq9pwo0fCnFuoXYUB3uVhZlfgwt5 2IHjOUQgQxwM3GmO4kzAbWlctI1YrKhlTzN++ESRys21svgukg9yNKeLhQ9SuBdVmzTc O7k67OHNeNB4vgqQ4J8s6LZpWQwhxrpXiHywDyzco6WZdGpZEDa2reAc0/jBhB+7WAWT fvyQ== 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=uEGYGPy5OjPx1cD0EI26wT4NCdlfHrDRRS1jFg0AECw=; b=NI08/3zwq6lWBZYHPRiMQfx/5OK6fm+TNviLMIBNiplwV0tCqLlBWB3iRLbPKSxEi9 VNjfmv6aYj+yLY7e+U5gnivq/VkxWS/6JTNlyHl0vHgPeoBykhwFLVq6RzaaKPtHxuMs 8Q5tHvG9bDo4Rbo5UZkSGsr23+Q6jC44oYim4mSF+9WN7d7v8Cq1bMlzMK3SATyat8li IWr2YSgpX72rTbCF3bh1ASWSrEiaj1MlcZSVH8ogoCi9dEmlRzygg7NEJSwWac3OdbWn a0BYuaZ1dtY8/NH/uXZrqYIgHHnV+XczRV/mNF9knMVwrglroqC+b0s2+wURZytamerl EGCw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XWtE5E6D; 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 x189-20020a6263c6000000b0060d7d3b2777si2948343pfb.176.2023.04.13.18.36.58; Thu, 13 Apr 2023 18:37:13 -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=XWtE5E6D; 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 S229959AbjDNBYm (ORCPT + 99 others); Thu, 13 Apr 2023 21:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjDNBYc (ORCPT ); Thu, 13 Apr 2023 21:24:32 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C813E40FD; Thu, 13 Apr 2023 18:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lA0SPL5yq06GRlTwRFKWkhq87uKmUk80BxgyRkNBHcDx6VH2lwRxgsPBvIpSq9zFhGWao7YyO5zN+3IMRa63Ro5jTYCfj4KicbaJMkgVZ8nmDrbdwKFmuevtCao9CqFhua4vs1nEzL8RNi8i3QIogVv6b4I437aYkJxUbdbCQ7gSnXriRbGzam6y69ThxnllAUo4ASKHI0VMy/dER1OsOMO1NTdBGPRkreK9hAXgyBdSxSPUDxWt7OflF3id7x+oeqnBFVMCf0P9XHF3cevxfkBgL/gFr5kEBauiknzbs/eaozwjFjUL1OWFjLoGsYFORGsc/QnWnUeD6sV7xiDdWA== 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=uEGYGPy5OjPx1cD0EI26wT4NCdlfHrDRRS1jFg0AECw=; b=lybRjdR8mMIqmsMs1eMdIk2OHzwdMkHKvEM/evf1fUz39ZJ2/rmgi/u3mAMBCM5Vok+thsbrW+obKZvz7wtvATGFWUJPNzKrh1nEMOLGeHj1Pu4oHdY2dvxsnZe9aVZwqc5rteitt76ltxOKVGSjo4P+NEN+HxdvGrjKQqwHsy5VVe9mfEEtXcpNz5aLy/H2Ij33Yix1sarOY5LYBvfFATuJG1CYvs/UWjQ4il6AVxEaVwNdrDPt7V5gyjS1UXkouCvl2x3Wyzs17kTw8sQJmHGoPdjpLk8aNctjuxPNfMB/cEl5YC+WrTUcMHuudUkg3y7tbybxqBUwRSpuyLwBWQ== 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=uEGYGPy5OjPx1cD0EI26wT4NCdlfHrDRRS1jFg0AECw=; b=XWtE5E6DEZgADQtUy/Hm/QwOFJcdVZaluPrcptG+erKnj8uIeDzkBBIHrkEHkveQI2YnrodB7OE/AY6GT1qBBB7TOTmf6Ekn9VuLLHXWflldXd/AOIu5NHMm7G+AnJPliW0k0ER31sAXTXV27zKA/g1ue/Js7pLdcDdoqmWNlgg= Received: from DM6PR02CA0105.namprd02.prod.outlook.com (2603:10b6:5:1f4::46) by MW4PR12MB7189.namprd12.prod.outlook.com (2603:10b6:303:224::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.35; Fri, 14 Apr 2023 01:24:27 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::15) by DM6PR02CA0105.outlook.office365.com (2603:10b6:5:1f4::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Fri, 14 Apr 2023 01:24:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.33 via Frontend Transport; Fri, 14 Apr 2023 01:24:27 +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; Thu, 13 Apr 2023 20:24:25 -0500 From: Mario Limonciello To: Box David E , , , , Rajneesh Bhardwaj CC: , , Jain Rajat , , Mario Limonciello , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "David E . Box" , Mark Gross , , Subject: [PATCH v9 4/4] platform/x86/intel/pmc: core: Report duration of time in HW sleep state Date: Thu, 13 Apr 2023 20:23:45 -0500 Message-ID: <20230414012346.1946-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414012346.1946-1-mario.limonciello@amd.com> References: <20230414012346.1946-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: DM6NAM11FT050:EE_|MW4PR12MB7189:EE_ X-MS-Office365-Filtering-Correlation-Id: 72991e36-f0ee-40ce-41e2-08db3c86fd38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s+1tIQJGxEMVlkVrnZPzlNhaicA4vBpV6P5b8H3dTEx9UQ2fKMTTM06q5bpIXNN0/yyCEuqvrFHryGfbnrJy0U0KlcF6p1Vur1YCoNGxf5NLRasRIgm8L24gwZh/9GynWDXez4ZRhbLn7YaFgMIDUhnlS9024c7eXKxX+2W1auPy/BD/b4z6T5Bk44op1JSYMxpvxpmth2ghLAYGvK/G83fMKPFZv9wrwAaTFnxWDCjAgf9uRNIolSSjnXUcmRSIpcvamMCnF9yUwe37J+FJrzFBQIGOttg4ISJ7+Qo3irT3WJFECxpBr+hWmPTg5nW5NUAAaRHHjuGR+JuXv4RYirKnzm4BxKVefxqYakBDDCWJv7EdjY2oSMsndOJk2DrUOsFWFjx+2zKGafc2X+UoUSWdP5NvfIBEYZsl6yNswm3fmUwiQiz9lg1N2h95t08lPNpO4tnJk/FULacMYEBqQyrP6Fe7KgcicY1SQUJkscGk8nR8Qlj1UcZgr5m+QfvxgT5Wr5lV1u+PtMZ7utstW8e9GpaZHSrOzZRemQ/3k4G8OX/oLiNsg/zfQ/eryWrXjWHbxbG4wSinAwPPH9HTP9SDKMlhGR/UDUJrmh52imR4Q5hOGtIYhGjmAG4pbX1wc4H8BRDwC9B39HICyVOlEKfrLJCp34WFeEENYjhoxE7xirj0pKL94k5BCxgSwHJpELUyuNtwxlIz3wYafQkr2+X4wKxY8JAGAX75ycNwqOc= 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)(346002)(136003)(376002)(39860400002)(396003)(451199021)(46966006)(36840700001)(40470700004)(7416002)(110136005)(4326008)(44832011)(5660300002)(8936002)(54906003)(2906002)(316002)(16526019)(478600001)(70586007)(41300700001)(8676002)(70206006)(186003)(7696005)(6666004)(81166007)(1076003)(356005)(82740400003)(40460700003)(26005)(47076005)(2616005)(83380400001)(66574015)(36756003)(426003)(336012)(82310400005)(40480700001)(86362001)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2023 01:24:27.3414 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72991e36-f0ee-40ce-41e2-08db3c86fd38 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: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7189 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 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?1763113680039888372?= X-GMAIL-MSGID: =?utf-8?q?1763113680039888372?= 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. Suggested-by: Ilpo Järvinen Reviewed-by: David E. Box Signed-off-by: Mario Limonciello --- v8->v9: * Use FIELD_MAX and GENMASK * Add tags v7->v8: * Report max sleep as well --- drivers/platform/x86/intel/pmc/core.c | 4 ++++ drivers/platform/x86/intel/pmc/core.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index 925c5d676a43..298f27ba1e10 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1153,6 +1153,8 @@ 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(FIELD_MAX(SLP_S0_RES_COUNTER_MASK) * + pmc_core_adjust_slp_s0_step(pmcdev, 1)); device_initialized = true; dev_info(&pdev->dev, " initialized\n"); @@ -1214,6 +1216,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; diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 51d73efceaf3..9ca9b9746719 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -16,6 +16,8 @@ #include #include +#define SLP_S0_RES_COUNTER_MASK GENMASK(31, 0) + #define PMC_BASE_ADDR_DEFAULT 0xFE000000 /* Sunrise Point Power Management Controller PCI Device ID */