aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2015-08-04 10:58:36 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-08-17 16:51:01 -0400
commit0e89d0c16b9446a094215e71734e583c438bf83d (patch)
tree914cd8c6aa9766789e041b0b04c04dc5e285944c /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
parentefd4ccb59a4acb8b85835d6b053362dbacee40f9 (diff)
drm/amdgpu: stop leaking the ctx id into the scheduler v2
Id's are for the IOCTL ABI only. v2: remove tgid as well Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 3c353375b228..c2290ae20312 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -50,8 +50,7 @@ static void amdgpu_ctx_do_release(struct kref *ref)
50 50
51static void amdgpu_ctx_init(struct amdgpu_device *adev, 51static void amdgpu_ctx_init(struct amdgpu_device *adev,
52 struct amdgpu_fpriv *fpriv, 52 struct amdgpu_fpriv *fpriv,
53 struct amdgpu_ctx *ctx, 53 struct amdgpu_ctx *ctx)
54 uint32_t id)
55{ 54{
56 int i; 55 int i;
57 memset(ctx, 0, sizeof(*ctx)); 56 memset(ctx, 0, sizeof(*ctx));
@@ -81,7 +80,7 @@ int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
81 return r; 80 return r;
82 } 81 }
83 *id = (uint32_t)r; 82 *id = (uint32_t)r;
84 amdgpu_ctx_init(adev, fpriv, ctx, *id); 83 amdgpu_ctx_init(adev, fpriv, ctx);
85 mutex_unlock(&mgr->lock); 84 mutex_unlock(&mgr->lock);
86 } else { 85 } else {
87 if (adev->kernel_ctx) { 86 if (adev->kernel_ctx) {
@@ -89,8 +88,7 @@ int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
89 kfree(ctx); 88 kfree(ctx);
90 return 0; 89 return 0;
91 } 90 }
92 *id = AMD_KERNEL_CONTEXT_ID; 91 amdgpu_ctx_init(adev, fpriv, ctx);
93 amdgpu_ctx_init(adev, fpriv, ctx, *id);
94 92
95 adev->kernel_ctx = ctx; 93 adev->kernel_ctx = ctx;
96 } 94 }
@@ -105,8 +103,7 @@ int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
105 rq = &adev->rings[i]->scheduler->kernel_rq; 103 rq = &adev->rings[i]->scheduler->kernel_rq;
106 r = amd_context_entity_init(adev->rings[i]->scheduler, 104 r = amd_context_entity_init(adev->rings[i]->scheduler,
107 &ctx->rings[i].c_entity, 105 &ctx->rings[i].c_entity,
108 NULL, rq, *id, 106 NULL, rq, amdgpu_sched_jobs);
109 amdgpu_sched_jobs);
110 if (r) 107 if (r)
111 break; 108 break;
112 } 109 }