Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173732769
D59673.id186909.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D59673.id186909.diff
View Options
diff --git a/sys/dev/amdsmu/amdsmu.h b/sys/dev/amdsmu/amdsmu.h
--- a/sys/dev/amdsmu/amdsmu.h
+++ b/sys/dev/amdsmu/amdsmu.h
@@ -123,6 +123,7 @@
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;
diff --git a/sys/dev/amdsmu/amdsmu.c b/sys/dev/amdsmu/amdsmu.c
--- a/sys/dev/amdsmu/amdsmu.c
+++ b/sys/dev/amdsmu/amdsmu.c
@@ -317,6 +317,51 @@
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_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 @@
#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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 29, 12:37 AM (1 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39099752
Default Alt Text
D59673.id186909.diff (2 KB)
Attached To
Mode
D59673: amdsmu: Diagnose S0i3 entry after resume
Attached
Detach File
Event Timeline
Log In to Comment