diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2018-11-27 00:35:56 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-02-11 11:18:36 -0500 |
commit | ef9de9e9925573b691d78760e42334ad24c5797f (patch) | |
tree | 068bc5b4bb01de77136ed1da0e5da10d883c164a /drivers/gpu/nvgpu/gv11b | |
parent | 5b8ecbc51fe2e94a233c2c42d497b05c2eccdaf5 (diff) |
gpu: nvgpu: replace input parameter tsgid with pointer to struct tsg_gk20a
gv11b_fifo_preempt_tsg needs to access the runlist_id of the tsg as
well as pass the tsg pointer to other public functions such as
gk20a_fifo_disable_tsg_sched. This qualifies the preempt_tsg to use a
pointer to a struct tsg_gk20a instead of just using the tsgid.
Jira NVGPU-1461
Change-Id: I01fbd2370b5746c2a597a0351e0301b0f7d25175
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1959068
(cherry picked from commit 1e78d47f15ff050edbb10a88550012178d353288
in rel-32)
Reviewed-on: https://git-master.nvidia.com/r/2013725
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/fifo_gv11b.h | 2 |
2 files changed, 19 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c index b0b752af..11ccdd48 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * DEALINGS IN THE SOFTWARE. | 22 | * DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <nvgpu/bug.h> | ||
25 | #include <nvgpu/semaphore.h> | 26 | #include <nvgpu/semaphore.h> |
26 | #include <nvgpu/timers.h> | 27 | #include <nvgpu/timers.h> |
27 | #include <nvgpu/log.h> | 28 | #include <nvgpu/log.h> |
@@ -803,17 +804,22 @@ int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id, | |||
803 | int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid) | 804 | int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid) |
804 | { | 805 | { |
805 | struct fifo_gk20a *f = &g->fifo; | 806 | struct fifo_gk20a *f = &g->fifo; |
806 | u32 tsgid; | 807 | struct tsg_gk20a *tsg = NULL; |
807 | 808 | ||
808 | if (chid == FIFO_INVAL_CHANNEL_ID) { | 809 | if (chid == FIFO_INVAL_CHANNEL_ID) { |
809 | return 0; | 810 | return 0; |
810 | } | 811 | } |
811 | 812 | ||
812 | tsgid = f->channel[chid].tsgid; | 813 | tsg = tsg_gk20a_from_ch(&f->channel[chid]); |
813 | nvgpu_log_info(g, "chid:%d tsgid:%d", chid, tsgid); | 814 | |
815 | if (tsg == NULL) { | ||
816 | return 0; | ||
817 | } | ||
818 | |||
819 | nvgpu_log_info(g, "chid:%d tsgid:%d", chid, tsg->tsgid); | ||
814 | 820 | ||
815 | /* Preempt tsg. Channel preempt is NOOP */ | 821 | /* Preempt tsg. Channel preempt is NOOP */ |
816 | return g->ops.fifo.preempt_tsg(g, tsgid); | 822 | return g->ops.fifo.preempt_tsg(g, tsg); |
817 | } | 823 | } |
818 | 824 | ||
819 | /* TSG enable sequence applicable for Volta and onwards */ | 825 | /* TSG enable sequence applicable for Volta and onwards */ |
@@ -837,7 +843,7 @@ int gv11b_fifo_enable_tsg(struct tsg_gk20a *tsg) | |||
837 | return 0; | 843 | return 0; |
838 | } | 844 | } |
839 | 845 | ||
840 | int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) | 846 | int gv11b_fifo_preempt_tsg(struct gk20a *g, struct tsg_gk20a *tsg) |
841 | { | 847 | { |
842 | struct fifo_gk20a *f = &g->fifo; | 848 | struct fifo_gk20a *f = &g->fifo; |
843 | u32 ret = 0; | 849 | u32 ret = 0; |
@@ -845,12 +851,9 @@ int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) | |||
845 | u32 mutex_ret = 0; | 851 | u32 mutex_ret = 0; |
846 | u32 runlist_id; | 852 | u32 runlist_id; |
847 | 853 | ||
848 | nvgpu_log_fn(g, "tsgid: %d", tsgid); | 854 | nvgpu_log_fn(g, "tsgid: %d", tsg->tsgid); |
849 | if (tsgid == FIFO_INVAL_TSG_ID) { | ||
850 | return 0; | ||
851 | } | ||
852 | 855 | ||
853 | runlist_id = f->tsg[tsgid].runlist_id; | 856 | runlist_id = tsg->runlist_id; |
854 | nvgpu_log_fn(g, "runlist_id: %d", runlist_id); | 857 | nvgpu_log_fn(g, "runlist_id: %d", runlist_id); |
855 | if (runlist_id == FIFO_INVAL_RUNLIST_ID) { | 858 | if (runlist_id == FIFO_INVAL_RUNLIST_ID) { |
856 | return 0; | 859 | return 0; |
@@ -859,27 +862,27 @@ int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) | |||
859 | nvgpu_mutex_acquire(&f->runlist_info[runlist_id].runlist_lock); | 862 | nvgpu_mutex_acquire(&f->runlist_info[runlist_id].runlist_lock); |
860 | 863 | ||
861 | /* WAR for Bug 2065990 */ | 864 | /* WAR for Bug 2065990 */ |
862 | gk20a_fifo_disable_tsg_sched(g, &f->tsg[tsgid]); | 865 | gk20a_fifo_disable_tsg_sched(g, tsg); |
863 | 866 | ||
864 | mutex_ret = nvgpu_pmu_mutex_acquire(&g->pmu, PMU_MUTEX_ID_FIFO, &token); | 867 | mutex_ret = nvgpu_pmu_mutex_acquire(&g->pmu, PMU_MUTEX_ID_FIFO, &token); |
865 | 868 | ||
866 | ret = __locked_fifo_preempt(g, tsgid, true); | 869 | ret = __locked_fifo_preempt(g, tsg->tsgid, true); |
867 | 870 | ||
868 | if (!mutex_ret) { | 871 | if (!mutex_ret) { |
869 | nvgpu_pmu_mutex_release(&g->pmu, PMU_MUTEX_ID_FIFO, &token); | 872 | nvgpu_pmu_mutex_release(&g->pmu, PMU_MUTEX_ID_FIFO, &token); |
870 | } | 873 | } |
871 | 874 | ||
872 | /* WAR for Bug 2065990 */ | 875 | /* WAR for Bug 2065990 */ |
873 | gk20a_fifo_enable_tsg_sched(g, &f->tsg[tsgid]); | 876 | gk20a_fifo_enable_tsg_sched(g, tsg); |
874 | 877 | ||
875 | nvgpu_mutex_release(&f->runlist_info[runlist_id].runlist_lock); | 878 | nvgpu_mutex_release(&f->runlist_info[runlist_id].runlist_lock); |
876 | 879 | ||
877 | if (ret) { | 880 | if (ret) { |
878 | if (nvgpu_platform_is_silicon(g)) { | 881 | if (nvgpu_platform_is_silicon(g)) { |
879 | nvgpu_err(g, "preempt timed out for tsgid: %u, " | 882 | nvgpu_err(g, "preempt timed out for tsgid: %u, " |
880 | "ctxsw timeout will trigger recovery if needed", tsgid); | 883 | "ctxsw timeout will trigger recovery if needed", tsg->tsgid); |
881 | } else { | 884 | } else { |
882 | gk20a_fifo_preempt_timeout_rc(g, tsgid, true); | 885 | gk20a_fifo_preempt_timeout_rc(g, tsg->tsgid, true); |
883 | } | 886 | } |
884 | } | 887 | } |
885 | 888 | ||
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h index 1703fbdc..7ff42637 100644 --- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h | |||
@@ -82,7 +82,7 @@ int gv11b_fifo_reschedule_runlist(struct channel_gk20a *ch, bool preempt_next); | |||
82 | int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id, | 82 | int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id, |
83 | unsigned int id_type); | 83 | unsigned int id_type); |
84 | int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid); | 84 | int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid); |
85 | int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid); | 85 | int gv11b_fifo_preempt_tsg(struct gk20a *g, struct tsg_gk20a *tsg); |
86 | int gv11b_fifo_enable_tsg(struct tsg_gk20a *tsg); | 86 | int gv11b_fifo_enable_tsg(struct tsg_gk20a *tsg); |
87 | void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask, | 87 | void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask, |
88 | u32 id, unsigned int id_type, unsigned int rc_type, | 88 | u32 id, unsigned int id_type, unsigned int rc_type, |