Skip to contentSkip to conversation

drm/amdgpu: job is secure iff CS is secure (v5)

PATCH In review Huang, Ray 2 participants 2 messages Sep 29, 2019 – Sep 30, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Huang, Ray

author
#0 lore raw

PATCH v4 10/11 drm/amdgpu: job is secure iff CS is secure (v5)

Mark a job as secure, if and only if the command submission flag has the secure flag set.

v2: fix the null job pointer while in vmid 0 submission.
v3: Context --> Command submission.
v4: filling cs parser with cs->in.flags
v5: move the job secure flag setting out of amdgpu_cs_submit()

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
index 49b767b..c18a153 100644
@@ -231,6 +231,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
 	if (ret)
 		goto free_all_kdata;
 
+	p->job->secure = cs->in.flags & AMDGPU_CS_FLAGS_SECURE;
+
 	if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) {
 		ret = -ECANCELED;
 		goto free_all_kdata;
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index 9a6dbf3..6e0f97a 100644
@@ -213,7 +213,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	if (job && ring->funcs->emit_cntxcntl) {
 		status |= job->preamble_status;
 		status |= job->preemption_status;
-		amdgpu_ring_emit_cntxcntl(ring, status, false);
+		amdgpu_ring_emit_cntxcntl(ring, status, job->secure);
 	}
 
 	for (i = 0; i < num_ibs; ++i) {
@@ -232,7 +232,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	}
 
 	if (ring->funcs->emit_tmz)
-		amdgpu_ring_emit_tmz(ring, false, false);
+		amdgpu_ring_emit_tmz(ring, false, job ? job->secure : false);
 
 #ifdef CONFIG_X86_64
 	if (!(adev->flags & AMD_IS_APU))
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2 -0
index dc7ee93..aa0e375 100644
@@ -63,6 +63,8 @@ struct amdgpu_job {
 	uint64_t		uf_addr;
 	uint64_t		uf_sequence;
 
+	/* the job is due to a secure command submission */
+	bool			secure;
 };
 
 int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
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): 1569742788-22429-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 29.09.19 um 09:40 schrieb Huang, Ray:

Quoted 9 lines

Mark a job as secure, if and only if the command submission flag has the secure flag set.

v2: fix the null job pointer while in vmid 0 submission.
v3: Context --> Command submission.
v4: filling cs parser with cs->in.flags
v5: move the job secure flag setting out of amdgpu_cs_submit()

Quoted 4 lines

At some point we need to cleanup struct amdgpu_job, but for now that is perfectly ok.

Patch is Reviewed-by: Christian König <[email protected]>

Quoted 46 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 2 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c  | 4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++
  3 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
index 49b767b..c18a153 100644
@@ -231,6 +231,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
  	if (ret)
  		goto free_all_kdata;
 
+	p->job->secure = cs->in.flags & AMDGPU_CS_FLAGS_SECURE;
+
  	if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) {
  		ret = -ECANCELED;
  		goto free_all_kdata;
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index 9a6dbf3..6e0f97a 100644
@@ -213,7 +213,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	if (job && ring->funcs->emit_cntxcntl) {
  		status |= job->preamble_status;
  		status |= job->preemption_status;
-		amdgpu_ring_emit_cntxcntl(ring, status, false);
+		amdgpu_ring_emit_cntxcntl(ring, status, job->secure);
  	}
 
  	for (i = 0; i < num_ibs; ++i) {
@@ -232,7 +232,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	}
 
  	if (ring->funcs->emit_tmz)
-		amdgpu_ring_emit_tmz(ring, false, false);
+		amdgpu_ring_emit_tmz(ring, false, job ? job->secure : false);
 
  #ifdef CONFIG_X86_64
  	if (!(adev->flags & AMD_IS_APU))
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0 -0
index dc7ee93..aa0e375 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 70

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2 -0
@@ -63,6 +63,8 @@ struct amdgpu_job {
  	uint64_t		uf_addr;
  	uint64_t		uf_sequence;
 
+	/* the job is due to a secure command submission */
+	bool			secure;
  };
 
  int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,

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