Commit 44779b43 authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amdgpu: Move gfx flag in_suspend to adev

Move in_suspend flag to adev from gfx, so
can be used in other ip blocks, also keep
consistent with gpu_in_reset flag.
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3023015f
...@@ -1015,6 +1015,9 @@ struct amdgpu_device { ...@@ -1015,6 +1015,9 @@ struct amdgpu_device {
bool has_hw_reset; bool has_hw_reset;
u8 reset_magic[AMDGPU_RESET_MAGIC_NUM]; u8 reset_magic[AMDGPU_RESET_MAGIC_NUM];
/* s3/s4 mask */
bool in_suspend;
/* record last mm index being written through WREG32*/ /* record last mm index being written through WREG32*/
unsigned long last_mm_index; unsigned long last_mm_index;
bool in_gpu_reset; bool in_gpu_reset;
......
...@@ -2649,6 +2649,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -2649,6 +2649,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
return 0; return 0;
adev->in_suspend = true;
drm_kms_helper_poll_disable(dev); drm_kms_helper_poll_disable(dev);
if (fbcon) if (fbcon)
...@@ -2834,6 +2835,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) ...@@ -2834,6 +2835,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
#ifdef CONFIG_PM #ifdef CONFIG_PM
dev->dev->power.disable_depth--; dev->dev->power.disable_depth--;
#endif #endif
adev->in_suspend = false;
return 0; return 0;
} }
......
...@@ -297,8 +297,7 @@ struct amdgpu_gfx { ...@@ -297,8 +297,7 @@ struct amdgpu_gfx {
/* reset mask */ /* reset mask */
uint32_t grbm_soft_reset; uint32_t grbm_soft_reset;
uint32_t srbm_soft_reset; uint32_t srbm_soft_reset;
/* s3/s4 mask */
bool in_suspend;
/* NGG */ /* NGG */
struct amdgpu_ngg ngg; struct amdgpu_ngg ngg;
......
...@@ -4872,7 +4872,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) ...@@ -4872,7 +4872,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
struct vi_mqd *mqd = ring->mqd_ptr; struct vi_mqd *mqd = ring->mqd_ptr;
int mqd_idx = ring - &adev->gfx.compute_ring[0]; int mqd_idx = ring - &adev->gfx.compute_ring[0];
if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { if (!adev->in_gpu_reset && !adev->in_suspend) {
memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation));
((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
...@@ -5142,19 +5142,12 @@ static int gfx_v8_0_hw_fini(void *handle) ...@@ -5142,19 +5142,12 @@ static int gfx_v8_0_hw_fini(void *handle)
static int gfx_v8_0_suspend(void *handle) static int gfx_v8_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; return gfx_v8_0_hw_fini(handle);
adev->gfx.in_suspend = true;
return gfx_v8_0_hw_fini(adev);
} }
static int gfx_v8_0_resume(void *handle) static int gfx_v8_0_resume(void *handle)
{ {
int r; return gfx_v8_0_hw_init(handle);
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
r = gfx_v8_0_hw_init(adev);
adev->gfx.in_suspend = false;
return r;
} }
static bool gfx_v8_0_check_soft_reset(void *handle) static bool gfx_v8_0_check_soft_reset(void *handle)
......
...@@ -3198,7 +3198,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) ...@@ -3198,7 +3198,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)
struct v9_mqd *mqd = ring->mqd_ptr; struct v9_mqd *mqd = ring->mqd_ptr;
int mqd_idx = ring - &adev->gfx.compute_ring[0]; int mqd_idx = ring - &adev->gfx.compute_ring[0];
if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { if (!adev->in_gpu_reset && !adev->in_suspend) {
memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation));
((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
...@@ -3417,7 +3417,7 @@ static int gfx_v9_0_hw_fini(void *handle) ...@@ -3417,7 +3417,7 @@ static int gfx_v9_0_hw_fini(void *handle)
/* Use deinitialize sequence from CAIL when unbinding device from driver, /* Use deinitialize sequence from CAIL when unbinding device from driver,
* otherwise KIQ is hanging when binding back * otherwise KIQ is hanging when binding back
*/ */
if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { if (!adev->in_gpu_reset && !adev->in_suspend) {
mutex_lock(&adev->srbm_mutex); mutex_lock(&adev->srbm_mutex);
soc15_grbm_select(adev, adev->gfx.kiq.ring.me, soc15_grbm_select(adev, adev->gfx.kiq.ring.me,
adev->gfx.kiq.ring.pipe, adev->gfx.kiq.ring.pipe,
...@@ -3437,20 +3437,12 @@ static int gfx_v9_0_hw_fini(void *handle) ...@@ -3437,20 +3437,12 @@ static int gfx_v9_0_hw_fini(void *handle)
static int gfx_v9_0_suspend(void *handle) static int gfx_v9_0_suspend(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; return gfx_v9_0_hw_fini(handle);
adev->gfx.in_suspend = true;
return gfx_v9_0_hw_fini(adev);
} }
static int gfx_v9_0_resume(void *handle) static int gfx_v9_0_resume(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; return gfx_v9_0_hw_init(handle);
int r;
r = gfx_v9_0_hw_init(adev);
adev->gfx.in_suspend = false;
return r;
} }
static bool gfx_v9_0_is_idle(void *handle) static bool gfx_v9_0_is_idle(void *handle)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment