Skip to contentSkip to conversation

drm/amdgpu: reject secure submission on rings which don't support it

PATCH In review Lang Yu 2 participants 3 messages Mar 14, 2022

Subsystems (2)
lore
Share & tools
lore

Lang Yu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: reject secure submission on rings which don't support it

Only ring GFX, SDMA and VCN_DEC support secure submission at the moment.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index bc1297dcdf97..840304691b92 100644
@@ -166,8 +166,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	}
 
 	if ((ib->flags & AMDGPU_IB_FLAGS_SECURE) &&
-	    (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)) {
-		dev_err(adev->dev, "secure submissions not supported on compute rings\n");
+	    !amdgpu_ring_secure_submission_supported(ring)) {
+		dev_err(adev->dev, "secure submissions not supported on ring <%s>\n", ring->name);
 		return -EINVAL;
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -0
index a8bed1b47899..3afe3d60e194 100644
@@ -363,6 +363,14 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
 	ring->count_dw -= count_dw;
 }
 
+static inline
+bool amdgpu_ring_secure_submission_supported(struct amdgpu_ring *ring)
+{
+	return (ring->funcs->type == AMDGPU_RING_TYPE_GFX ||
+		ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+		ring->funcs->type == AMDGPU_RING_TYPE_VCN_DEC);
+}
+
 int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
 
 void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Am 14.03.22 um 03:46 schrieb Lang Yu:

Quoted 3 lines

Only ring GFX, SDMA and VCN_DEC support secure submission at the moment.

it would be nicer if we have that as flag in ring->funcs, but that way works for now as well.

Thanks,
Christian.

Quoted 39 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++++++
  2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index bc1297dcdf97..840304691b92 100644
@@ -166,8 +166,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	}
 
  	if ((ib->flags & AMDGPU_IB_FLAGS_SECURE) &&
-	    (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)) {
-		dev_err(adev->dev, "secure submissions not supported on compute rings\n");
+	    !amdgpu_ring_secure_submission_supported(ring)) {
+		dev_err(adev->dev, "secure submissions not supported on ring <%s>\n", ring->name);
  		return -EINVAL;
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -0
index a8bed1b47899..3afe3d60e194 100644
@@ -363,6 +363,14 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
  	ring->count_dw -= count_dw;
  }
 
+static inline
+bool amdgpu_ring_secure_submission_supported(struct amdgpu_ring *ring)
+{
+	return (ring->funcs->type == AMDGPU_RING_TYPE_GFX ||
+		ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+		ring->funcs->type == AMDGPU_RING_TYPE_VCN_DEC);
+}
+
  int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
 
  void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
author
#2 lore raw
Quoted 7 lines · Christian König

Am 14.03.22 um 03:46 schrieb Lang Yu:

Quoted 3 lines

Only ring GFX, SDMA and VCN_DEC support secure submission at the moment.

it would be nicer if we have that as flag in ring->funcs, but that way works for now as well.

Okay. I will add a flag in ring->funcs and send another patch. Thanks!

Regards,
Lang

Quoted 41 lines

Thanks,
Christian.

Quoted 35 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++++++
  2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index bc1297dcdf97..840304691b92 100644
@@ -166,8 +166,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	}
  	if ((ib->flags & AMDGPU_IB_FLAGS_SECURE) &&
-	    (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)) {
-		dev_err(adev->dev, "secure submissions not supported on compute rings\n");
+	    !amdgpu_ring_secure_submission_supported(ring)) {
+		dev_err(adev->dev, "secure submissions not supported on ring <%s>\n", ring->name);
  		return -EINVAL;
  	}
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +8 -0
index a8bed1b47899..3afe3d60e194 100644
@@ -363,6 +363,14 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
  	ring->count_dw -= count_dw;
  }
+static inline
+bool amdgpu_ring_secure_submission_supported(struct amdgpu_ring *ring)
+{
+	return (ring->funcs->type == AMDGPU_RING_TYPE_GFX ||
+		ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+		ring->funcs->type == AMDGPU_RING_TYPE_VCN_DEC);
+}
+
  int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
  void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,