summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 2cc5e4cd..1815c15b 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -1899,6 +1899,62 @@ int gk20a_fifo_force_reset_ch(struct channel_gk20a *ch,
1899 return 0; 1899 return 0;
1900} 1900}
1901 1901
1902static int gk20a_fifo_tsg_unbind_channel_verify_status(struct channel_gk20a *ch)
1903{
1904 struct gk20a *g = ch->g;
1905
1906 if (g->ops.fifo.tsg_verify_status_ctx_reload)
1907 g->ops.fifo.tsg_verify_status_ctx_reload(ch);
1908
1909 if (g->ops.fifo.tsg_verify_status_faulted)
1910 g->ops.fifo.tsg_verify_status_faulted(ch);
1911
1912 if (gk20a_fifo_channel_status_is_next(g, ch->chid))
1913 nvgpu_err(g, "Channel %d to be removed from TSG has NEXT set!",
1914 ch->chid);
1915
1916 return 0;
1917}
1918
1919int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch)
1920{
1921 struct gk20a *g = ch->g;
1922 struct fifo_gk20a *f = &g->fifo;
1923 struct tsg_gk20a *tsg = &f->tsg[ch->tsgid];
1924 int err;
1925
1926 /* Disable TSG and examine status before unbinding channel */
1927 g->ops.fifo.disable_tsg(tsg);
1928
1929 err = g->ops.fifo.preempt_tsg(g, tsg->tsgid);
1930 if (err)
1931 goto fail_enable_tsg;
1932
1933 err = gk20a_fifo_tsg_unbind_channel_verify_status(ch);
1934 if (err)
1935 goto fail_enable_tsg;
1936
1937 /* Channel should be seen as TSG channel while updating runlist */
1938 err = channel_gk20a_update_runlist(ch, false);
1939 if (err)
1940 goto fail_enable_tsg;
1941
1942 /* Remove channel from TSG and re-enable rest of the channels */
1943 down_write(&tsg->ch_list_lock);
1944 nvgpu_list_del(&ch->ch_entry);
1945 up_write(&tsg->ch_list_lock);
1946
1947 g->ops.fifo.enable_tsg(tsg);
1948
1949 gk20a_channel_abort_clean_up(ch);
1950
1951 return 0;
1952
1953fail_enable_tsg:
1954 g->ops.fifo.enable_tsg(tsg);
1955 return err;
1956}
1957
1902u32 gk20a_fifo_get_failing_engine_data(struct gk20a *g, 1958u32 gk20a_fifo_get_failing_engine_data(struct gk20a *g,
1903 int *__id, bool *__is_tsg) 1959 int *__id, bool *__is_tsg)
1904{ 1960{