drm/amdgpu: check CG flag before querying CG status
Subsystems (2)
PATCH 1/1 drm/amdgpu: check CG flag before querying CG status
For ASICs which don't supoort clock gating, querying CG status may cause a hardware hang issue. So add a CG flag check to exit directly in such a case.
Signed-off-by Lang Yu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1671,6 +1671,11 @@ void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev, {int i; +if (!adev->cg_flags) { + *flags =0 ; +return ; + } +for (i =0 ; i < adev->num_ip_blocks; i++) {if (!adev->ip_blocks[i].status.valid)continue ;
Signature · 1 line
2.25.1
Quoted 15 lines · Lang Yu
For ASICs which don't supoort clock gating, querying CG status may cause a hardware hang issue. So add a CG flag check to exit directly in such a case.
Signed-off-by Lang Yu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev, · line 1677
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -1671,6 +1671,11 @@ void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev, {int i; +if (!adev->cg_flags) { + *flags =0 ; +return ; + }
This is fine if someone has disabled all CG flags, but maybe it would be better to check each flag individually within the get_clockgating_state() callback for each IP. Do we need a similar check for PG flags?
Alex
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1+for (i =0 ; i < adev->num_ip_blocks; i++) {if (!adev->ip_blocks[i].status.valid)continue ; --2.25.1