Skip to content

Commit a6ed203

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Warn users about potential s0ix problems
On some OEM setups users can configure the BIOS for S3 or S2idle. When configured to S3 users can still choose 's2idle' in the kernel by using `/sys/power/mem_sleep`. Before commit 6dc8265 ("drm/amdgpu: always reset the asic in suspend (v2)"), the GPU would crash. Now when configured this way, the system should resume but will use more power. As such, adjust the `amdpu_acpi_is_s0ix function` to warn users about potential power consumption issues during their first attempt at suspending. Reported-by: Bjoren Dasse <[email protected]> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1824 Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3ec5586 commit a6ed203

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,12 +1408,10 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta
14081408
int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
14091409

14101410
void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1411-
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
14121411
void amdgpu_acpi_detect(void);
14131412
#else
14141413
static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
14151414
static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1416-
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
14171415
static inline void amdgpu_acpi_detect(void) { }
14181416
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
14191417
static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
@@ -1422,6 +1420,12 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
14221420
enum amdgpu_ss ss_state) { return 0; }
14231421
#endif
14241422

1423+
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
1424+
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
1425+
#else
1426+
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1427+
#endif
1428+
14251429
int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
14261430
uint64_t addr, struct amdgpu_bo **bo,
14271431
struct amdgpu_bo_va_mapping **mapping);

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ void amdgpu_acpi_detect(void)
10311031
}
10321032
}
10331033

1034+
#if IS_ENABLED(CONFIG_SUSPEND)
10341035
/**
10351036
* amdgpu_acpi_is_s0ix_active
10361037
*
@@ -1040,11 +1041,24 @@ void amdgpu_acpi_detect(void)
10401041
*/
10411042
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10421043
{
1043-
#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
1044-
if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
1045-
if (adev->flags & AMD_IS_APU)
1046-
return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;
1044+
if (!(adev->flags & AMD_IS_APU) ||
1045+
(pm_suspend_target_state != PM_SUSPEND_TO_IDLE))
1046+
return false;
1047+
1048+
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1049+
dev_warn_once(adev->dev,
1050+
"Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
1051+
"To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1052+
return false;
10471053
}
1048-
#endif
1054+
1055+
#if !IS_ENABLED(CONFIG_AMD_PMC)
1056+
dev_warn_once(adev->dev,
1057+
"Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
10491058
return false;
1059+
#else
1060+
return true;
1061+
#endif /* CONFIG_AMD_PMC */
10501062
}
1063+
1064+
#endif /* CONFIG_SUSPEND */

0 commit comments

Comments
 (0)