drm/amdgpu: job is secure iff CS is secure (v4)
Subsystems (2)
PATCH v3 10/11 drm/amdgpu: job is secure iff CS is secure (v4)
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
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +10 -1
@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs goto free_chunk; } +/** +* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user,
@@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;amdgpu_job_free_resources (job);
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
@@ -210,7 +210,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) {
@@ -229,7 +229,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
@@ -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 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 1569422279-6609-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org
Am 25.09.19 um 16:38 schrieb Huang, Ray:
Quoted 53 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 withcs->in.flagsSigned-off-by Huang Rui <[email protected]>Co-developed-by Luben Tuikov <[email protected]>Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8
-0@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs goto free_chunk; } +/** +* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, · line 1265
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2
-1@@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;
At least it is no longer accessing cs->in, but that still looks like the wrong place to initialize the job.
Why can't we fill that in directly after amdgpu_job_alloc() ?
Regards,
Christian.
Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0amdgpu_job_free_resources (job);drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2
-2@@ -210,7 +210,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) {@@ -229,7 +229,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
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
Quoted 77 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 25, 2019 10:47 PM
To: Huang, Ray <[email protected]>; [email protected]; dri- [email protected]; Deucher, Alexander <[email protected]>
Cc: Tuikov, Luben <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH v3 10/11] drm/amdgpu: job is secure iff CS is secure (v4)Am 25.09.19 um 16:38 schrieb Huang, Ray:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct
Quoted 39 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 withcs->in.flagsSigned-off-by Huang Rui <[email protected]>Co-developed-by Luben Tuikov <[email protected]>Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct
amdgpu_cs_parser*p, uniondrm_amdgpu_csQuoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8
-0goto free_chunk; } +/** +* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-1chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user, @@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;At least it is no longer accessing
cs->in, but that still looks like the wrong place to initialize the job.
Quoted 1 line
Why can't we fill that in directly after
amdgpu_job_alloc()?
There is not input member that is secure related in amdgpu_job_alloc() except add an one:
amdgpu_job_alloc(adev, num_ibs, job, vm, secure)
It looks too much, isn't it?
Thanks,
Ray
Quoted 41 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 9 lines
amdgpu_job_free_resources(job);drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0@@ -210,7 +210,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1if (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) {@@ -229,7 +229,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1}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@@ -63,6 +63,8 @@ struct amdgpu_job {uint64_t uf_addr;uint64_t uf_sequence;
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 70
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0+/* the job is due to a secure command submission */ +bool secure; }; int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 51 lines · Ray
Quoted 51 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 25, 2019 10:47 PM
To: Huang, Ray <[email protected]>; [email protected]; dri- [email protected]; Deucher, Alexander <[email protected]>
Cc: Tuikov, Luben <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH v3 10/11] drm/amdgpu: job is secure iff CS is secure (v4)Am 25.09.19 um 16:38 schrieb Huang, Ray:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct
Quoted 39 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 withcs->in.flagsSigned-off-by Huang Rui <[email protected]>Co-developed-by Luben Tuikov <[email protected]>Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct
amdgpu_cs_parser*p, uniondrm_amdgpu_cs
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs · line 136
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1
-0goto free_chunk; } +/**
NAK to double-stars flag-pole top here--this is NOT a function comment. Since you do have an empty line immediately BEFORE this comment, then you do not need the flag-pole top "/*" to add yet another semi-empty line. Just start your comment normally:
/* The command submission ...
*
...
*/p->is_secure = ...
Regards,
Luben
Quoted 74 lines
Quoted 22 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +7
-0+* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-1chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user, @@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;At least it is no longer accessing
cs->in, but that still looks like the wrong place to initialize the job.Quoted 1 line
Why can't we fill that in directly after
amdgpu_job_alloc()?There is not input member that is secure related in
amdgpu_job_alloc()except add an one:
amdgpu_job_alloc(adev, num_ibs, job, vm, secure)It looks too much, isn't it?
Thanks,
RayQuoted 41 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 9 lines
amdgpu_job_free_resources(job);drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0@@ -210,7 +210,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1if (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) {@@ -229,7 +229,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1}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@@ -63,6 +63,8 @@ struct amdgpu_job {uint64_t uf_addr;uint64_t uf_sequence;
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 70
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0+/* the job is due to a secure command submission */ +bool secure; }; int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3309B9F92121C846639C87ECEC870-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Am 25.09.19 um 16:54 schrieb Huang, Ray:
Quoted 76 lines
Quoted 76 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 25, 2019 10:47 PM
To: Huang, Ray <[email protected]>; [email protected]; dri- [email protected]; Deucher, Alexander <[email protected]>
Cc: Tuikov, Luben <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH v3 10/11] drm/amdgpu: job is secure iff CS is secure (v4)Am 25.09.19 um 16:38 schrieb Huang, Ray:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct
Quoted 39 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 withcs->in.flagsSigned-off-by Huang Rui <[email protected]>Co-developed-by Luben Tuikov <[email protected]>Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct
amdgpu_cs_parser*p, uniondrm_amdgpu_csQuoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8
-0goto free_chunk; } +/** +* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-1chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user, @@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;At least it is no longer accessing
cs->in, but that still looks like the wrong place to initialize the job.
Quoted 6 lines
Quoted 1 line
Why can't we fill that in directly after
amdgpu_job_alloc()?There is not input member that is secure related in
amdgpu_job_alloc()except add an one:
amdgpu_job_alloc(adev, num_ibs, job, vm, secure)It looks too much, isn't it?
You should not add a new parameter, but rather set the member in amdgpu_cs_parser_init() after amdgpu_job_alloc().
Or maybe even better add that into amdgpu_cs_ib_fill(), cause here is where we fill in most of the job description.
Regards,
Christian.
Quoted 43 lines
Thanks,
RayQuoted 39 lines
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 8 lines
amdgpu_job_free_resources(job);drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0@@ -210,7 +210,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring,
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1if (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) {@@ -229,7 +229,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned
num_ibs,Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1}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@@ -63,6 +63,8 @@ struct amdgpu_job {uint64_t uf_addr;uint64_t uf_sequence;
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 70
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0+/* 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
A message that is not in the archive (sent off-list or not yet received): 51436784-ed76-b326-534a-86301382fc59-5C7GfCeVMHo@public.gmane.org
Tuikov, Luben
Reviewed-by Alex DeucherQuoted 78 lines · Christian
Am 25.09.19 um 16:54 schrieb Huang, Ray:
Quoted 77 lines
Quoted 77 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Wednesday, September 25, 2019 10:47 PM
To: Huang, Ray <[email protected]>; [email protected]; dri- [email protected]; Deucher, Alexander <[email protected]>
Cc: Tuikov, Luben <[email protected]>; Liu, Aaron <[email protected]>
Subject: Re: [PATCH v3 10/11] drm/amdgpu: job is secure iff CS is secure (v4)Am 25.09.19 um 16:38 schrieb Huang, Ray:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct
Quoted 39 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 withcs->in.flagsSigned-off-by Huang Rui <[email protected]>Co-developed-by Luben Tuikov <[email protected]>Signed-off-by Luben Tuikov <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -485,6 +485,9 @@ struct amdgpu_cs_parser {uint64_t bytes_moved;uint64_t bytes_moved_vis; +/* secure cs */ +bool is_secure; +/* user fence */ struct amdgpu_bo_list_entry uf_entry;drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0
-0@@ -133,6 +133,14 @@ static int amdgpu_cs_parser_init(struct
amdgpu_cs_parser*p, uniondrm_amdgpu_csQuoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +8
-0goto free_chunk; } +/** +* The command submission (cs) is a union, so an assignment to +* 'out' is destructive to the cs (at least the first 8 +* bytes). For this reason, inquire about the flags before the +* assignment to 'out'. +*/ + p->is_secure = cs->in.flags &AMDGPU_CS_FLAGS_SECURE ; +/* get chunks */ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c static int amdgpu_cs_parser_init(struct
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3
-1chunk_array_user =u64_to_user_ptr (cs->in.chunks); if (copy_from_user(chunk_array, chunk_array_user, @@ -1252,8 +1260,9 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + job->secure = p->is_secure; job->uf_sequence = seq; + cs->out.handle = seq;At least it is no longer accessing
cs->in, but that still looks like the wrong place to initialize the job.Why can't we fill that in directly after
amdgpu_job_alloc()?
Quoted 8 lines
Quoted 5 lines
There is not input member that is secure related in
amdgpu_job_alloc()except add an one:
amdgpu_job_alloc(adev, num_ibs, job, vm, secure)It looks too much, isn't it?
You should not add a new parameter, but rather set the member in
amdgpu_cs_parser_init()afteramdgpu_job_alloc().
I'd also rather have it right after amdgpu_job_alloc().
Quoted 2 lines
Or maybe even better add that into
amdgpu_cs_ib_fill(), cause here is where we fill in most of the job description.
I didn't see much interaction between cs and job, it mostly does ib fill. Only line mentioning job is line circa 946:
if (parser->job->uf_addr && ring->funcs->no_user_fence)
as well as the fact that cs is not defined in this function.
I think it is cleaner in amdgpu_cs_parses_init() as per your suggestion above, since cs is locally defined and accessible. The attached sequenced patch shows this.
Regards,
Luben
commit 1d92719a47cc243983e003985d1182e41cc00d4e
Author: Huang Rui <[email protected]> Date: Thu Aug 8 20:05:15 2019 +0800
drm/amdgpu: job is secure iff CS is secure (v3)
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.
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -231,6 +231,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_csif (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
@@ -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
@@ -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