]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: job is secure iff CS is secure (v5)
authorHuang Rui <ray.huang@amd.com>
Thu, 8 Aug 2019 12:05:15 +0000 (20:05 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Apr 2020 20:20:28 +0000 (16:20 -0400)
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: Huang Rui <ray.huang@amd.com>
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h

index 3eee5c7d83e0372195faaf06e52bbb3210855572..99de770a8e9f253516bd5926cae96c0dc4bed246 100644 (file)
@@ -232,6 +232,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;
index ac9090a282d8c34ac30e69f9d4834849693362ca..045951d2b46c09b9aaab4b004e7d3500b74cbb11 100644 (file)
@@ -214,7 +214,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) {
@@ -233,7 +233,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))
index d4262069d501d374d878f41a949b5e19deb51edb..7f5ccee476a412af9d9350392b6a71aabe21f2ab 100644 (file)
@@ -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,