summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorMayank Kaushik <mkaushik@nvidia.com>2014-09-04 21:35:25 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:12 -0400
commit545fadee0a7de14b087af40c98281e8653d2e312 (patch)
tree5e896b2dd1817ea571d9e9905c25ab1d366811fc /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parented0c49a0b160f234f70474d299b2740e950158b8 (diff)
gpu: nvgpu: gk20a: check ctx valid bit
When determining the chid for the current context, first check the ctx valid bit. Bug 1485555 Change-Id: I6c3096d800a6cef38b656d525437a2c4f8b45774 Signed-off-by: Mayank Kaushik <mkaushik@nvidia.com> Reviewed-on: http://git-master/r/496140 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Geoffrey Gerfin <ggerfin@nvidia.com> Tested-by: Geoffrey Gerfin <ggerfin@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 976e9171..f5c3bd62 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -5224,6 +5224,7 @@ static int gk20a_gr_handle_notify_pending(struct gk20a *g,
5224 5224
5225/* Used by sw interrupt thread to translate current ctx to chid. 5225/* Used by sw interrupt thread to translate current ctx to chid.
5226 * For performance, we don't want to go through 128 channels every time. 5226 * For performance, we don't want to go through 128 channels every time.
5227 * curr_ctx should be the value read from gr_fecs_current_ctx_r().
5227 * A small tlb is used here to cache translation */ 5228 * A small tlb is used here to cache translation */
5228static int gk20a_gr_get_chid_from_ctx(struct gk20a *g, u32 curr_ctx) 5229static int gk20a_gr_get_chid_from_ctx(struct gk20a *g, u32 curr_ctx)
5229{ 5230{
@@ -5232,6 +5233,13 @@ static int gk20a_gr_get_chid_from_ctx(struct gk20a *g, u32 curr_ctx)
5232 u32 chid = -1; 5233 u32 chid = -1;
5233 u32 i; 5234 u32 i;
5234 5235
5236 /* when contexts are unloaded from GR, the valid bit is reset
5237 * but the instance pointer information remains intact. So the
5238 * valid bit must be checked to be absolutely certain that a
5239 * valid context is currently resident. */
5240 if (!gr_fecs_current_ctx_valid_v(curr_ctx))
5241 return -1;
5242
5235 spin_lock(&gr->ch_tlb_lock); 5243 spin_lock(&gr->ch_tlb_lock);
5236 5244
5237 /* check cache first */ 5245 /* check cache first */