All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: reject secure submission on rings which don't support it
@ 2022-03-14  2:46 Lang Yu
  2022-03-14  7:53 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Lang Yu @ 2022-03-14  2:46 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Huang Rui, Lang Yu, Christian Koenig

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

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index bc1297dcdf97..840304691b92 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -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;
 	}
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index a8bed1b47899..3afe3d60e194 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: reject secure submission on rings which don't support it
  2022-03-14  2:46 [PATCH] drm/amdgpu: reject secure submission on rings which don't support it Lang Yu
@ 2022-03-14  7:53 ` Christian König
  2022-03-14  9:22   ` Lang Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2022-03-14  7:53 UTC (permalink / raw)
  To: Lang Yu, amd-gfx; +Cc: Alex Deucher, Huang Rui, Christian Koenig

Am 14.03.22 um 03:46 schrieb Lang Yu:
> Only ring GFX, SDMA and VCN_DEC support secure submission at the moment.
>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>

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

Reviewed-by: Christian König <christian.koenig@amd.com>

Thanks,
Christian.

> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> index bc1297dcdf97..840304691b92 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> @@ -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;
>   	}
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index a8bed1b47899..3afe3d60e194 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -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,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: reject secure submission on rings which don't support it
  2022-03-14  7:53 ` Christian König
@ 2022-03-14  9:22   ` Lang Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Lang Yu @ 2022-03-14  9:22 UTC (permalink / raw)
  To: Christian König; +Cc: Alex Deucher, Huang Rui, Christian Koenig, amd-gfx

On 03/14/ , Christian König wrote:
> Am 14.03.22 um 03:46 schrieb Lang Yu:
> > Only ring GFX, SDMA and VCN_DEC support secure submission at the moment.
> > 
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> 
> 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

> Reviewed-by: Christian König <christian.koenig@amd.com>
> 
> Thanks,
> Christian.
> 
> > ---
> >   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(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> > index bc1297dcdf97..840304691b92 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
> > @@ -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;
> >   	}
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> > index a8bed1b47899..3afe3d60e194 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> > @@ -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,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-14  9:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-14  2:46 [PATCH] drm/amdgpu: reject secure submission on rings which don't support it Lang Yu
2022-03-14  7:53 ` Christian König
2022-03-14  9:22   ` Lang Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.