git: cb77c4e846d4 - main - amdsmu: Don't rely on s0i3_last_entry_status metric

From: Aymeric Wibo <obiwac_at_FreeBSD.org>
Date: Sat, 24 Oct 2026 00:01:09 UTC
The branch main has been updated by obiwac:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb77c4e846d420af4d7d43f6616da213689a734b

commit cb77c4e846d420af4d7d43f6616da213689a734b
Author:     Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-10-23 23:56:58 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-10-24 00:00:42 +0000

    amdsmu: Don't rely on s0i3_last_entry_status metric
    
    This metric seems unreliable and I have observed it occasionally report
    1 (successful entry to S0i3) when the time_last_in_s0i3 metric was 0 on
    Phoenix, which does not make sense.
    
    So just rely on time_last_in_s0i3 instead.
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/dev/amdsmu/amdsmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/amdsmu/amdsmu.c b/sys/dev/amdsmu/amdsmu.c
index 0e4f0bc17e22..555b263b5bc7 100644
--- a/sys/dev/amdsmu/amdsmu.c
+++ b/sys/dev/amdsmu/amdsmu.c
@@ -323,7 +323,11 @@ amdsmu_resume_check(device_t dev, enum power_stype stype)
 
 	if (stype != POWER_STYPE_SUSPEND_TO_IDLE)
 		return;
-	if (m->s0i3_last_entry_status != 0) {
+	/*
+	 * XXX For some reason, s0i3_last_entry_status sometimes reports 1 when
+	 * system didn't enter S0i3 during the last suspend.
+	 */
+	if (m->time_last_in_s0i3 != 0) {
 		device_printf(dev,
 		    "spent %lu seconds in S0i3 during last suspend\n",
 		    m->time_last_in_s0i3 / 1000000);