summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gv11b/fifo_gv11b.c35
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c13
2 files changed, 21 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
index 847bf172..90295f52 100644
--- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
@@ -706,28 +706,13 @@ static int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id,
706static int gv11b_fifo_preempt_channel(struct gk20a *g, u32 hw_chid) 706static int gv11b_fifo_preempt_channel(struct gk20a *g, u32 hw_chid)
707{ 707{
708 struct fifo_gk20a *f = &g->fifo; 708 struct fifo_gk20a *f = &g->fifo;
709 u32 ret = 0; 709 u32 tsgid;
710 u32 token = PMU_INVALID_MUTEX_OWNER_ID;
711 u32 mutex_ret = 0;
712 u32 runlist_id;
713
714 gk20a_dbg_fn("%d", hw_chid);
715
716 runlist_id = f->channel[hw_chid].runlist_id;
717 gk20a_dbg_fn("runlist_id %d", runlist_id);
718
719 nvgpu_mutex_acquire(&f->runlist_info[runlist_id].mutex);
720
721 mutex_ret = nvgpu_pmu_mutex_acquire(&g->pmu, PMU_MUTEX_ID_FIFO, &token);
722
723 ret = __locked_fifo_preempt(g, hw_chid, false);
724
725 if (!mutex_ret)
726 nvgpu_pmu_mutex_release(&g->pmu, PMU_MUTEX_ID_FIFO, &token);
727 710
728 nvgpu_mutex_release(&f->runlist_info[runlist_id].mutex); 711 tsgid = f->channel[hw_chid].tsgid;
712 nvgpu_log_info(g, "chid:%d tsgid:%d", hw_chid, tsgid);
729 713
730 return ret; 714 /* Preempt tsg. Channel preempt is NOOP */
715 return g->ops.fifo.preempt_tsg(g, tsgid);
731} 716}
732 717
733static int __locked_fifo_preempt_runlists(struct gk20a *g, u32 runlists_mask) 718static int __locked_fifo_preempt_runlists(struct gk20a *g, u32 runlists_mask)
@@ -818,9 +803,15 @@ static int __locked_fifo_preempt_ch_tsg(struct gk20a *g, u32 id,
818 unsigned int id_type, unsigned int timeout_rc_type) 803 unsigned int id_type, unsigned int timeout_rc_type)
819{ 804{
820 int ret; 805 int ret;
806 struct fifo_gk20a *f = &g->fifo;
821 807
822 /* issue preempt */ 808 nvgpu_log_fn(g, "id:%d id_type:%d", id, id_type);
823 gk20a_fifo_issue_preempt(g, id, id_type); 809
810 /* Issue tsg preempt. Channel preempt is noop */
811 if (id_type == ID_TYPE_CHANNEL)
812 gk20a_fifo_issue_preempt(g, f->channel[id].tsgid, true);
813 else
814 gk20a_fifo_issue_preempt(g, id, true);
824 815
825 /* wait for preempt */ 816 /* wait for preempt */
826 ret = g->ops.fifo.is_preempt_pending(g, id, id_type, 817 ret = g->ops.fifo.is_preempt_pending(g, id, id_type,
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index 503fb6f7..a703e72c 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -1593,12 +1593,15 @@ static int gr_gv11b_disable_channel_or_tsg(struct gk20a *g, struct channel_gk20a
1593 1593
1594 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg | gpu_dbg_intr, "CILP: restarted runlist"); 1594 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg | gpu_dbg_intr, "CILP: restarted runlist");
1595 1595
1596 if (gk20a_is_channel_marked_as_tsg(fault_ch)) 1596 if (gk20a_is_channel_marked_as_tsg(fault_ch)) {
1597 gk20a_fifo_issue_preempt(g, fault_ch->tsgid, true); 1597 gk20a_fifo_issue_preempt(g, fault_ch->tsgid, true);
1598 else 1598 nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg | gpu_dbg_intr,
1599 gk20a_fifo_issue_preempt(g, fault_ch->hw_chid, false); 1599 "CILP: preempted the channel/tsg");
1600 1600 } else {
1601 gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg | gpu_dbg_intr, "CILP: preempted the channel/tsg"); 1601 nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg | gpu_dbg_intr,
1602 "CILP: tsgid is invalid, cannot preempt");
1603 WARN_ON(1); /* only TSG can be preempted */
1604 }
1602 1605
1603 return ret; 1606 return ret;
1604} 1607}