diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-09-14 06:47:48 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-15 15:48:21 -0400 |
commit | 2b7e8a2c2a5df041c9a434804d0f3f6d9df82737 (patch) | |
tree | 126b14a854a75aa926966acfe41f4f5823711cfe /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |
parent | 460951ed092aad787bacd0ebb0646b799d3463a1 (diff) |
gpu: nvgpu: fix channel unbind sequence from TSG
We right now remove a channel from TSG list and disable all the channels in
TSG while removing a channel from TSG
With this sequence if any one channel in TSG is closed, rest of the channels
are set as timed out and cannot be used anymore
We need to fix this sequence as below to allow removing a channel from active
TSG so that rest of the channels can still be used
- disable all channels of TSG
- preempt TSG
- check if CTX_RELOAD is set if support is available
if CTX_RELOAD is set on channel, it should be moved to some other channel
- check if FAULTED is set if support is available
- if NEXT is set on channel then it means channel is still active
print out an error in this case for the time being until properly handled
- remove the channel from runlist
- remove channel from TSG list
- re-enable rest of the channels in TSG
- clean up the channel (same as regular channels)
Add below fifo operations to support checking channel status
g->ops.fifo.tsg_verify_status_ctx_reload
g->ops.fifo.tsg_verify_status_faulted
Define ops.fifo.tsg_verify_status_ctx_reload operation for gm20b/gp10b/gp106
as gm20b_fifo_tsg_verify_status_ctx_reload()
This API will check if channel to be released has CTX_RELOAD set, if yes
CTX_RELOAD needs to be moved to some other channel in TSG
Remove static from channel_gk20a_update_runlist() and export it
Bug 200327095
Change-Id: I0dd4be7c7e0b9b759389ec12c5a148a4b919d3e2
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1560637
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 56 |
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 | ||
1902 | static 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 | |||
1919 | int 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 | |||
1953 | fail_enable_tsg: | ||
1954 | g->ops.fifo.enable_tsg(tsg); | ||
1955 | return err; | ||
1956 | } | ||
1957 | |||
1902 | u32 gk20a_fifo_get_failing_engine_data(struct gk20a *g, | 1958 | u32 gk20a_fifo_get_failing_engine_data(struct gk20a *g, |
1903 | int *__id, bool *__is_tsg) | 1959 | int *__id, bool *__is_tsg) |
1904 | { | 1960 | { |