Messages in this thread Patch in this message | | | From | Mario Limonciello <> | Subject | [RFC v3 4/4] platform/x86/amd: pmc: Populate cpuidle sysfs file with hw sleep data | Date | Tue, 15 Nov 2022 14:01:56 -0600 |
| |
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
| |