drm/amdgpu: fix gfx hang during suspend with video playback
Subsystems (3)
PATCH 1/1 drm/amdgpu: fix gfx hang during suspend with video playback
The system will be hang up during S3 as SMU is pending at GC not respose the register CP_HQD_ACTIVE access request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +6 -0
@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);acquire_queue (kgd, pipe_id, queue_id);
@@ -299,6 +300,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {
@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }
@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;
@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -0
@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );
@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell)WREG32_FIELD15 (GC ,0 ,CP_PQ_STATUS ,DOORBELL_ENABLE ,1 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {
@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
(+ Felix)
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.
We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with MMIO or both?
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
Thanks,
Ray
Quoted 99 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +6
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);acquire_queue (kgd, pipe_id, queue_id);@@ -299,6 +300,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell)WREG32_FIELD15 (GC ,0 ,CP_PQ_STATUS ,DOORBELL_ENABLE ,1 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }Signature · 1 line
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 13 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, Evan <[email protected]>; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 9 lines
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with MMIO or both?
[Prike] The issue hang up at MP1 was trying to read register RSMU_RESIDENCY_COUNTER_GC but did not get response from GFX, since GFX was busy at reading register CP_HQD_ACTIVE. Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG enter stage. As for only this issue, that seems just MMIO access failed case which occurred under QUEUE map/unmap status check.
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the CP_HQD_ACTIVE status by MMIO accessing,
therefore just guard the KIQ and some type user queue now. Regarding HIQ map and ummap which used the method of submitting configuration packet.
Quoted 107 lines
Thanks,
Raydrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void
Quoted 14 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct · line 3631
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 );
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; } --2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 19 lines · Prike
Quoted 19 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, Evan <[email protected]>; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.
Quoted 9 lines
Quoted 3 lines
We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with MMIO or both?
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX, since GFX was busy at reading registerCP_HQD_ACTIVE. Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG enter stage. As for only this issue, that seems just MMIO access failed case which occurred under QUEUE map/unmap status check.
While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 6 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing,
therefore just guard the KIQ and some type user queue now. Regarding HIQ map and ummap which used the method of submitting configuration packet.
KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
Ray
Quoted 107 lines
Quoted 107 lines
Thanks,
Raydrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void
Quoted 14 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct · line 3631
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 );
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; } --2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 36 lines · Huang Rui
Quoted 19 lines · Prike
Quoted 19 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, Evan <[email protected]>; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.Quoted 9 lines
Quoted 3 lines
We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with MMIO or both?
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX, since GFX was busy at reading registerCP_HQD_ACTIVE. Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG enter stage. As for only this issue, that seems just MMIO access failed case which occurred under QUEUE map/unmap status check.While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 3 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
Quoted 6 lines
Quoted 3 lines
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing,
therefore just guard the KIQ and some type user queue now. Regarding HIQ map and ummap which used the method of submitting configuration packet.KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Wait... In your case, the system didn't load any user queues because no ROCm based application is running. So the issue is probably caused by KIQ itself init/unit, can you confirm?
Thanks,
Ray
Quoted 117 lines
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
RayQuoted 111 lines
Quoted 111 lines
Thanks,
Raydrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void
Quoted 14 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct · line 3631
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
2.7.4_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C040563ff26374383ec6108d7d7b6a2bb%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637215053543776633&sdata=COMvG7W4%2Fl7aKDAV8Qgbl%2F3myW0HCSz7qk014OLUzrY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 58 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 6:29 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 7 lines · Huang Rui
Quoted 6 lines · Prike
Quoted 6 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, EvanQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Prike
Quoted 4 lines
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with
MMIO or both?
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX,since GFX was busy at reading register
CP_HQD_ACTIVE.Quoted 3 lines
Quoted 3 lines
Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG enter stage. As for only this issue, that seems just MMIO access failed case which
occurred under QUEUE map/unmap status check.
Quoted 10 lines
Quoted 1 line
While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 5 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing, therefore just guard the KIQand some type user queue now. Regarding HIQ map and ummap which used the method of submitting configuration packet.
Quoted 2 lines
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Wait... In your case, the system didn't load any user queues because no ROCm based application is running. So the issue is probably caused by KIQ itself init/unit, can you confirm?
[Prike] This improper register access is under performing MQD destroy during amdkfd suspend period. For the KIQ UNI process may not need the RLC guard as GFX CGPG has been disabled at the early suspend period.
If have concern the other case over guard will send a patch for simplify it.
Quoted 140 lines
Thanks,
RayQuoted 14 lines
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
RayQuoted 8 lines
Quoted 8 lines
Thanks,
RayQuoted 5 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6++++++
Quoted 113 lines
Quoted 113 lines
Quoted 113 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd,void
*mqd,
uint32_tpipe_id,Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(structQuoted 1 line
kgd_dev*kgd,
uint64_tqueue_address,Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev · line 545
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev · line 582
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static intQuoted 1 line
gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static intgfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
2.7.4_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-
Quoted 8 lines
gfx&data=02%7C01%7Cra
Quoted 1 line
y.huang%40amd.com%7C040563ff26374383ec6108d7d7b6a2bb%7C3dd8961
fe4884e6Quoted 1 line
08e11a82d994e183d%7C0%7C0%7C637215053543776633&sdata=COMv G7W4%2Fl7
Quoted 1 line
aKDAV8Qgbl%2F3myW0HCSz7qk014OLUzrY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 61 lines · Prike
Quoted 61 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 6:29 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 7 lines · Huang Rui
Quoted 6 lines · Prike
Quoted 6 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, EvanQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Prike
Quoted 4 lines
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with
MMIO or both?
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX,since GFX was busy at reading register
CP_HQD_ACTIVE.Quoted 3 lines
Quoted 3 lines
Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG enter stage. As for only this issue, that seems just MMIO access failed case which
occurred under QUEUE map/unmap status check.
Quoted 10 lines
Quoted 1 line
While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 5 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing, therefore just guard the KIQand some type user queue now. Regarding HIQ map and ummap which used the method of submitting configuration packet.
Quoted 4 lines
Quoted 1 line
KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Quoted 6 lines
Quoted 3 lines
Wait... In your case, the system didn't load any user queues because no ROCm based application is running. So the issue is probably caused by KIQ itself init/unit, can you confirm?
[Prike] This improper register access is under performing MQD destroy during amdkfd suspend period. For the KIQ UNI process may not need the RLC guard as GFX CGPG has been disabled at the early suspend period.
How about move below gfxoff/cgpg disabling ahead of amdgpu_amdkfd_suspend?
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
amdgpu_amdkfd_suspend(adev, !fbcon);We should disable the gfxoff/cgpg at first to avoid mmio access.
Thanks,
Ray
Quoted 150 lines
If have concern the other case over guard will send a patch for simplify it.
Quoted 148 lines
Thanks,
RayQuoted 14 lines
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
RayQuoted 8 lines
Quoted 8 lines
Thanks,
RayQuoted 5 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6++++++
Quoted 113 lines
Quoted 113 lines
Quoted 113 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd,void
*mqd,
uint32_tpipe_id,Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(structQuoted 1 line
kgd_dev*kgd,
uint64_tqueue_address,Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev · line 545
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev · line 582
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static intQuoted 1 line
gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static intgfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
2.7.4_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cra
Quoted 1 line
y.huang%40amd.com%7C040563ff26374383ec6108d7d7b6a2bb%7C3dd8961
fe4884e6Quoted 1 line
08e11a82d994e183d%7C0%7C0%7C637215053543776633&sdata=COMv G7W4%2Fl7
Quoted 1 line
aKDAV8Qgbl%2F3myW0HCSz7qk014OLUzrY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 89 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Tuesday, April 7, 2020 4:03 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 35 lines · Prike
Quoted 35 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 6:29 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 7 lines · Huang Rui
Quoted 6 lines · Prike
Quoted 6 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, EvanQuoted 15 lines
Quoted 15 lines
Quoted 15 lines
Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with
Quoted 7 lines
Quoted 7 lines
MMIO or both?
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX,since GFX was busy at reading register
CP_HQD_ACTIVE.Quoted 2 lines
Quoted 2 lines
Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG
enter stage.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
As for only this issue, that seems just MMIO access failed case which
occurred under QUEUE map/unmap status check.
Quoted 5 lines
Quoted 1 line
While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing, therefore just guard the KIQand some type user queue now. Regarding HIQ map and ummap which
used
Quoted 6 lines
Quoted 6 lines
the method of submitting configuration packet.
Quoted 4 lines
Quoted 1 line
KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Quoted 6 lines
Quoted 3 lines
Wait... In your case, the system didn't load any user queues because no ROCm based application is running. So the issue is probably caused by KIQ itself init/unit, can you confirm?
[Prike] This improper register access is under performing MQD destroy during amdkfd suspend period. For the KIQ UNI process may not need the RLC guard as GFX CGPG has been disabled at the early suspend
period.
How about move below gfxoff/cgpg disabling ahead of
amdgpu_amdkfd_suspend?
Quoted 7 lines
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); amdgpu_amdkfd_suspend(adev, !fbcon);We should disable the gfxoff/cgpg at first to avoid mmio access.
[Prike] Generally speaking that's fine to un-gate the CGPG before each GFX MMIO access.
That's should be no different to enter RLC safe mode.
So do you prefer the solution to move the CGPG ungated at suspend early time right ?
Quoted 150 lines
Thanks,
RayQuoted 33 lines
If have concern the other case over guard will send a patch for simplify it.
Quoted 31 lines
Thanks,
RayQuoted 14 lines
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
RayQuoted 8 lines
Quoted 8 lines
Thanks,
RayQuoted 5 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6++++++
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev · line 232
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.cindex df841c2..e265063 100644drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);
acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7@@
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
int kgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act = RREG32(SOC15_REG_OFFSET(GC, 0,
mmCP_HQD_ACTIVE));Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct · line 545
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct · line 582
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static intQuoted 1 line
gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3629,6 +3630,7 @@ static intgfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS,
DOORBELL_ENABLE,Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 22 lines
Quoted 22 lines
1);
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 );Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; } --2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
list
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines
gfx&data=02%7C01%7Cra
Quoted 1 line
y.huang%40amd.com%7C040563ff26374383ec6108d7d7b6a2bb%7C3dd8961
Quoted 3 lines
Quoted 3 lines
fe4884e6Quoted 1 line
08e11a82d994e183d%7C0%7C0%7C637215053543776633&sdata=COMv
Quoted 2 lines
Quoted 2 lines
G7W4%2Fl7
Quoted 1 line
aKDAV8Qgbl%2F3myW0HCSz7qk014OLUzrY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 92 lines · Prike
Quoted 92 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Tuesday, April 7, 2020 4:03 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 35 lines · Prike
Quoted 35 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 6:29 PM
To: Liang, Prike <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Quan, Evan <[email protected]>; amd- [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackQuoted 7 lines · Huang Rui
Quoted 6 lines · Prike
Quoted 6 lines
-----Original Message-----
From: Huang, Ray <[email protected]>
Sent: Friday, April 3, 2020 2:27 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Quan, EvanQuoted 15 lines
Quoted 15 lines
Quoted 15 lines
Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playback(+ Felix)
Quoted 4 lines · Prike
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.We need more information for the issue, does the map/unmap is required for MAP_QUEUES/UNMAP_QUEUES packets or writing with
Quoted 7 lines
Quoted 7 lines
MMIO or both?
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
[Prike] The issue hang up at MP1 was trying to read register
RSMU_RESIDENCY_COUNTER_GCbut did not get response from GFX,since GFX was busy at reading register
CP_HQD_ACTIVE.Quoted 2 lines
Quoted 2 lines
Moreover, when disabled GFXOFF this issue also can't see so there is likely to perform register accessed at GFXOFF CGPG/CGCG
enter stage.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
As for only this issue, that seems just MMIO access failed case which
occurred under QUEUE map/unmap status check.
Quoted 5 lines
Quoted 1 line
While we start to do S3, we will disable gfxoff at start of suspend. Then in this point, the gfx should be always in "on" state.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
From your patch, you just protect the kernel kiq and user queue. What about other kernel compute queues? HIQ?
[Prike] So far just find the KIQ/CPQ/DIQ map/unmap will inquire the
CP_HQD_ACTIVEstatus by MMIO accessing, therefore just guard the KIQand some type user queue now. Regarding HIQ map and ummap which
used
Quoted 6 lines
Quoted 6 lines
the method of submitting configuration packet.
Quoted 4 lines
Quoted 1 line
KIQ itself init/unit should be always under gfx on state. Can you give a check the result if not add enter/exit rlc safe mode around it?
Quoted 6 lines
Quoted 3 lines
Wait... In your case, the system didn't load any user queues because no ROCm based application is running. So the issue is probably caused by KIQ itself init/unit, can you confirm?
[Prike] This improper register access is under performing MQD destroy during amdkfd suspend period. For the KIQ UNI process may not need the RLC guard as GFX CGPG has been disabled at the early suspend
period.
How about move below gfxoff/cgpg disabling ahead of
amdgpu_amdkfd_suspend?amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
Quoted 8 lines
Quoted 4 lines
amdgpu_amdkfd_suspend(adev, !fbcon);We should disable the gfxoff/cgpg at first to avoid mmio access.
[Prike] Generally speaking that's fine to un-gate the CGPG before each GFX MMIO access.
That's should be no different to enter RLC safe mode.
So do you prefer the solution to move the CGPG ungated at suspend early time right ?
Yes, that is able to avoid all impact from the following GC access behavoir.
Thanks,
Ray
Quoted 153 lines
Quoted 153 lines
Thanks,
RayQuoted 33 lines
If have concern the other case over guard will send a patch for simplify it.
Quoted 31 lines
Thanks,
RayQuoted 14 lines
Hi Felix, maybe we need to use packets with kiq to map all user queues.
Thanks,
RayQuoted 8 lines
Quoted 8 lines
Thanks,
RayQuoted 5 lines
Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6++++++
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev · line 232
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.cindex df841c2..e265063 100644drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);
acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7@@
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
int kgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act = RREG32(SOC15_REG_OFFSET(GC, 0,
mmCP_HQD_ACTIVE));Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct
kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct · line 545
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct · line 582
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static intQuoted 1 line
gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3629,6 +3630,7 @@ static intgfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS,
DOORBELL_ENABLE,Quoted 38 lines
Quoted 38 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
1);
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static intgfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
2.7.4_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F
list
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cra
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
y.huang%40amd.com%7C040563ff26374383ec6108d7d7b6a2bb%7C3dd8961
Quoted 3 lines
Quoted 3 lines
fe4884e6Quoted 1 line
08e11a82d994e183d%7C0%7C0%7C637215053543776633&sdata=COMv
Quoted 2 lines
Quoted 2 lines
G7W4%2Fl7
Quoted 1 line
aKDAV8Qgbl%2F3myW0HCSz7qk014OLUzrY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Felix Kuehling
maintainerSorry, I missed this email thread because the subject seemed irrelevant to me. I still don't get why this is causing a problem with suspend/resume with video playback.
The functions you're changing are mostly used when running without HWS. This should only be the case during bring-ups or while debugging HWS issues. Otherwise they're only used for setting up the HIQ. That means in normal operation, these functions should not be used for user mode queue mapping, which is handled by the HWS.
Ray, I vaguely remember we discussed using KIQ for mapping the HIQ at some point. Did anyone ever propose a patch for that?
Thanks,
Felix
Am 2020-04-03 um 12:07 a.m. schrieb Prike Liang:
Quoted 93 lines
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +6
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);acquire_queue (kgd, pipe_id, queue_id);@@ -299,6 +300,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell)WREG32_FIELD15 (GC ,0 ,CP_PQ_STATUS ,DOORBELL_ENABLE ,1 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring) · line 3677
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 16 lines
-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: Tuesday, April 7, 2020 11:43 PM
To: Liang, Prike <[email protected]>; [email protected]; Huang, Ray <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx hang during suspend with video playbackSorry, I missed this email thread because the subject seemed irrelevant to me. I still don't get why this is causing a problem with suspend/resume with video playback.
Quoted 5 lines
The functions you're changing are mostly used when running without HWS. This should only be the case during bring-ups or while debugging HWS issues. Otherwise they're only used for setting up the HIQ. That means in normal operation, these functions should not be used for user mode queue mapping, which is handled by the HWS.
[Prike] This issue caused by improperly accessing the register CP_HQD_ACTIVE under GFX enter CGPG during perform destroy MQD at the stage of amdkfd suspend.
For this solution may have an excessive guard for some MQD setup and occupy check. It's likely a potential common issue and have drafted v2 patch to disable GFX CGPG directly before perform amdgpu suspend opt.
Thanks,
Prike
Quoted 112 lines
Ray, I vaguely remember we discussed using KIQ for mapping the HIQ at some point. Did anyone ever propose a patch for that?
Thanks,
FelixAm 2020-04-03 um 12:07 a.m. schrieb Prike Liang:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void
Quoted 18 lines
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +0
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void*mqd,
uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd); acquire_queue(kgd, pipe_id, queue_id); @@ -299,6 +300,7 @@ intkgd_gfx_v9_hqd_load(struct
kgd_dev*kgd, void *mqd,uint32_tpipe_id,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev*kgd,
uint64_tqueue_address,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd,void *mqd,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1
-0}release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_init_register(struct · line 3631
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (ring->use_doorbell) WREG32_FIELD15(GC, 0, CP_PQ_STATUS, DOORBELL_ENABLE,1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct
amdgpu_ring*ring)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring) · line 3677
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Huang Rui
Reviewed-by Felix KuehlingQuoted 9 lines · Felix
Sorry, I missed this email thread because the subject seemed irrelevant to me. I still don't get why this is causing a problem with suspend/resume with video playback.
The functions you're changing are mostly used when running without HWS. This should only be the case during bring-ups or while debugging HWS issues. Otherwise they're only used for setting up the HIQ. That means in normal operation, these functions should not be used for user mode queue mapping, which is handled by the HWS.
The issue is caused by destorying the queue with mmio under cgpg/gfxoff enabled.
While we do suspend to S3, it will destory the HIQ under CGPG/GFXOFF is still enabled. At that time, we didn't have any commands under HWS, because of no ROCm application is running.
In this case, we have three ways to fix the issue:
1. Disable CGPG/GFXOFF before do kfd suspend.
https://lists.freedesktop.org/archives/amd-gfx/2020-April/048181.html
2. Destory the hiq queue under RLC save mode.
3. Using the UNMAP packet to unmap the hiq with kiq instead of mmio.
I think use #1 is more straightforward. For long term, I think we should use kiq to map/unmap all cp/sdma queues.
Quoted 4 lines
Ray, I vaguely remember we discussed using KIQ for mapping the HIQ at some point. Did anyone ever propose a patch for that?
Yes, that's patch is already upstream. However this issue is caused by destorying the queue. (sorry, I should cover this case before)
commit 35cd89d5a658dc26687a7a6909d35fee19a6b173
Author: Aaron Liu <[email protected]> Date: Wed Dec 25 15:50:51 2019 +0800
drm/amdkfd: use kiq to load the mqd of hiq queue for gfx v9 (v6)
There is an issue that CP will check the HIQ queue to be configured and mapped with KIQ ring, otherwise, it will be unable to read back the secure buffer while the gfxoff is enabled even with trusted IP blocks.
v1 -> v2:
- Fix to remove surplus set_resources packets.
- Fill the whole configuration in MQD.
- Change the author as Aaron because he addressed the key point of this issue.
- Add kiq ring lock.
v2 -> v3:
- Free the lock while in error return case.
- Remove the programming only needed by the queue is unmapped.
v3 -> v4:
- Remove doorbell programming because it's used for restarting queue.
- Remove CP scheduler programming because map_queue packet will handle this.
v4 -> v5:
- Remove cp_hqd_active because mec ucode will enable it while use map_queues.
- Revise goto out_unlock.
- Correct the right doorbell offset for HIQ that kfd driver assigned in the packet.
v5 -> v6:
- Merge Arcturus fix into this patch because it will get oops in Arcturus platform.
Thanks,
Ray
Quoted 96 lines
Thanks,
FelixAm 2020-04-03 um 12:07 a.m. schrieb Prike Liang:
Quoted 92 lines
The system will be hang up during S3 as SMU is pending at GC not respose the register
CP_HQD_ACTIVEaccess request and this issue can be fixed by adding RLC safe mode guard before each HQD map/unmap retrive opt.Signed-off-by Prike Liang <[email protected]>Tested-by Mengbing Wang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +6
-0@@ -232,6 +232,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,uint32_t *mqd_hqd;uint32_t reg, hqd_base, data; +amdgpu_gfx_rlc_enter_safe_mode (adev); m =get_mqd (mqd);acquire_queue (kgd, pipe_id, queue_id);@@ -299,6 +300,7 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -497,6 +499,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,bool retval = false;uint32_t low, high; +amdgpu_gfx_rlc_enter_safe_mode (adev);acquire_queue (kgd, pipe_id, queue_id); act =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmCP_HQD_ACTIVE));if (act) {@@ -508,6 +511,7 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, retval = true; }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return retval; }@@ -541,6 +545,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,uint32_t temp;struct v9_mqd *m =get_mqd (mqd); +amdgpu_gfx_rlc_enter_safe_mode (adev);if (adev->in_gpu_reset)return -EIO ;@@ -577,6 +582,7 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, }release_queue (kgd); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0@@ -3533,6 +3533,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)struct v9_mqd *mqd = ring->mqd_ptr;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable wptr polling */ WREG32_FIELD15 (GC ,0 ,CP_PQ_WPTR_POLL_CNTL ,EN ,0 );@@ -3629,6 +3630,7 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)if (ring->use_doorbell)WREG32_FIELD15 (GC ,0 ,CP_PQ_STATUS ,DOORBELL_ENABLE ,1 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }@@ -3637,6 +3639,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;int j; +amdgpu_gfx_rlc_enter_safe_mode (adev);/* disable the queue if it's active */ if (RREG32_SOC15 (GC ,0 , mmCP_HQD_ACTIVE) &1 ) {
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring) · line 3677
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -3668,6 +3671,7 @@ static int gfx_v9_0_kiq_fini_register(struct amdgpu_ring *ring)WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_HI,0 );WREG32_SOC15_RLC (GC ,0 , mmCP_HQD_PQ_WPTR_LO,0 ); +amdgpu_gfx_rlc_exit_safe_mode (adev);return 0 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx