Commit cb5fae14 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

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()
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8350361d
...@@ -232,6 +232,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs ...@@ -232,6 +232,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
if (ret) if (ret)
goto free_all_kdata; 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) { if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) {
ret = -ECANCELED; ret = -ECANCELED;
goto free_all_kdata; goto free_all_kdata;
......
...@@ -214,7 +214,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, ...@@ -214,7 +214,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
if (job && ring->funcs->emit_cntxcntl) { if (job && ring->funcs->emit_cntxcntl) {
status |= job->preamble_status; status |= job->preamble_status;
status |= job->preemption_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) { for (i = 0; i < num_ibs; ++i) {
...@@ -233,7 +233,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, ...@@ -233,7 +233,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
} }
if (ring->funcs->emit_tmz) 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 #ifdef CONFIG_X86_64
if (!(adev->flags & AMD_IS_APU)) if (!(adev->flags & AMD_IS_APU))
......
...@@ -63,6 +63,8 @@ struct amdgpu_job { ...@@ -63,6 +63,8 @@ struct amdgpu_job {
uint64_t uf_addr; uint64_t uf_addr;
uint64_t uf_sequence; 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, int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment