drm/amdgpu: pin the csb buffer on hw init for gfx v8
Subsystems (2)
PATCH 1/1 drm/amdgpu: pin the csb buffer on hw init for gfx v8
From: Likun Gao <[email protected]>
Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +40 -0
@@ -1317,6 +1317,39 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)return 0 ; } +static int gfx_v8_0_csb_vram_pin (struct amdgpu_device *adev) +{ +int r; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, false); +if (unlikely (r !=0 )) +return r; + + r =amdgpu_bo_pin (adev->gfx.rlc.clear_state_obj, +AMDGPU_GEM_DOMAIN_VRAM ); +if (!r) + adev->gfx.rlc.clear_state_gpu_addr = +amdgpu_bo_gpu_offset (adev->gfx.rlc.clear_state_obj); + +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + +return r; +} + +static void gfx_v8_0_csb_vram_unpin (struct amdgpu_device *adev) +{ +int r; + +if (!adev->gfx.rlc.clear_state_obj) +return ; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, true); +if (likely (r ==0 )) { +amdgpu_bo_unpin (adev->gfx.rlc.clear_state_obj); +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + } +} +static void gfx_v8_0_mec_fini (struct amdgpu_device *adev) {amdgpu_bo_free_kernel (&adev->gfx.mec.hpd_eop_obj,NULL ,NULL );
@@ -4791,6 +4824,10 @@ static int gfx_v8_0_hw_init(void *handle)gfx_v8_0_init_golden_registers (adev);gfx_v8_0_constants_init (adev); + r =gfx_v8_0_csb_vram_pin (adev); +if (r) +return r; + r = adev->gfx.rlc.funcs->resume (adev);if (r)return r;
@@ -4907,6 +4944,9 @@ static int gfx_v8_0_hw_fini(void *handle)else pr_err ("rlc is busy, skip halt rlc\n" );amdgpu_gfx_rlc_exit_safe_mode (adev); + +gfx_v8_0_csb_vram_unpin (adev); +return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1564970809-31487-1-git-send-email-likun.gao-5C7GfCeVMHo@public.gmane.org
Xu, Feifei
Reviewed-by Feifei Xu-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gao Likun
Sent: Monday, August 5, 2019 10:07 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Gao, Likun <[email protected]>; Paul Gover <[email protected]>; Yuan, Xiaojie <[email protected]>
Subject: [PATCH] drm/amdgpu: pin the csb buffer on hw init for gfx v8
From: Likun Gao <[email protected]>
Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +31 -0
@@ -1317,6 +1317,39 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)return 0 ; } +static int gfx_v8_0_csb_vram_pin (struct amdgpu_device *adev) { +int r; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, false); +if (unlikely (r !=0 )) +return r; + + r =amdgpu_bo_pin (adev->gfx.rlc.clear_state_obj, +AMDGPU_GEM_DOMAIN_VRAM ); +if (!r) + adev->gfx.rlc.clear_state_gpu_addr = +amdgpu_bo_gpu_offset (adev->gfx.rlc.clear_state_obj); + +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + +return r; +} + +static void gfx_v8_0_csb_vram_unpin (struct amdgpu_device *adev) { +int r; + +if (!adev->gfx.rlc.clear_state_obj) +return ; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, true); +if (likely (r ==0 )) { +amdgpu_bo_unpin (adev->gfx.rlc.clear_state_obj); +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + } +} +static void gfx_v8_0_mec_fini (struct amdgpu_device *adev) { amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ -4791,6 +4824,10 @@ static int gfx_v8_0_hw_init(void *handle) gfx_v8_0_init_golden_registers(adev);
gfx_v8_0_constants_init(adev);
+ r = gfx_v8_0_csb_vram_pin(adev);
+ if (r)
+ return r;
+
r = adev->gfx.rlc.funcs->resume(adev);
if (r)
return r;
@@ -4907,6 +4944,9 @@ static int gfx_v8_0_hw_fini(void *handle)
else
pr_err("rlc is busy, skip halt rlc\n");
amdgpu_gfx_rlc_exit_safe_mode(adev);
+
+ gfx_v8_0_csb_vram_unpin(adev);
+
return 0;
}
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CH2PR12MB3767F6605AC1A097D9D5586DFEDA0-rV3HgkLYx2Vb0rI3ZRjBIAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Yuan, Xiaojie
Reviewed-by Xiaojie YuanBR,
Xiaojie
Quoted 84 lines · Feifei
Reviewed-by Feifei Xu <[email protected]>-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gao Likun
Sent: Monday, August 5, 2019 10:07 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Gao, Likun <[email protected]>; Paul Gover <[email protected]>; Yuan, Xiaojie <[email protected]>
Subject: [PATCH] drm/amdgpu: pin the csb buffer on hw init for gfx v8From: Likun Gao <[email protected]>
Without this pin, the csb buffer will be filled with inconsistent data after S3 resume. And that will causes gfx hang on gfxoff exit since this csb will be executed then.
Signed-off-by Likun Gao <[email protected]>---
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c| 40 +++++++++++++++++++++++++++++++++++1 file changed, 40 insertions(+)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +38
-1@@ -1317,6 +1317,39 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev)return 0 ; } +static int gfx_v8_0_csb_vram_pin (struct amdgpu_device *adev) { +int r; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, false); +if (unlikely (r !=0 )) +return r; + + r =amdgpu_bo_pin (adev->gfx.rlc.clear_state_obj, +AMDGPU_GEM_DOMAIN_VRAM ); +if (!r) + adev->gfx.rlc.clear_state_gpu_addr = +amdgpu_bo_gpu_offset (adev->gfx.rlc.clear_state_obj); + +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + +return r; +} + +static void gfx_v8_0_csb_vram_unpin (struct amdgpu_device *adev) { +int r; + +if (!adev->gfx.rlc.clear_state_obj) +return ; + + r =amdgpu_bo_reserve (adev->gfx.rlc.clear_state_obj, true); +if (likely (r ==0 )) { +amdgpu_bo_unpin (adev->gfx.rlc.clear_state_obj); +amdgpu_bo_unreserve (adev->gfx.rlc.clear_state_obj); + } +} +static void gfx_v8_0_mec_fini (struct amdgpu_device *adev) { amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ -4791,6 +4824,10 @@ static int gfx_v8_0_hw_init(void *handle) gfx_v8_0_init_golden_registers(adev);gfx_v8_0_constants_init (adev); + r =gfx_v8_0_csb_vram_pin (adev); +if (r) +return r; + r = adev->gfx.rlc.funcs->resume (adev);if (r)return r;@@ -4907,6 +4944,9 @@ static int gfx_v8_0_hw_fini(void *handle)else pr_err ("rlc is busy, skip halt rlc\n" );amdgpu_gfx_rlc_exit_safe_mode (adev); + +gfx_v8_0_csb_vram_unpin (adev); +return 0 ; } --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx