Skip to contentSkip to conversation

drm/amdgpu: check ring being ready before using

PATCH In review Pixel Ding 2 participants 2 messages Jan 18, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Pixel Ding

author
#0 lore raw

PATCH 1/1 drm/amdgpu: check ring being ready before using

From: Ding Pixel <[email protected]>

Return success when the ring is properly initialized, otherwise return failure.

Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of these IPs is bypassed. The system crashes if application submit IB to their rings which are not ready to use. It could be a common issue if IP having ring buffer is disabled for some reason on specific ASIC, so it should check the ring being ready to use.

Bug: amdgpu_test crashes system on Tonga VF.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7 -0
index 08dd97b..6e948e4 100644
@@ -83,6 +83,13 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
 		}
 		break;
 	}
+
+	if (!(*out_ring && (*out_ring)->adev)) {
+		DRM_ERROR("Ring %d is not initialized on IP %d\n",
+			  ring, ip_type);
+		return -EINVAL;
+	}
+
 	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): 1484750748-31389-1-git-send-email-pding-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 18.01.2017 um 15:45 schrieb Pixel Ding:

Quoted 5 lines

From: Ding Pixel <[email protected]>

Return success when the ring is properly initialized, otherwise return failure.

Quoted 7 lines

Tonga SRIOV VF doesn't have UVD and VCE engines, the initialization of these IPs is bypassed. The system crashes if application submit IB to their rings which are not ready to use. It could be a common issue if IP having ring buffer is disabled for some reason on specific ASIC, so it should check the ring being ready to use.

Bug: amdgpu_test crashes system on Tonga VF.

Not a big issue, but when you send out a patch for the second time it is good practice to add "v2" to the subject and something like "v2: changed xyz...." to the commit message.

Quoted 2 lines
Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index 08dd97b..6e948e4 100644
@@ -83,6 +83,13 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
  		}
  		break;
  	}

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, · line 95

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7 -0
+
+	if (!(*out_ring && (*out_ring)->adev)) {
+		DRM_ERROR("Ring %d is not initialized on IP %d\n",
+			  ring, ip_type);
+		return -EINVAL;
+	}
+
  	return 0;
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx