lkml.org 
[lkml]   [2022]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v3 4/4] platform/x86/amd: pmc: Populate cpuidle sysfs file with hw sleep data
Date
AMD platforms don't provide an ACPI LPIT table, but the data about
duration of time in a hardware sleep state is part of the SMU metrics
table.

To allow userspace to query this from a standard location, export this
information to the standard
`/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us`.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
RFC v2->v3:
* New patch
---
drivers/platform/x86/amd/pmc.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index 2550ba6d28f5..ef5c23df1a5b 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -787,6 +787,11 @@ static void amd_pmc_s2idle_restore(void)

/* Notify on failed entry */
amd_pmc_validate_deepest(pdev);
+
+ /* Silently fail, if cpuidle attribute group is not present */
+ sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
+ &dev_attr_low_power_idle_system_residency_us.attr,
+ "cpuidle");
}

static struct acpi_s2idle_dev_ops amd_pmc_s2idle_dev_ops = {
--
2.34.1
\
 
 \ /
  Last update: 2022-11-15 21:04    [W:0.056 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site