Skip to contentSkip to conversation

drm/radeon: avoid crash if VM command submission isn't available

PATCH In review Christian König 2 participants 2 messages May 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: avoid crash if VM command submission isn't available

From: Christian König <[email protected]>

---
 drivers/gpu/drm/radeon/radeon_cs.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_cs.c +11 -4
index 2b6e0eb..4b6f5b8 100644
@@ -342,10 +342,17 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 			return -EINVAL;
 
 		/* we only support VM on some SI+ rings */
-		if ((p->rdev->asic->ring[p->ring]->cs_parse == NULL) &&
-		   ((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
-			DRM_ERROR("Ring %d requires VM!\n", p->ring);
-			return -EINVAL;
+		if ((p->cs_flags & RADEON_CS_USE_VM) == 0) {
+			if (p->rdev->asic->ring[p->ring]->cs_parse == NULL) {
+				DRM_ERROR("Ring %d requires VM!\n", p->ring);
+				return -EINVAL;
+			}
+		} else {
+			if (p->rdev->asic->ring[p->ring]->ib_parse == NULL) {
+				DRM_ERROR("VM not supported on ring %d!\n",
+					  p->ring);
+				return -EINVAL;
+			}
 		}
 	}
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christian König

From: Christian König <[email protected]>

Quoted 33 lines
---
 drivers/gpu/drm/radeon/radeon_cs.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_cs.c +11 -5
index 2b6e0eb..4b6f5b8 100644
@@ -342,10 +342,17 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
                        return -EINVAL;
 
                /* we only support VM on some SI+ rings */
-               if ((p->rdev->asic->ring[p->ring]->cs_parse == NULL) &&
-                  ((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
-                       DRM_ERROR("Ring %d requires VM!\n", p->ring);
-                       return -EINVAL;
+               if ((p->cs_flags & RADEON_CS_USE_VM) == 0) {
+                       if (p->rdev->asic->ring[p->ring]->cs_parse == NULL) {
+                               DRM_ERROR("Ring %d requires VM!\n", p->ring);
+                               return -EINVAL;
+                       }
+               } else {
+                       if (p->rdev->asic->ring[p->ring]->ib_parse == NULL) {
+                               DRM_ERROR("VM not supported on ring %d!\n",
+                                         p->ring);
+                               return -EINVAL;
+                       }
                }
        }
 
--

1.9.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel