amdsmu: Use devclass name instead of module name

The diagnostics array contained expected modules to be loaded but the
checking logic checked for if a devclass of that name existed instead.

Have the diagnostics array contain the devclass instead as well as the
module to load for the hint string.

Furthermore, check tha the number of devices is greater than 0 so that
leftover devclasses from unloaded modules don't skip the hint.

Reported by:	emaste
Reviewed by:	emaste
Fixes:	758578370f ("amdsmu: Hints on what to do if IP block blocking S0i3")
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/70
This commit is contained in:
Aymeric Wibo committed 2026-10-26 16:35:18 +00:00
1 parent 509d65fae5
commit 9a4bb77040
2 files changed
+19 -14

No files matched your search

+8 -5
View File
@@ -320,6 +320,7 @@ amdsmu_resume_check(device_t dev, enum power_stype stype)
struct amdsmu_metrics *m = &sc->metrics;
bool any_blocking = false;
const struct amdsmu_diagnostics *d;
devclass_t dc;
if (stype != POWER_STYPE_SUSPEND_TO_IDLE)
return;
@@ -380,11 +381,13 @@ amdsmu_resume_check(device_t dev, enum power_stype stype)
if (d == NULL)
continue;
if (d->expected_module != NULL &&
devclass_find(d->expected_module) == NULL)
device_printf(dev,
" hint: load %s to allow this block to "
"suspend\n", d->expected_module);
if (d->expected_devclass != NULL) {
dc = devclass_find(d->expected_devclass);
if (dc == NULL || devclass_get_count(dc) == 0)
device_printf(dev,
" hint: load %s to allow this block to "
"suspend\n", d->mod_to_load);
}
if (d->extra != NULL)
device_printf(dev, " hint: %s\n", d->extra);
}
+11 -9
View File
@@ -123,26 +123,28 @@ static const struct amdsmu_product {
static const struct amdsmu_diagnostics {
const char *blocking_ip_block;
bool ignore;
const char *expected_module;
const char *expected_devclass;
/* mod_to_load must not be NULL if expected_devclass is not NULL. */
const char *mod_to_load;
const char *extra;
} amdsmu_diagnostics[] = {
{ "CPU", false, NULL, "this can happen due to other IP blocks or "
{ "CPU", false, NULL, NULL, "this can happen due to other IP blocks or "
"because the system was on AC power" },
{ "MPM", false, NULL, "this can happen due to other IP blocks or "
"because the system was on AC power" },
{ "GFX", false, "amdgpu", NULL },
{ "DISPLAY", false, "amdgpu", NULL },
{ "MPM", false, NULL, NULL, "this can happen due to other IP blocks or "
"because the CPU didn't properly idle" },
{ "GFX", false, "drmn", "amdgpu", NULL },
{ "DISPLAY", false, "drmn", "amdgpu", NULL },
/*
* On Phoenix and Krackan Point, these seem to report USB4, not USB3 as
* their names would suggest.
*/
{ "USB3_0", false, "tb", "see thunderbolt(4)" },
{ "USB3_1", false, "tb", "see thunderbolt(4)" },
{ "USB3_0", false, "nhi", "tb", "see thunderbolt(4)" },
{ "USB3_1", false, "nhi", "tb", "see thunderbolt(4)" },
/*
* On Phoenix and Krackan Point, the SMU seems to report garbage for
* this IP block.
*/
{ "USB4_0", true, NULL, NULL },
{ "USB4_0", true, NULL, NULL, NULL },
};
struct amdsmu_softc {