diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-09-29 03:27:02 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-10-09 18:05:33 -0400 |
commit | 44779b43f15977885a0e3b45bf6deb6be18725e5 (patch) | |
tree | 2319438d337d6a81714532471b843f23f849b1ba /drivers/gpu | |
parent | 3023015f791639838ec5d80e5c14851238a1a7d9 (diff) |
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: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 16 |
5 files changed, 14 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 44140cce067c..d0102cfc8efb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1015,6 +1015,9 @@ struct amdgpu_device { | |||
1015 | bool has_hw_reset; | 1015 | bool has_hw_reset; |
1016 | u8 reset_magic[AMDGPU_RESET_MAGIC_NUM]; | 1016 | u8 reset_magic[AMDGPU_RESET_MAGIC_NUM]; |
1017 | 1017 | ||
1018 | /* s3/s4 mask */ | ||
1019 | bool in_suspend; | ||
1020 | |||
1018 | /* record last mm index being written through WREG32*/ | 1021 | /* record last mm index being written through WREG32*/ |
1019 | unsigned long last_mm_index; | 1022 | unsigned long last_mm_index; |
1020 | bool in_gpu_reset; | 1023 | bool in_gpu_reset; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a1d8d97252e0..95095a8d2125 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -2649,6 +2649,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) | |||
2649 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 2649 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
2650 | return 0; | 2650 | return 0; |
2651 | 2651 | ||
2652 | adev->in_suspend = true; | ||
2652 | drm_kms_helper_poll_disable(dev); | 2653 | drm_kms_helper_poll_disable(dev); |
2653 | 2654 | ||
2654 | if (fbcon) | 2655 | if (fbcon) |
@@ -2834,6 +2835,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) | |||
2834 | #ifdef CONFIG_PM | 2835 | #ifdef CONFIG_PM |
2835 | dev->dev->power.disable_depth--; | 2836 | dev->dev->power.disable_depth--; |
2836 | #endif | 2837 | #endif |
2838 | adev->in_suspend = false; | ||
2839 | |||
2837 | return 0; | 2840 | return 0; |
2838 | } | 2841 | } |
2839 | 2842 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h index f172e92c463c..b61b5c11aead 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | |||
@@ -297,8 +297,7 @@ struct amdgpu_gfx { | |||
297 | /* reset mask */ | 297 | /* reset mask */ |
298 | uint32_t grbm_soft_reset; | 298 | uint32_t grbm_soft_reset; |
299 | uint32_t srbm_soft_reset; | 299 | uint32_t srbm_soft_reset; |
300 | /* s3/s4 mask */ | 300 | |
301 | bool in_suspend; | ||
302 | /* NGG */ | 301 | /* NGG */ |
303 | struct amdgpu_ngg ngg; | 302 | struct amdgpu_ngg ngg; |
304 | 303 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 2aeef2bb93a4..f9e0a21435f8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -4872,7 +4872,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
4872 | struct vi_mqd *mqd = ring->mqd_ptr; | 4872 | struct vi_mqd *mqd = ring->mqd_ptr; |
4873 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; | 4873 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
4874 | 4874 | ||
4875 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { | 4875 | if (!adev->in_gpu_reset && !adev->in_suspend) { |
4876 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); | 4876 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); |
4877 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; | 4877 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
4878 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; | 4878 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
@@ -5142,19 +5142,12 @@ static int gfx_v8_0_hw_fini(void *handle) | |||
5142 | 5142 | ||
5143 | static int gfx_v8_0_suspend(void *handle) | 5143 | static int gfx_v8_0_suspend(void *handle) |
5144 | { | 5144 | { |
5145 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 5145 | return gfx_v8_0_hw_fini(handle); |
5146 | adev->gfx.in_suspend = true; | ||
5147 | return gfx_v8_0_hw_fini(adev); | ||
5148 | } | 5146 | } |
5149 | 5147 | ||
5150 | static int gfx_v8_0_resume(void *handle) | 5148 | static int gfx_v8_0_resume(void *handle) |
5151 | { | 5149 | { |
5152 | int r; | 5150 | return gfx_v8_0_hw_init(handle); |
5153 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
5154 | |||
5155 | r = gfx_v8_0_hw_init(adev); | ||
5156 | adev->gfx.in_suspend = false; | ||
5157 | return r; | ||
5158 | } | 5151 | } |
5159 | 5152 | ||
5160 | static bool gfx_v8_0_check_soft_reset(void *handle) | 5153 | static bool gfx_v8_0_check_soft_reset(void *handle) |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 7a6a814ba9b8..4b020cc4bea9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
@@ -3198,7 +3198,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
3198 | struct v9_mqd *mqd = ring->mqd_ptr; | 3198 | struct v9_mqd *mqd = ring->mqd_ptr; |
3199 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; | 3199 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
3200 | 3200 | ||
3201 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { | 3201 | if (!adev->in_gpu_reset && !adev->in_suspend) { |
3202 | memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); | 3202 | memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); |
3203 | ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; | 3203 | ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
3204 | ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; | 3204 | ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
@@ -3417,7 +3417,7 @@ static int gfx_v9_0_hw_fini(void *handle) | |||
3417 | /* Use deinitialize sequence from CAIL when unbinding device from driver, | 3417 | /* Use deinitialize sequence from CAIL when unbinding device from driver, |
3418 | * otherwise KIQ is hanging when binding back | 3418 | * otherwise KIQ is hanging when binding back |
3419 | */ | 3419 | */ |
3420 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { | 3420 | if (!adev->in_gpu_reset && !adev->in_suspend) { |
3421 | mutex_lock(&adev->srbm_mutex); | 3421 | mutex_lock(&adev->srbm_mutex); |
3422 | soc15_grbm_select(adev, adev->gfx.kiq.ring.me, | 3422 | soc15_grbm_select(adev, adev->gfx.kiq.ring.me, |
3423 | adev->gfx.kiq.ring.pipe, | 3423 | adev->gfx.kiq.ring.pipe, |
@@ -3437,20 +3437,12 @@ static int gfx_v9_0_hw_fini(void *handle) | |||
3437 | 3437 | ||
3438 | static int gfx_v9_0_suspend(void *handle) | 3438 | static int gfx_v9_0_suspend(void *handle) |
3439 | { | 3439 | { |
3440 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 3440 | return gfx_v9_0_hw_fini(handle); |
3441 | |||
3442 | adev->gfx.in_suspend = true; | ||
3443 | return gfx_v9_0_hw_fini(adev); | ||
3444 | } | 3441 | } |
3445 | 3442 | ||
3446 | static int gfx_v9_0_resume(void *handle) | 3443 | static int gfx_v9_0_resume(void *handle) |
3447 | { | 3444 | { |
3448 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 3445 | return gfx_v9_0_hw_init(handle); |
3449 | int r; | ||
3450 | |||
3451 | r = gfx_v9_0_hw_init(adev); | ||
3452 | adev->gfx.in_suspend = false; | ||
3453 | return r; | ||
3454 | } | 3446 | } |
3455 | 3447 | ||
3456 | static bool gfx_v9_0_is_idle(void *handle) | 3448 | static bool gfx_v9_0_is_idle(void *handle) |