Page MenuHomeFreeBSD

amdsmu: Sleep entry/exit hints for PMFW
Needs ReviewPublic

Authored by obiwac on Jan 29 2025, 9:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 19, 2:55 PM
Unknown Object (File)
Thu, Jan 15, 7:28 AM
Unknown Object (File)
Thu, Jan 15, 7:25 AM
Unknown Object (File)
Thu, Jan 15, 1:27 AM
Unknown Object (File)
Thu, Jan 8, 10:56 PM
Unknown Object (File)
Tue, Jan 6, 1:36 AM
Unknown Object (File)
Dec 25 2025, 2:57 PM
Unknown Object (File)
Dec 25 2025, 2:57 PM

Details

Summary

amdsmu_suspend and amdsmu_resume for sending hints to the AMD SMU power management firmware (PMFW) that we are entering and exiting sleep. We also dump sleep metrics once we tell it we're exiting sleep, so the relevant metrics are updated.

If building for ACPI, set the ACPI_PMC suspend and resume methods added in D48735. These are then called in the acpi_EnterSleepState() function after the SPMC's suspend method (if there is one) and before its resume method respectively.

I don't love the idea of stuffing acpi_EnterSleepState() with all these PMC method calls, but not sure what a more elegant solution to this is. The SMU calls must necessarily be done after and before the equivalent SPMC calls respectively.

Test Plan

I have tested this on the Framework 13 AMD Ryzen 7040 series (Phoenix):

% sysctl dev.amdsmu.0.metrics  
dev.amdsmu.0.metrics.total_time_in_sw_drips: 136191457
dev.amdsmu.0.metrics.time_last_in_sw_drips: 136191457
dev.amdsmu.0.metrics.total_time_in_s0i3: 0
dev.amdsmu.0.metrics.time_last_in_s0i3: 0
dev.amdsmu.0.metrics.total_time_resuming: 0
dev.amdsmu.0.metrics.time_last_resuming: 0
dev.amdsmu.0.metrics.total_time_entering_s0i3: 0
dev.amdsmu.0.metrics.time_last_entering_s0i3: 0
dev.amdsmu.0.metrics.time_last_in_s0i2: 0
dev.amdsmu.0.metrics.s0i3_last_entry_status: 0
dev.amdsmu.0.metrics.hint_count: 1
dev.amdsmu.0.metrics.table_version: 3

(Metrics after suspending-to-idle once for a little over 2 min.)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62102
Build 58986: arc lint + arc unit

Event Timeline

Pass errors along in enter/exit functions

once added in D48735, this should use the PMC interface too

Use new acpi_pmc interface (see D48735) instead of new methods on device interface, and generally simplify how this is being called in acpi_EnterSleepState().

obiwac added a reviewer: olce.