From nobody Fri Sep 18 10:59:27 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hmV4b4YR8z6sHq7 for ; Fri, 18 Sep 2026 10:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hmV4b32NBz3R0K for ; Fri, 18 Sep 2026 10:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789729167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z3ZqgbTIbSdcyIX6G/yWRIVOkXmyGrk7D1yrOAeQ9j0=; b=VteOKtdgPCU7YI4TXS7qkK7dthzTWbeL7+q4GgFVyNm4L+ABi6Wxenn5Ace2JxiYR/NlTY WdFjGexK7EcY08r2k3nVtmz0XZu/oeQPbGo/B6MEHwIm2m7Dl1JbT5lsIpXB7ndta+WqTc +7sScCPg9SOAGf6xXW4Q7iGtfoQANVbtStPyErKdZZdlSyRnWOtNecAgqiVj/sCsa+NYEb rO75rt5WrXCbMwOusv8/0xrR19fQKSbu7CyKiHHwnVu0y2yL9YGxBVUBH8EbgIVTVVTgMF VBDqFEGnbHPJ6M8RZgeRy9ASnyMPbs/y/Y36MW2gkkcfu3QhowsyTkg/RWbnCQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789729167; b=qTJv8dLvHolWlWyJqDHkAvQ8X2IhdCJ192dqSAdu1cI7JoSwccUii3Ng9l+n49+3Jbg6ej gY8WsXXA2BaUG1Gs3VFRBWvLRm1dUqm15mzuugdQAkyEsnyBwKzEEF2ZDQOOUXutZPB/bc 504S2KvmSEuvuLmM8CY5SoVfS31WPgVEpKCmdcM8q4xWfcJya1/4wVEGtxgAQRFG3PoHto zq3pYk/gTaLGftm7d0H6Sb6vGr8VnGYKqRpGevSCdaHtCT8T/3eYGM3gtrk7ZO7JZrbZgS 8smxYKOfwKOw9BBDg7sZz11BYw6I8Oi6tG6HVAtb2Rauf1SjLt5cwHppseeprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789729167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z3ZqgbTIbSdcyIX6G/yWRIVOkXmyGrk7D1yrOAeQ9j0=; b=cFTqjMT4urlk8TmqoEecxcH0gQpgSVyNUL8Wm+8yUxTaOIKs1rF6BQIQWwMz41wSQi7Q4G qk0eWEIRwIxj+pkTb0E2/VO4IpjMG1WOLxJXG1G2Md1W6lK4mTECv+ZTr4cy7uux9rC1hD ZCVQWSy5Z28vBajm9m1SnBT60WUyJt5BPVwPf1BkqcF5VzcNgHSxO7mGNv2EqjJCZIlLM2 A6hPG1w00fKun3vZahnzPd3DRUF6alc9he6dfXMSFOVSTIQmoPkiyL7tf/WPsUp5CpzbQ0 8EFChGq29RwR6KmkLO8dQ69+fvX0mFVQrinhPi8j82GG9JMFK7fHTUxg9yeLKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hmV4b101zzFxk for ; Fri, 18 Sep 2026 10:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27d01 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 18 Sep 2026 10:59:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: a23fa3fe1c0a - main - amdsmu: Diagnose S0i3 entry after resume List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a23fa3fe1c0aa4e529b26bbec17d17571f8708fd Auto-Submitted: auto-generated Date: Fri, 18 Sep 2026 10:59:27 +0000 Message-Id: <6aad198f.27d01.482d80c6@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=a23fa3fe1c0aa4e529b26bbec17d17571f8708fd commit a23fa3fe1c0aa4e529b26bbec17d17571f8708fd Author: Aymeric Wibo AuthorDate: 2026-09-18 10:50:22 +0000 Commit: Aymeric Wibo CommitDate: 2026-09-18 10:59:14 +0000 amdsmu: Diagnose S0i3 entry after resume Print out diagnostic information after resuming from suspend-to-idle if we failed to enter S0i3, i.e. the IP blocks that were blocking entry to S0i3. Don't give detailed IP block info for other SMUs than for Phoenix, as I have not had a chance to test these yet and the SMU seems to be very quirky. Reviewed by: olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59673 --- sys/dev/amdsmu/amdsmu.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/amdsmu/amdsmu.h | 1 + 2 files changed, 49 insertions(+) diff --git a/sys/dev/amdsmu/amdsmu.c b/sys/dev/amdsmu/amdsmu.c index ffffe0b5219f..5902e5e9af89 100644 --- a/sys/dev/amdsmu/amdsmu.c +++ b/sys/dev/amdsmu/amdsmu.c @@ -317,6 +317,51 @@ amdsmu_resume(device_t dev, enum power_stype stype) amdsmu_fetch_idlemask(dev); } +static void +amdsmu_resume_check(device_t dev, enum power_stype stype) +{ + struct amdsmu_softc *sc = device_get_softc(dev); + struct amdsmu_metrics *m = &sc->metrics; + bool any_blocking = false; + + if (stype != POWER_STYPE_SUSPEND_TO_IDLE) + return; + if (m->s0i3_last_entry_status != 0) + return; + + device_printf(dev, + "failed to enter S0i3 during last suspend; " + "battery drain will be excessive\n"); + + if (sc->product->amdsmu_deviceid != PCI_DEVICEID_AMD_PHOENIX_ROOT) { + device_printf(dev, "only limited diagnostic information " + "available for %x:%x; check dev.amdsmu.0 sysctl tree\n", + sc->product->amdsmu_vendorid, + sc->product->amdsmu_deviceid); + return; + } + + for (size_t i = 0; i < sc->product->ip_block_count; i++) { + /* + * An IP block only truly blocked S0i3 entry if it was active + * for the entire time spent in "SWDRIPS". + */ + if (m->ip_block_last_active_time[i] < m->time_last_in_sw_drips) + continue; + if (!any_blocking) { + device_printf(dev, + "IP blocks that blocked S0i3 entry:\n"); + any_blocking = true; + } + device_printf(dev, " %s (active for %ju us)\n", + sc->product->ip_blocks_names[i], + (uintmax_t)m->ip_block_last_active_time[i]); + } + + if (!any_blocking) + device_printf(dev, "no IP block info available\n"); +} + static int amdsmu_attach(device_t dev) { @@ -461,6 +506,8 @@ amdsmu_attach(device_t dev) amdsmu_suspend, dev, EVENTHANDLER_PRI_LAST); sc->eh_resume = EVENTHANDLER_REGISTER(acpi_pre_dev_resume, amdsmu_resume, dev, EVENTHANDLER_PRI_FIRST); + sc->eh_resume_check = EVENTHANDLER_REGISTER(power_resume_check, + amdsmu_resume_check, dev, EVENTHANDLER_PRI_ANY); #endif return (0); @@ -482,6 +529,7 @@ amdsmu_detach(device_t dev) #if defined(DEV_ACPI) EVENTHANDLER_DEREGISTER(acpi_post_dev_suspend, sc->eh_suspend); EVENTHANDLER_DEREGISTER(acpi_pre_dev_resume, sc->eh_resume); + EVENTHANDLER_DEREGISTER(power_resume_check, sc->eh_resume_check); #endif bus_space_unmap(sc->bus_tag, sc->smu_space, SMU_MEM_SIZE); diff --git a/sys/dev/amdsmu/amdsmu.h b/sys/dev/amdsmu/amdsmu.h index 0e7c4df37a43..3b600fab118d 100644 --- a/sys/dev/amdsmu/amdsmu.h +++ b/sys/dev/amdsmu/amdsmu.h @@ -123,6 +123,7 @@ struct amdsmu_softc { struct eventhandler_entry *eh_suspend; struct eventhandler_entry *eh_resume; + struct eventhandler_entry *eh_resume_check; struct resource *res; bus_space_tag_t bus_tag;