gpu: nvgpu: remove direct tsg retrieval from fifo

Added
- nvgpu_tsg_check_and_get_from_id
- nvgpu_tsg_get_from_id

And removed direct accesses to f->tsg array.

Jira NVGPU-3156

Change-Id: I8610e19c1a6e06521c16a1ec0c3a7a011978d0b7
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2101251
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Debarshi Dutta
2019-03-29 16:40:02 +05:30
committed by mobile promotions
parent 124cdb4509
commit 965062c2bc
12 changed files with 52 additions and 28 deletions

View File

@@ -134,7 +134,7 @@ static u32 nvgpu_runlist_append_prio(struct fifo_gk20a *f,
nvgpu_log_fn(f->g, " ");
for_each_set_bit(tsgid, runlist->active_tsgs, f->num_channels) {
struct tsg_gk20a *tsg = &f->tsg[tsgid];
struct tsg_gk20a *tsg = nvgpu_tsg_get_from_id(f->g, tsgid);
u32 entries;
if (tsg->interleave_level == interleave_level) {
@@ -177,7 +177,7 @@ static u32 nvgpu_runlist_append_med(struct fifo_gk20a *f,
nvgpu_log_fn(f->g, " ");
for_each_set_bit(tsgid, runlist->active_tsgs, f->num_channels) {
struct tsg_gk20a *tsg = &f->tsg[tsgid];
struct tsg_gk20a *tsg = nvgpu_tsg_get_from_id(f->g, tsgid);
u32 entries;
if (tsg->interleave_level !=
@@ -216,7 +216,7 @@ static u32 nvgpu_runlist_append_low(struct fifo_gk20a *f,
nvgpu_log_fn(f->g, " ");
for_each_set_bit(tsgid, runlist->active_tsgs, f->num_channels) {
struct tsg_gk20a *tsg = &f->tsg[tsgid];
struct tsg_gk20a *tsg = nvgpu_tsg_get_from_id(f->g, tsgid);
u32 entries;
if (tsg->interleave_level !=

View File

@@ -48,6 +48,24 @@ void nvgpu_tsg_disable(struct tsg_gk20a *tsg)
nvgpu_rwsem_up_read(&tsg->ch_list_lock);
}
struct tsg_gk20a *nvgpu_tsg_check_and_get_from_id(struct gk20a *g, u32 tsgid)
{
if (tsgid == NVGPU_INVALID_TSG_ID) {
return NULL;
}
return nvgpu_tsg_get_from_id(g, tsgid);
}
struct tsg_gk20a *nvgpu_tsg_get_from_id(struct gk20a *g, u32 tsgid)
{
struct fifo_gk20a *f = &g->fifo;
return &f->tsg[tsgid];
}
static bool gk20a_is_channel_active(struct gk20a *g, struct channel_gk20a *ch)
{
struct fifo_gk20a *f = &g->fifo;

View File

@@ -85,7 +85,7 @@ void nvgpu_rc_pbdma_fault(struct gk20a *g, struct fifo_gk20a *f,
/* Remove channel from runlist */
id = pbdma_status.id;
if (pbdma_status.id_type == PBDMA_STATUS_ID_TYPE_TSGID) {
struct tsg_gk20a *tsg = &f->tsg[id];
struct tsg_gk20a *tsg = nvgpu_tsg_get_from_id(g, id);
nvgpu_tsg_set_error_notifier(g, tsg, error_notifier);
nvgpu_rc_tsg_and_related_engines(g, tsg, true,

View File

@@ -1114,7 +1114,7 @@ void vgpu_gr_handle_sm_esr_event(struct gk20a *g,
return;
}
tsg = &g->fifo.tsg[info->tsg_id];
tsg = nvgpu_tsg_check_and_get_from_id(g, info->tsg_id);
if (tsg == NULL) {
nvgpu_err(g, "invalid tsg");
return;

View File

@@ -117,9 +117,10 @@ static void vgpu_handle_channel_event(struct gk20a *g,
return;
}
tsg = &g->fifo.tsg[info->id];
nvgpu_tsg_post_event_id(tsg, info->event_id);
tsg = nvgpu_tsg_check_and_get_from_id(g, info->id);
if (tsg != NULL) {
nvgpu_tsg_post_event_id(tsg, info->event_id);
}
}
static void vgpu_channel_abort_cleanup(struct gk20a *g, u32 chid)