[PATCH] drm/amdgpu: check CG flag before querying CG status

Lang Yu lang.yu at amd.com
Mon Aug 2 09:30:26 UTC 2021


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 <lang.yu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b1d2dc39e8be..a7afcdc50ca8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -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;
-- 
2.25.1



More information about the amd-gfx mailing list