Skip to content

Commit aaee0ce

Browse files
Tim Huangalexdeucher
authored andcommitted
drm/amdgpu: reposition the gpu reset checking for reuse
Move the amdgpu_acpi_should_gpu_reset out of CONFIG_SUSPEND to share it with hibernate case. Signed-off-by: Tim Huang <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.1.x
1 parent e8d018d commit aaee0ce

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

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

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

13931393
void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1394+
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
13941395
void amdgpu_acpi_detect(void);
13951396
#else
13961397
static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
13971398
static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1399+
static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return false; }
13981400
static inline void amdgpu_acpi_detect(void) { }
13991401
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
14001402
static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
@@ -1405,11 +1407,9 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
14051407

14061408
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
14071409
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
1408-
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
14091410
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
14101411
#else
14111412
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1412-
static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return false; }
14131413
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
14141414
#endif
14151415

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

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,29 @@ static bool amdgpu_atcs_pci_probe_handle(struct pci_dev *pdev)
971971
return true;
972972
}
973973

974+
975+
/**
976+
* amdgpu_acpi_should_gpu_reset
977+
*
978+
* @adev: amdgpu_device_pointer
979+
*
980+
* returns true if should reset GPU, false if not
981+
*/
982+
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
983+
{
984+
if (adev->flags & AMD_IS_APU)
985+
return false;
986+
987+
if (amdgpu_sriov_vf(adev))
988+
return false;
989+
990+
#if IS_ENABLED(CONFIG_SUSPEND)
991+
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
992+
#else
993+
return true;
994+
#endif
995+
}
996+
974997
/*
975998
* amdgpu_acpi_detect - detect ACPI ATIF/ATCS methods
976999
*
@@ -1042,24 +1065,6 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
10421065
(pm_suspend_target_state == PM_SUSPEND_MEM);
10431066
}
10441067

1045-
/**
1046-
* amdgpu_acpi_should_gpu_reset
1047-
*
1048-
* @adev: amdgpu_device_pointer
1049-
*
1050-
* returns true if should reset GPU, false if not
1051-
*/
1052-
bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
1053-
{
1054-
if (adev->flags & AMD_IS_APU)
1055-
return false;
1056-
1057-
if (amdgpu_sriov_vf(adev))
1058-
return false;
1059-
1060-
return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
1061-
}
1062-
10631068
/**
10641069
* amdgpu_acpi_is_s0ix_active
10651070
*

0 commit comments

Comments
 (0)